diff --git a/pyaerocom/aeroval/modelmaps_engine.py b/pyaerocom/aeroval/modelmaps_engine.py index 7d04722e3..3cfda0e9a 100644 --- a/pyaerocom/aeroval/modelmaps_engine.py +++ b/pyaerocom/aeroval/modelmaps_engine.py @@ -161,8 +161,12 @@ def _process_map_var(self, model_name, var, reanalyse_existing): logger.info(f"Skipping processing of {outname}: data already exists.") return [] - freq = min(TsType(fq) for fq in self.cfg.time_cfg.freqs) - freq = min(freq, self.cfg.time_cfg.main_freq) + maps_freq = TsType(self.cfg.modelmaps_opts.maps_freq) + if maps_freq == "coarsest": # TODO: Implement this in terms of a TsType object. #1267 + freq = min(TsType(fq) for fq in self.cfg.time_cfg.freqs) + freq = min(freq, self.cfg.time_cfg.main_freq) + else: + freq = maps_freq tst = TsType(data.ts_type) if tst < freq: diff --git a/pyaerocom/aeroval/setupclasses.py b/pyaerocom/aeroval/setupclasses.py index 97ce41383..7e54c3f02 100644 --- a/pyaerocom/aeroval/setupclasses.py +++ b/pyaerocom/aeroval/setupclasses.py @@ -111,7 +111,7 @@ def get_json_output_dirs(self, assert_exists=True): class ModelMapsSetup(BaseModel): - maps_freq: Literal["monthly", "yearly"] = "monthly" + maps_freq: Literal["hourly", "daily", "monthly", "yearly", "coarsest"] = "coarsest" maps_res_deg: PositiveInt = 5 diff --git a/pyaerocom/time_config.py b/pyaerocom/time_config.py index 00e8c689b..00a110786 100644 --- a/pyaerocom/time_config.py +++ b/pyaerocom/time_config.py @@ -6,7 +6,7 @@ from iris import coord_categorisation -TS_TYPES = ["minutely", "hourly", "daily", "weekly", "monthly", "yearly", "native"] +TS_TYPES = ["minutely", "hourly", "daily", "weekly", "monthly", "yearly", "native", "coarsest"] # The following import was removed and the information about available unit # strings was copied from the netCDF4 module directly here diff --git a/pyaerocom/tstype.py b/pyaerocom/tstype.py index 052d6feb8..ee77aa3a5 100644 --- a/pyaerocom/tstype.py +++ b/pyaerocom/tstype.py @@ -21,7 +21,7 @@ class TsType: VALID = TS_TYPES - VALID_ITER = VALID[:-1] + VALID_ITER = VALID[:-2] FROM_PANDAS = PANDAS_FREQ_TO_TS_TYPE TO_PANDAS = TS_TYPE_TO_PANDAS_FREQ TO_NUMPY = TS_TYPE_TO_NUMPY_FREQ diff --git a/tests/aeroval/test_setupclasses.py b/tests/aeroval/test_setupclasses.py index e3a6451fb..447bd214c 100644 --- a/tests/aeroval/test_setupclasses.py +++ b/tests/aeroval/test_setupclasses.py @@ -153,7 +153,7 @@ def test_EvalSetup_ModelMapsSetup(eval_setup: EvalSetup, cfg_exp1: dict, update: assert modelmaps_opts.maps_res_deg == cfg_exp1["maps_res_deg"] == update["maps_res_deg"] else: # defaults assert "maps_freq" not in cfg_exp1 - assert modelmaps_opts.maps_freq == "monthly" + assert modelmaps_opts.maps_freq == "coarsest" assert "maps_res_deg" not in cfg_exp1 assert modelmaps_opts.maps_res_deg == 5 diff --git a/tests/io/test_iris_io.py b/tests/io/test_iris_io.py index 3c7a6bbb4..0b1725ddc 100644 --- a/tests/io/test_iris_io.py +++ b/tests/io/test_iris_io.py @@ -109,7 +109,7 @@ def test_check_time_coord(cube: Cube): "blaa", 2010, TemporalResolutionError, - "Invalid input for ts_type blaa. Choose from ['minutely', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'native']", + "Invalid input for ts_type blaa. Choose from ['minutely', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'native', 'coarsest']", id="wrong ts_type", ), pytest.param( diff --git a/tests/test_tstype.py b/tests/test_tstype.py index b459b60f5..3d36f9453 100644 --- a/tests/test_tstype.py +++ b/tests/test_tstype.py @@ -6,7 +6,16 @@ def test_TsType_VALID(): - assert TsType.VALID == ["minutely", "hourly", "daily", "weekly", "monthly", "yearly", "native"] + assert TsType.VALID == [ + "minutely", + "hourly", + "daily", + "weekly", + "monthly", + "yearly", + "native", + "coarsest", + ] def test_TsType_VALID_ITER(): @@ -75,7 +84,7 @@ def test_TsType_val(): ( "blaa", "Invalid input for ts_type blaa. " - "Choose from ['minutely', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'native']", + "Choose from ['minutely', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'native', 'coarsest']", ), ( "5000daily",