climate-ref-example 0.15.0__tar.gz → 0.16.1__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.
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/PKG-INFO +1 -1
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/pyproject.toml +1 -1
- climate_ref_example-0.16.1/tests/integration/test_diagnostics.py +5 -0
- climate_ref_example-0.15.0/tests/integration/test_diagnostics.py +0 -105
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/.gitignore +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/LICENCE +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/NOTICE +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/README.md +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/src/climate_ref_example/__init__.py +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/src/climate_ref_example/example.py +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/src/climate_ref_example/py.typed +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/src/climate_ref_example/surface_temperature.py +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-mean-timeseries/cmip7/catalog.yaml +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-mean-timeseries/cmip7/manifest.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-mean-timeseries/cmip7/regression/diagnostic.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-mean-timeseries/cmip7/regression/output.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-mean-timeseries/cmip7/regression/series.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-mean-timeseries/default/catalog.yaml +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-mean-timeseries/default/manifest.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-mean-timeseries/default/regression/diagnostic.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-mean-timeseries/default/regression/output.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-mean-timeseries/default/regression/series.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-sst-bias/cmip7/catalog.yaml +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-sst-bias/cmip7/manifest.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-sst-bias/cmip7/regression/diagnostic.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-sst-bias/cmip7/regression/output.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-sst-bias/cmip7/regression/series.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-sst-bias/default/catalog.yaml +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-sst-bias/default/manifest.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-sst-bias/default/regression/diagnostic.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-sst-bias/default/regression/output.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/test-data/global-sst-bias/default/regression/series.json +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/unit/test_metrics.py +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/unit/test_provider.py +0 -0
- {climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/unit/test_surface_temperature.py +0 -0
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
|
-
|
|
3
|
-
import pytest
|
|
4
|
-
from climate_ref_example import provider
|
|
5
|
-
|
|
6
|
-
from climate_ref.testing import TestCaseRunner, validate_result
|
|
7
|
-
from climate_ref_core.diagnostics import Diagnostic
|
|
8
|
-
from climate_ref_core.testing import (
|
|
9
|
-
RegressionValidator,
|
|
10
|
-
TestCasePaths,
|
|
11
|
-
collect_test_case_params,
|
|
12
|
-
load_datasets_from_yaml,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@pytest.fixture(scope="session")
|
|
17
|
-
def provider_test_data_dir() -> Path:
|
|
18
|
-
"""Path to the package-local test data directory."""
|
|
19
|
-
return Path(__file__).parent.parent / "test-data"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
test_case_params = collect_test_case_params(provider)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@pytest.mark.skip(
|
|
26
|
-
reason="Parked: RegressionValidator replays the committed bundle offline, but native baselines "
|
|
27
|
-
"now live in the object store (Framework B), so build_execution_result cannot rebuild from the "
|
|
28
|
-
"repo alone. `ref test-cases replay` provides regression coverage via the store; this offline "
|
|
29
|
-
"path is retained (body intact) for local step-through debugging."
|
|
30
|
-
)
|
|
31
|
-
@pytest.mark.parametrize("diagnostic,test_case_name", test_case_params)
|
|
32
|
-
def test_validate_test_case_regression(
|
|
33
|
-
diagnostic: Diagnostic,
|
|
34
|
-
test_case_name: str,
|
|
35
|
-
provider_test_data_dir: Path,
|
|
36
|
-
config,
|
|
37
|
-
tmp_path: Path,
|
|
38
|
-
):
|
|
39
|
-
"""
|
|
40
|
-
Validate pre-stored test case regression outputs as CMEC bundles.
|
|
41
|
-
|
|
42
|
-
Each diagnostic/test_case is a separate parameterized test.
|
|
43
|
-
"""
|
|
44
|
-
diagnostic.provider.configure(config)
|
|
45
|
-
|
|
46
|
-
paths = TestCasePaths.from_test_data_dir(
|
|
47
|
-
provider_test_data_dir,
|
|
48
|
-
diagnostic.slug,
|
|
49
|
-
test_case_name,
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
validator = RegressionValidator(
|
|
53
|
-
diagnostic=diagnostic,
|
|
54
|
-
test_case_name=test_case_name,
|
|
55
|
-
test_data_dir=provider_test_data_dir,
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
if not paths.catalog.exists():
|
|
59
|
-
pytest.skip(f"No catalog file for {diagnostic.slug}/{test_case_name}")
|
|
60
|
-
if not validator.has_regression_data():
|
|
61
|
-
pytest.skip(f"No regression data for {diagnostic.slug}/{test_case_name}")
|
|
62
|
-
|
|
63
|
-
# TODO: remove this once we have migrated test cases to use the committed bundles.
|
|
64
|
-
if not any(paths.regression.glob("*.nc")):
|
|
65
|
-
pytest.skip(f"No committed NetCDF baseline for {diagnostic.slug}/{test_case_name}")
|
|
66
|
-
|
|
67
|
-
definition = validator.load_regression_definition(tmp_path / diagnostic.slug / test_case_name)
|
|
68
|
-
validator.validate(definition)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
@pytest.mark.slow
|
|
72
|
-
@pytest.mark.test_cases
|
|
73
|
-
@pytest.mark.parametrize("diagnostic,test_case_name", test_case_params)
|
|
74
|
-
def test_run_test_cases(
|
|
75
|
-
diagnostic: Diagnostic,
|
|
76
|
-
test_case_name: str,
|
|
77
|
-
provider_test_data_dir: Path,
|
|
78
|
-
config,
|
|
79
|
-
tmp_path: Path,
|
|
80
|
-
):
|
|
81
|
-
"""
|
|
82
|
-
Run diagnostic test cases end-to-end with ESGF data.
|
|
83
|
-
|
|
84
|
-
Requires: `ref test-cases fetch --provider example` to have been run first.
|
|
85
|
-
"""
|
|
86
|
-
diagnostic.provider.configure(config)
|
|
87
|
-
|
|
88
|
-
paths = TestCasePaths.from_test_data_dir(
|
|
89
|
-
provider_test_data_dir,
|
|
90
|
-
diagnostic.slug,
|
|
91
|
-
test_case_name,
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
if not paths.catalog.exists():
|
|
95
|
-
pytest.skip(f"No catalog file for {diagnostic.slug}/{test_case_name}")
|
|
96
|
-
|
|
97
|
-
datasets = load_datasets_from_yaml(paths.catalog)
|
|
98
|
-
|
|
99
|
-
runner = TestCaseRunner(config=config, datasets=datasets)
|
|
100
|
-
output_dir = tmp_path / diagnostic.slug / test_case_name
|
|
101
|
-
|
|
102
|
-
result = runner.run(diagnostic, test_case_name, output_dir)
|
|
103
|
-
|
|
104
|
-
assert result.successful, f"Diagnostic {diagnostic.slug} failed"
|
|
105
|
-
validate_result(diagnostic, config, result)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/src/climate_ref_example/__init__.py
RENAMED
|
File without changes
|
{climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/src/climate_ref_example/example.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{climate_ref_example-0.15.0 → climate_ref_example-0.16.1}/tests/unit/test_surface_temperature.py
RENAMED
|
File without changes
|