Skip to content
Snippets Groups Projects
Commit 5dec86cf authored by Carsten Hinz's avatar Carsten Hinz
Browse files

added documentation

parent ebe8ef24
No related branches found
No related tags found
1 merge request!11Creation of first beta release version
......@@ -8,14 +8,25 @@ GLOABAL_CF_ATTRIBUTES_PATH = STATIC_METADATA_PATH / "global_cf_attributes.json"
def load_global_cf_attributes():
"""loading of global
Loads global metadata like details on the TOAD DB, license, and CF convention.
"""
with open(GLOABAL_CF_ATTRIBUTES_PATH, "r") as f:
return json.load(f)
@dataclass
class TOARVariable:
vars = None
"""access to available variables of the TOAR database.
This class knows of all variables of the TOAR database supported by this module.
An instance allows direct access to the properties and metadata according to CF of this variable.
"""
vars = None
"""available TOAR variables."""
name: str
longname: str
displayname: str
......@@ -26,6 +37,10 @@ class TOARVariable:
@classmethod
def load_toar_variables(cls) -> list["TOARVariable"]:
"""load available variables
Is executed by loading the TOARVariable class
"""
with open(TOAR_VARIABLES_METADATA_PATH, "r") as f:
variables = json.load(f)
......@@ -33,6 +48,10 @@ class TOARVariable:
@classmethod
def get(cls, standart_name: str) -> "TOARVariable":
"""searches the known variables for the requested variable
return: provides direct access to the meta data of the selected variable
"""
for var in cls.vars:
if var.standart_name == standart_name:
return var
......@@ -41,14 +60,20 @@ class TOARVariable:
@property
def toar_id(self):
"""get toar ID; same as id
"""
return self.id
@property
def standart_name(self):
"""alias to get cf_standardname
"""
return self.cf_standardname
@property
def long_name(self):
"""alias to get longname
"""
return self.longname
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment