diff --git a/toargridding/static_metadata.py b/toargridding/static_metadata.py index 313358191d851ad81554b710fe925ffc37204516..66e3f28062be193d682a54dd8b3577c80280f1ae 100644 --- a/toargridding/static_metadata.py +++ b/toargridding/static_metadata.py @@ -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