Add year to period of construction

This commit is contained in:
Alireza Adli 2024-07-18 08:05:14 -04:00
parent 79388dcc91
commit 9dd816ceb0

View File

@ -40,6 +40,40 @@ class AccessNrcanCatalog:
constructions_path = (self._path / constructions).resolve()
self._constructions = json.loads(constructions_path.read_text())
@staticmethod
def year_to_period_of_construction(year_of_construction):
if 1000 <= year_of_construction <= 1900:
period_of_construction = '1000_1900'
elif 1901 <= year_of_construction <= 1910:
period_of_construction = '1901_1910'
elif 1911 <= year_of_construction <= 1920:
period_of_construction = '1911_1920'
elif 1921 <= year_of_construction <= 1930:
period_of_construction = '1921_1930'
elif 1931 <= year_of_construction <= 1940:
period_of_construction = '1931_1940'
elif 1941 <= year_of_construction <= 1950:
period_of_construction = '1941_1950'
elif 1951 <= year_of_construction <= 1960:
period_of_construction = '1951_1960'
elif 1961 <= year_of_construction <= 1970:
period_of_construction = '1961_1970'
elif 1971 <= year_of_construction <= 1980:
period_of_construction = '1971_1980'
elif 1981 <= year_of_construction <= 1990:
period_of_construction = '1981_1990'
elif 1991 <= year_of_construction <= 2000:
period_of_construction = '1991_2000'
elif 2001 <= year_of_construction <= 2010:
period_of_construction = '2001_2010'
elif 2011 <= year_of_construction <= 2016:
period_of_construction = '2011_2016'
elif 2017 <= year_of_construction <= 2019:
period_of_construction = '2017_2019'
elif 2020 <= year_of_construction <= 3000:
period_of_construction = '2020_3000'
return period_of_construction
def layers(self, opaque_surface_code, component_type):
for opaque_surface in self.constructions['opaque_surfaces']:
opaque_surface_key = list(opaque_surface)[0]