From 5dec86cf1d04520229d947983fff8de0a4c41d20 Mon Sep 17 00:00:00 2001 From: Carsten Hinz <c.hinz@fz-juelich.de> Date: Mon, 29 Apr 2024 16:03:09 +0200 Subject: [PATCH] added documentation --- toargridding/static_metadata.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/toargridding/static_metadata.py b/toargridding/static_metadata.py index 3133581..66e3f28 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 -- GitLab