Skip to content

Commit

Permalink
remove no longer needed BrowseDict fields in BaseModels
Browse files Browse the repository at this point in the history
  • Loading branch information
heikoklein committed Jul 11, 2024
1 parent 99339ce commit d9f234a
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions pyaerocom/aeroval/setupclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pathlib import Path
from typing import Annotated, Literal

from pyaerocom.aeroval import glob_defaults
from pyaerocom.aeroval.glob_defaults import VarWebInfo, VarWebScaleAndColormap

if sys.version_info >= (3, 11):
from typing import Self
Expand Down Expand Up @@ -59,7 +59,7 @@ class OutputPaths(BaseModel):
# Pydantic ConfigDict
model_config = ConfigDict(arbitrary_types_allowed=True)

JSON_SUBDIRS: list[str] = [
_JSON_SUBDIRS: list[str] = [
"map",
"ts",
"ts/diurnal",
Expand All @@ -85,8 +85,6 @@ def validate_basedirs(cls, v):
tmp.mkdir(parents=True, exist_ok=True)
return v

ADD_GLOB: list[str] = ["coldata_basedir", "json_basedir"]

proj_id: str
exp_id: str

Expand All @@ -102,7 +100,7 @@ def get_coldata_dir(self, assert_exists=True):
def get_json_output_dirs(self, assert_exists=True):
out = {}
base = os.path.join(self.json_basedir, self.proj_id, self.exp_id)
for subdir in self.JSON_SUBDIRS:
for subdir in self._JSON_SUBDIRS:
loc = self._check_init_dir(os.path.join(base, subdir), assert_exists)
out[subdir] = loc
# for cams2_83 the extra 'forecast' folder will contain the median scores if computed
Expand Down Expand Up @@ -302,9 +300,6 @@ class EvalSetup(BaseModel):
## Regular & BaseModel-based Attributes
########################################

IGNORE_JSON: list[str] = ["_aux_funs"]
ADD_GLOB: list[str] = ["io_aux_file", "var_web_info_file", "var_scale_colmap_file"]

io_aux_file: Annotated[
Path | str, ".py file containing additional read methods for modeldata"
] = ""
Expand Down Expand Up @@ -350,12 +345,12 @@ def gridded_aux_funs(self) -> dict:
return self._aux_funs

@cached_property
def var_web_info(self) -> glob_defaults.VarWebInfo:
return glob_defaults.VarWebInfo(config_file=self.var_web_info_file)
def var_web_info(self) -> VarWebInfo:
return VarWebInfo(config_file=self.var_web_info_file)

@cached_property
def var_scale_colmap(self) -> glob_defaults.VarWebScaleAndColormap:
return glob_defaults.VarWebScaleAndColormap(config_file=self.var_scale_colmap_file)
def var_scale_colmap(self) -> VarWebScaleAndColormap:
return VarWebScaleAndColormap(config_file=self.var_scale_colmap_file)

@computed_field
@cached_property
Expand Down

0 comments on commit d9f234a

Please sign in to comment.