Skip to content

Commit

Permalink
Merge pull request #1424 from metno/charlie_work
Browse files Browse the repository at this point in the history
Fix call to model_cfg to use getter function
  • Loading branch information
lewisblake authored Nov 25, 2024
2 parents 6ef2101 + 8d55c2b commit 232a3c9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pyaerocom/aeroval/modelmaps_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,16 +367,16 @@ def _read_model_data(self, model_name: str, var: str) -> GriddedData:
# overwrite start and stop to read climatology file for model
start, stop = 9999, None

data_id = self.cfg.model_cfg[model_name].model_id
data_id = self.cfg.model_cfg.get_entry(model_name).model_id

try:
data_dir = self.cfg.model_cfg[model_name].model_data_dir
data_dir = self.cfg.model_cfg.get_entry(model_name).model_data_dir
except Exception as e:
logger.info(f"Could not find model dir. Setting to None. Error {str(e)}")
data_dir = None

try:
model_reader = self.cfg.model_cfg[model_name].gridded_reader_id["model"]
model_reader = self.cfg.model_cfg.get_entry(model_name).gridded_reader_id["model"]
except Exception as e:
logger.info(f"Could not find model reader. Setting to None. Error {str(e)}")
model_reader = None
Expand All @@ -392,8 +392,8 @@ def _read_model_data(self, model_name: str, var: str) -> GriddedData:
**self.cfg.colocation_opts.model_kwargs,
)

if var in self.cfg.model_cfg[model_name].model_read_aux:
aux_instructions = self.cfg.model_cfg[model_name].model_read_aux[var]
if var in self.cfg.model_cfg.get_entry(model_name).model_read_aux:
aux_instructions = self.cfg.model_cfg.get_entry(model_name).model_read_aux[var]
reader.add_aux_compute(var_name=var, **aux_instructions)

kwargs = {}
Expand Down

0 comments on commit 232a3c9

Please sign in to comment.