Skip to content

Commit

Permalink
docstring examples for GeeStaticModelData
Browse files Browse the repository at this point in the history
  • Loading branch information
vergauwenthomas committed Aug 27, 2024
1 parent 94cf1e0 commit 5f0f2c0
Show file tree
Hide file tree
Showing 2 changed files with 463 additions and 0 deletions.
20 changes: 20 additions & 0 deletions metobs_toolkit/dataset_modeldata.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,26 @@ def get_landcover(

return lcdf

def add_new_geemodeldata(self, Modeldata, overwrite=False):
# Check instance
if not (
(isinstance(Modeldata, GeeStaticModelData))
| (isinstance(Modeldata, GeeDynamicModelData))
):
raise MetobsDatasetGeeModelDataHandlingError(
f"{Modeldata} is not an instance of GeeStaticModelData or GeeDynamicModelData."
)
# Check name is unique
if Modeldata.name in self.gee_datasets.keys():
if overwrite:
logger.info(f"Overwriting the {Modeldata.name} known Modeldata.")
else:
raise MetobsDatasetGeeModelDataHandlingError(
f"{Modeldata.name} is already a known name of a Modeldata."
)

self.gee_datasets[Modeldata.name] = Modeldata


class MetobsDatasetGeeModelDataHandlingError(Exception):
"""Exception raised for errors in the Dataset - GEE modeldata interactions."""
Expand Down
Loading

0 comments on commit 5f0f2c0

Please sign in to comment.