Skip to content

Commit

Permalink
rm _get_diurnal_only and associated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisblake committed Oct 6, 2024
1 parent 88a7c45 commit 519df9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
20 changes: 1 addition & 19 deletions pyaerocom/aeroval/_processing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,6 @@ class HasColocator(HasConfig):
Config class that also has the ability to co-locate
"""

def _get_diurnal_only(self, obs_name):
"""
Check if colocated data is flagged for only diurnal processing
Parameters
----------
obs_name : string
Name of observational subset
colocated_data : ColocatedData
A ColocatedData object that will be checked for suitability of
diurnal processing.
Returns
-------
diurnal_only : bool
"""
return self.cfg.get_obs_entry(obs_name).diurnal_only

def get_colocator(self, model_name: str = None, obs_name: str = None) -> Colocator:
"""
Instantiate colocation engine
Expand Down Expand Up @@ -136,7 +118,7 @@ def get_colocator(self, model_name: str = None, obs_name: str = None) -> Colocat
if key in ColocationSetup.model_fields:
col_cfg[key] = val

col_cfg["add_meta"].update(diurnal_only=self._get_diurnal_only(obs_name))
col_cfg["add_meta"].update(diurnal_only=self.cfg.get_obs_entry(obs_name).diurnal_only)

col_stp = ColocationSetup(**col_cfg)
col = Colocator(col_stp)
Expand Down
12 changes: 6 additions & 6 deletions tests/aeroval/test__processing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ def setup() -> EvalSetup:
"""EvalSetup instance"""
obs_cfg = dict(
obs1=dict(obs_id="obs1", obs_vars=["od550aer"], obs_vert_type="Column"),
obs2=dict(obs_id="obs2", obs_vars=["od550aer"], obs_vert_type="Column", diurnal_only=True),
obs2=dict(
obs_id="obs2",
obs_vars=["od550aer"],
obs_vert_type="Column",
diurnal_only=True,
),
)
return EvalSetup(proj_id="bla", exp_id="blub", obs_cfg=obs_cfg)

Expand Down Expand Up @@ -44,11 +49,6 @@ def collocator(setup: EvalSetup) -> HasColocator:
return HasColocator(setup)


def test_HasColocator_get_diurnal_only(collocator: HasColocator):
assert not collocator._get_diurnal_only("obs1")
assert collocator._get_diurnal_only("obs2")


@pytest.mark.parametrize("obs_name", [None, "obs1", "obs2"])
def test_HasColocator_get_colocator(collocator: HasColocator, obs_name: str | None):
col = collocator.get_colocator(obs_name=obs_name)
Expand Down

0 comments on commit 519df9f

Please sign in to comment.