From 266386f530502389937731a08979e3832798992c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mirko=20M=C3=A4licke?= Date: Mon, 29 Jan 2024 13:34:46 +0100 Subject: [PATCH] add the database name to the config --- src/param.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/param.py b/src/param.py index 2babb87..ef91afd 100644 --- a/src/param.py +++ b/src/param.py @@ -30,14 +30,19 @@ class NetCDFBackends(str, Enum): class Params(BaseModel): + # mandatory inputs are the dataset ids and the reference area dataset_ids: List[int] reference_area: dict = Field(repr=False) + # optional parameters to configure the processing start_date: datetime = None end_date: datetime = None - keep_intermediate: bool = False integration: Integrations = Integrations.ALL + # optional parameter to configure output + keep_intermediate: bool = False + database_name: str = 'dataset.db' + # stuff that we do not change in the tool base_path: str = '/out' netcdf_backend: NetCDFBackends = NetCDFBackends.XARRAY @@ -61,12 +66,16 @@ def dataset_path(self) -> Path: p.mkdir(parents=True, exist_ok=True) return p - + @property + def database_path(self) -> Path: + return Path(self.base_path) / self.database_name + @property def reference_area_df(self) -> gpd.GeoDataFrame: return gpd.GeoDataFrame.from_features([self.reference_area]) + # manage a single instance to this class __SINGLETON: Params = None def load_params(**kwargs) -> Params: