Add hub to nrcan function

This commit is contained in:
Alireza Adli 2024-07-18 09:32:40 -04:00
parent 9dd816ceb0
commit 7943cd7fda

View File

@ -9,6 +9,9 @@ Code contributors: Alireza Adli alireza.adli@concordia.ca
import json
from pathlib import Path
from hub.helpers.data.hub_function_to_nrcan_construction_function \
import HubFunctionToNrcanConstructionFunction
class AccessNrcanCatalog:
"""
@ -21,6 +24,7 @@ class AccessNrcanCatalog:
self._path = Path(path)
self.archetypes = archetypes
self.constructions = constructions
self.hub_to_nrcan_dictionary = HubFunctionToNrcanConstructionFunction().dictionary
@property
def archetypes(self):
@ -40,8 +44,12 @@ class AccessNrcanCatalog:
constructions_path = (self._path / constructions).resolve()
self._constructions = json.loads(constructions_path.read_text())
def hub_to_nrcan_function(self, hub_function):
return self.hub_to_nrcan_dictionary[hub_function]
@staticmethod
def year_to_period_of_construction(year_of_construction):
period_of_construction = None
if 1000 <= year_of_construction <= 1900:
period_of_construction = '1000_1900'
elif 1901 <= year_of_construction <= 1910: