climate-ref-pmp 0.5.2__tar.gz → 0.5.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/PKG-INFO +1 -1
  2. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/pyproject.toml +1 -1
  3. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/src/climate_ref_pmp/diagnostics/annual_cycle.py +2 -20
  4. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/src/climate_ref_pmp/diagnostics/variability_modes.py +1 -0
  5. climate_ref_pmp-0.5.4/tests/integration/test_diagnostics.py +23 -0
  6. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/tests/unit/test_annual_cycle.py +2 -32
  7. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/tests/unit/test_variability_modes.py +0 -30
  8. climate_ref_pmp-0.5.2/tests/integration/test_diagnostics.py +0 -12
  9. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/.gitignore +0 -0
  10. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/LICENCE +0 -0
  11. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/NOTICE +0 -0
  12. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/README.md +0 -0
  13. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/conftest.py +0 -0
  14. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/src/climate_ref_pmp/__init__.py +0 -0
  15. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/src/climate_ref_pmp/dataset_registry/pmp_climatology.txt +0 -0
  16. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/src/climate_ref_pmp/diagnostics/__init__.py +0 -0
  17. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/src/climate_ref_pmp/params/pmp_param_MoV-psl.py +0 -0
  18. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/src/climate_ref_pmp/params/pmp_param_MoV-ts.py +0 -0
  19. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/src/climate_ref_pmp/params/pmp_param_annualcycle_1-clims.py +0 -0
  20. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/src/climate_ref_pmp/params/pmp_param_annualcycle_2-metrics.py +0 -0
  21. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/src/climate_ref_pmp/pmp_driver.py +0 -0
  22. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/src/climate_ref_pmp/py.typed +0 -0
  23. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/src/climate_ref_pmp/requirements/conda-lock.yml +0 -0
  24. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/src/climate_ref_pmp/requirements/environment.yml +0 -0
  25. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/tests/unit/conftest.py +0 -0
  26. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/tests/unit/test_pmp_driver.py +0 -0
  27. {climate_ref_pmp-0.5.2 → climate_ref_pmp-0.5.4}/tests/unit/test_provider.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: climate-ref-pmp
3
- Version: 0.5.2
3
+ Version: 0.5.4
4
4
  Summary: PMP diagnostic provider for the Rapid Evaluation Framework
5
5
  Author-email: Jiwoo Lee <jwlee@llnl.gov>
6
6
  License: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "climate-ref-pmp"
3
- version = "0.5.2"
3
+ version = "0.5.4"
4
4
  description = "PMP diagnostic provider for the Rapid Evaluation Framework"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -1,6 +1,5 @@
1
1
  import datetime
2
2
  import json
3
- from collections.abc import Iterable
4
3
  from typing import Any
5
4
 
6
5
  from loguru import logger
@@ -82,21 +81,6 @@ class AnnualCycle(CommandLineDiagnostic):
82
81
  self.parameter_file_1 = "pmp_param_annualcycle_1-clims.py"
83
82
  self.parameter_file_2 = "pmp_param_annualcycle_2-metrics.py"
84
83
 
85
- def build_cmd(self, definition: ExecutionDefinition) -> Iterable[str]:
86
- """
87
- Build the command to run the diagnostic
88
-
89
- Parameters
90
- ----------
91
- definition
92
- Definition of the diagnostic execution
93
-
94
- Returns
95
- -------
96
- Command arguments to execute in the PMP environment
97
- """
98
- raise NotImplementedError("Function not required")
99
-
100
84
  def build_cmds(self, definition: ExecutionDefinition) -> list[list[str]]:
101
85
  """
102
86
  Build the command to run the diagnostic
@@ -283,7 +267,7 @@ class AnnualCycle(CommandLineDiagnostic):
283
267
  cmec_metric_bundle=cmec_metric_bundle,
284
268
  )
285
269
 
286
- def run(self, definition: ExecutionDefinition) -> ExecutionResult:
270
+ def execute(self, definition: ExecutionDefinition) -> None:
287
271
  """
288
272
  Run the diagnostic on the given configuration.
289
273
 
@@ -302,8 +286,6 @@ class AnnualCycle(CommandLineDiagnostic):
302
286
  runs = [self.provider.run(cmd) for cmd in cmds]
303
287
  logger.debug(f"runs: {runs}")
304
288
 
305
- return self.build_execution_result(definition)
306
-
307
289
 
308
290
  def _transform_results(data: dict[str, Any]) -> dict[str, Any]:
309
291
  """
@@ -312,7 +294,7 @@ def _transform_results(data: dict[str, Any]) -> dict[str, Any]:
312
294
  Parameters
313
295
  ----------
314
296
  data : dict
315
- The original executions dictionary.
297
+ The original execution dictionary.
316
298
 
317
299
  Returns
318
300
  -------
@@ -32,6 +32,7 @@ class ExtratropicalModesOfVariability(CommandLineDiagnostic):
32
32
  )
33
33
 
34
34
  def __init__(self, mode_id: str):
35
+ super().__init__()
35
36
  self.mode_id = mode_id.upper()
36
37
  self.name = f"Extratropical modes of variability: {mode_id}"
37
38
  self.slug = f"extratropical-modes-of-variability-{mode_id.lower()}"
@@ -0,0 +1,23 @@
1
+ import pytest
2
+ from climate_ref_pmp import provider as pmp_provider
3
+
4
+ from climate_ref_core.diagnostics import Diagnostic
5
+
6
+ diagnostics = [pytest.param(diagnostic, id=diagnostic.slug) for diagnostic in pmp_provider.diagnostics()]
7
+
8
+
9
+ @pytest.mark.slow
10
+ @pytest.mark.parametrize("diagnostic", diagnostics)
11
+ def test_diagnostics(diagnostic: Diagnostic, diagnostic_validation):
12
+ validator = diagnostic_validation(diagnostic)
13
+
14
+ definition = validator.get_definition()
15
+ validator.execute(definition)
16
+
17
+
18
+ @pytest.mark.parametrize("diagnostic", diagnostics)
19
+ def test_build_results(diagnostic: Diagnostic, diagnostic_validation):
20
+ validator = diagnostic_validation(diagnostic)
21
+
22
+ definition = validator.get_regression_definition()
23
+ validator.validate(definition)
@@ -2,7 +2,6 @@ import datetime
2
2
 
3
3
  import pandas as pd
4
4
  import pytest
5
- from attr import evolve
6
5
  from climate_ref_pmp import AnnualCycle
7
6
  from climate_ref_pmp import provider as pmp_provider
8
7
  from climate_ref_pmp.pmp_driver import _get_resource
@@ -186,7 +185,7 @@ def test_annual_cycle_diagnostic(
186
185
  ]
187
186
 
188
187
 
189
- def test_diagnostic_run(mocker, provider):
188
+ def test_diagnostic_execute(mocker, provider):
190
189
  diagnostic = AnnualCycle()
191
190
  diagnostic.provider = provider
192
191
 
@@ -200,36 +199,7 @@ def test_diagnostic_run(mocker, provider):
200
199
  diagnostic.build_cmds = mocker.MagicMock(return_value=[["mocked_command"], ["mocked_command_2"]])
201
200
  diagnostic.build_execution_result = mocker.MagicMock()
202
201
 
203
- diagnostic.run("definition")
202
+ diagnostic.execute("definition")
204
203
 
205
204
  diagnostic.build_cmds.assert_called_once_with("definition")
206
205
  assert diagnostic.provider.run.call_count == 2
207
- diagnostic.build_execution_result.assert_called_once_with("definition")
208
-
209
-
210
- def test_build_cmd_raises():
211
- diagnostic = AnnualCycle()
212
- with pytest.raises(NotImplementedError):
213
- diagnostic.build_cmd("definition")
214
-
215
-
216
- def test_diagnostic_build_result(config, provider, execution_regression_dir, data_catalog):
217
- diagnostic = AnnualCycle()
218
- diagnostic.provider = pmp_provider
219
- diagnostic.provider.configure(config)
220
-
221
- key = "cmip6_hist-GHG_r1i1p1f1_ACCESS-ESM1-5_ts__pmp-climatology_ERA-5_ts"
222
- output_directory = execution_regression_dir(diagnostic, key)
223
-
224
- execution = next(
225
- solve_executions(
226
- data_catalog=data_catalog,
227
- diagnostic=diagnostic,
228
- provider=diagnostic.provider,
229
- )
230
- )
231
- definition = execution.build_execution_definition(output_root=config.paths.scratch)
232
- definition = evolve(definition, output_directory=output_directory)
233
-
234
- result = diagnostic.build_execution_result(definition)
235
- assert result.successful
@@ -2,8 +2,6 @@ import shutil
2
2
 
3
3
  import pandas as pd
4
4
  import pytest
5
- from attr import evolve
6
- from climate_ref_pmp import provider as pmp_provider
7
5
  from climate_ref_pmp.diagnostics import ExtratropicalModesOfVariability
8
6
  from climate_ref_pmp.pmp_driver import _get_resource
9
7
 
@@ -118,31 +116,3 @@ def test_mode_id_invalid():
118
116
  with pytest.raises(ValueError) as excinfo:
119
117
  ExtratropicalModesOfVariability("INVALID")
120
118
  assert "Unknown mode_id 'INVALID'" in str(excinfo.value)
121
-
122
-
123
- @pytest.mark.parametrize(
124
- "mode",
125
- sorted(
126
- set(ExtratropicalModesOfVariability.psl_modes + ExtratropicalModesOfVariability.ts_modes) - {"AMO"}
127
- ),
128
- )
129
- def test_diagnostic_build_result(mode, config, provider, execution_regression_dir, data_catalog):
130
- diagnostic = ExtratropicalModesOfVariability(mode)
131
- diagnostic.provider = pmp_provider
132
- diagnostic.provider.configure(config)
133
-
134
- execution = next(
135
- solve_executions(
136
- data_catalog=data_catalog,
137
- diagnostic=diagnostic,
138
- provider=diagnostic.provider,
139
- )
140
- )
141
- definition = execution.build_execution_definition(output_root=config.paths.scratch)
142
- output_directory = execution_regression_dir(diagnostic, definition.key)
143
- assert output_directory.exists()
144
-
145
- definition = evolve(definition, output_directory=output_directory)
146
-
147
- result = diagnostic.build_execution_result(definition)
148
- assert result.successful
@@ -1,12 +0,0 @@
1
- import pytest
2
- from climate_ref_pmp import provider as pmp_provider
3
-
4
- from climate_ref_core.diagnostics import Diagnostic
5
-
6
- diagnostics = [pytest.param(diagnostic, id=diagnostic.slug) for diagnostic in pmp_provider.diagnostics()]
7
-
8
-
9
- @pytest.mark.slow
10
- @pytest.mark.parametrize("diagnostic", diagnostics)
11
- def test_diagnostics(diagnostic: Diagnostic, diagnostic_validation):
12
- diagnostic_validation(diagnostic)
File without changes
File without changes