climate-ref-ilamb 0.5.5__tar.gz → 0.6.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.
Files changed (20) hide show
  1. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/PKG-INFO +4 -4
  2. climate_ref_ilamb-0.6.1/pyproject.toml +32 -0
  3. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/src/climate_ref_ilamb/configure/ilamb.yaml +16 -2
  4. climate_ref_ilamb-0.6.1/src/climate_ref_ilamb/configure/iomb.yaml +49 -0
  5. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/src/climate_ref_ilamb/dataset_registry/ilamb.txt +3 -1
  6. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/src/climate_ref_ilamb/dataset_registry/iomb.txt +1 -0
  7. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/src/climate_ref_ilamb/standard.py +22 -15
  8. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/tests/integration/test_diagnostics.py +1 -2
  9. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/tests/unit/test_standard_metrics.py +50 -1
  10. climate_ref_ilamb-0.5.5/pyproject.toml +0 -36
  11. climate_ref_ilamb-0.5.5/src/climate_ref_ilamb/configure/iomb.yaml +0 -27
  12. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/.gitignore +0 -0
  13. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/LICENCE +0 -0
  14. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/NOTICE +0 -0
  15. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/README.md +0 -0
  16. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/src/climate_ref_ilamb/__init__.py +0 -0
  17. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/src/climate_ref_ilamb/dataset_registry/test.txt +0 -0
  18. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/src/climate_ref_ilamb/datasets.py +0 -0
  19. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/src/climate_ref_ilamb/py.typed +0 -0
  20. {climate_ref_ilamb-0.5.5 → climate_ref_ilamb-0.6.1}/tests/unit/test_provider.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: climate-ref-ilamb
3
- Version: 0.5.5
3
+ Version: 0.6.1
4
4
  Summary: ILAMB diagnostic provider for the Rapid Evaluation Framework
5
- Author-email: Nathan Collier <nathaniel.collier@gmail.com>
6
- License: Apache-2.0
5
+ Author-email: Nathan Collier <nathaniel.collier@gmail.com>, Jared Lewis <jared.lewis@climate-resource.com>
6
+ License-Expression: Apache-2.0
7
7
  License-File: LICENCE
8
8
  License-File: NOTICE
9
9
  Classifier: Development Status :: 3 - Alpha
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.13
19
19
  Classifier: Topic :: Scientific/Engineering
20
20
  Requires-Python: >=3.11
21
21
  Requires-Dist: climate-ref-core
22
- Requires-Dist: ilamb3>=2025.4.28
22
+ Requires-Dist: ilamb3>=2025.5.20
23
23
  Description-Content-Type: text/markdown
24
24
 
25
25
  # climate-ref-ilamb
@@ -0,0 +1,32 @@
1
+ [project]
2
+ name = "climate-ref-ilamb"
3
+ version = "0.6.1"
4
+ description = "ILAMB diagnostic provider for the Rapid Evaluation Framework"
5
+ readme = "README.md"
6
+ authors = [
7
+ { name = "Nathan Collier", email = "nathaniel.collier@gmail.com" },
8
+ { name = "Jared Lewis", email = "jared.lewis@climate-resource.com" },
9
+ ]
10
+ requires-python = ">=3.11"
11
+ license = "Apache-2.0"
12
+ classifiers = [
13
+ "Development Status :: 3 - Alpha",
14
+ "Operating System :: OS Independent",
15
+ "Intended Audience :: Developers",
16
+ "Intended Audience :: Science/Research",
17
+ "Programming Language :: Python",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Topic :: Scientific/Engineering",
23
+ "License :: OSI Approved :: Apache Software License",
24
+ ]
25
+ dependencies = ["climate-ref-core", "ilamb3>=2025.5.20"]
26
+
27
+ [dependency-groups]
28
+ dev = ["types-pyyaml>=6.0.12"]
29
+
30
+ [build-system]
31
+ requires = ["hatchling"]
32
+ build-backend = "hatchling.build"
@@ -2,6 +2,7 @@ registry: ilamb
2
2
 
3
3
  gpp-WECANN:
4
4
  sources:
5
+ # TODO: Update to use the obs4REF equiv
5
6
  gpp: ilamb/gpp/WECANN/gpp.nc
6
7
  relationships:
7
8
  pr: ilamb/pr/GPCPv2.3/pr.nc
@@ -15,6 +16,7 @@ gpp-FLUXNET2015:
15
16
 
16
17
  mrro-LORA:
17
18
  sources:
19
+ # TODO: Update to use the obs4REF equiv
18
20
  mrro: ilamb/mrro/LORA/LORA.nc
19
21
  variable_cmap: Blues
20
22
 
@@ -23,14 +25,15 @@ mrsos-WangMao:
23
25
  mrsol: ilamb/mrsol/WangMao/mrsol_olc.nc
24
26
  alternate_vars:
25
27
  - mrsos
26
- depth: 0.0
27
28
  transform:
29
+ - select_depth:
30
+ value: 0
28
31
  - soil_moisture_to_vol_fraction
29
32
  variable_cmap: Blues
30
33
 
31
34
  cSoil-HWSD2:
32
35
  sources:
33
- cSoil: ilamb/cSoil/HWSD2/hwsd2_cSoil.nc
36
+ cSoil: ilamb/cSoil/HWSD2/cSoil_fx_HWSD2_19600101-20220101.nc
34
37
  variable_cmap: viridis
35
38
 
36
39
  lai-AVH15C1:
@@ -42,4 +45,15 @@ nbp-Hoffman:
42
45
  analyses:
43
46
  - nbp
44
47
  sources:
48
+ # TODO: Update to use the obs4REF equiv
45
49
  nbp: ilamb/nbp/HOFFMAN/nbp_1850-2010.nc
50
+
51
+ snc-ESACCI:
52
+ sources:
53
+ snc: ilamb/snc/Snow-cci/snc_mon_Snow-cci_BE_gn_198201-201906.nc
54
+
55
+ burntFractionAll-GFED:
56
+ sources:
57
+ burntArea: ilamb/burntFractionAll/GFED/burntArea.nc
58
+ alternate_vars:
59
+ - burntFractionAll
@@ -0,0 +1,49 @@
1
+ registry: iomb
2
+
3
+ thetao-WOA2023-surface:
4
+ sources:
5
+ # TODO: Update to use the obs4REF equiv
6
+ thetao: ilamb/WOA/thetao_mon_WOA_A5B4_gn_200501-201412.nc
7
+ variable_cmap: Reds
8
+ transform:
9
+ - select_depth:
10
+ value: 0
11
+ alternate_vars:
12
+ - tos
13
+
14
+ so-WOA2023-surface:
15
+ sources:
16
+ # TODO: Update to use the obs4REF equiv
17
+ so: ilamb/WOA/so_mon_WOA_A5B4_gn_200501-201412.nc
18
+ transform:
19
+ - select_depth:
20
+ value: 0
21
+ variable_cmap: YlGn
22
+ alternate_vars:
23
+ - sos
24
+
25
+ amoc-RAPID:
26
+ analyses:
27
+ - timeseries
28
+ related_vars:
29
+ - msftmz
30
+ transform:
31
+ - msftmz_to_rapid
32
+ sources:
33
+ # TODO: Update to use the obs4REF equiv
34
+ amoc: ilamb/RAPID/amoc_mon_RAPID_BE_NA_200404-202302.nc
35
+
36
+ ohc-NOAA:
37
+ sources:
38
+ ohc: ilamb/NOAA/ohc_yr_OHC_BE_gm_200506-202406.nc
39
+ related_vars:
40
+ - thetao
41
+ - volcello
42
+ transform:
43
+ - select_depth:
44
+ min: 0
45
+ max: 2000
46
+ - ocean_heat_content:
47
+ reference_year: 2005
48
+ analyses:
49
+ - accumulate
@@ -1,4 +1,4 @@
1
- ilamb/cSoil/HWSD2/hwsd2_cSoil.nc sha1:9a6377e4c5ff457c08c194d2c376c46e003a4f84
1
+ ilamb/cSoil/HWSD2/cSoil_fx_HWSD2_19600101-20220101.nc sha1:7138b0b53aa600878adf95e6aef65f4322a8e287
2
2
  ilamb/gpp/FLUXNET2015/gpp.nc sha1:16fd177e007caef2565687e2cd32884e20ef16e5
3
3
  ilamb/gpp/WECANN/gpp.nc sha1:6e864a6ae201195cdf995a3a81720188af441e13
4
4
  ilamb/lai/AVH15C1/lai.nc sha1:ccace4f84912d63acbb9ee09ee7b743412207a0d
@@ -9,3 +9,5 @@ ilamb/regions/Koppen_coarse.nc sha1:e464030db49f0295a6a22a81ca602b0f3c499b72
9
9
  ilamb/pr/GPCPv2.3/pr.nc sha1:e1b942863ec76a75aa972b6d75e2e08646741259
10
10
  ilamb/tas/CRU4.02/tas.nc sha1:2674da18a1a93483b50b1626e7a7ab741bf53d09
11
11
  ilamb/nbp/HOFFMAN/nbp_1850-2010.nc sha1:8350af00614d6afc6b70ad314aa499a9ece80ec2
12
+ ilamb/snc/Snow-cci/snc_mon_Snow-cci_BE_gn_198201-201906.nc sha1:c0bfecd2f8b886e9301428d28bb6ff0507601be2
13
+ ilamb/burntFractionAll/GFED/burntArea.nc sha1:cf9d73c6a8bfc594737c9ba6ca4df613df4a28ab
@@ -1,3 +1,4 @@
1
1
  ilamb/WOA/so_mon_WOA_A5B4_gn_200501-201412.nc sha1:831c42c3b2ba443c255150289a2c725d7f3e5838
2
2
  ilamb/WOA/thetao_mon_WOA_A5B4_gn_200501-201412.nc sha1:86d9056208291d76233e65b26c658c1fa54c3ea6
3
3
  ilamb/RAPID/amoc_mon_RAPID_BE_NA_200404-202302.nc sha1:3efe773e5c2a3c832977791ff7fd9cb9f473fe65
4
+ ilamb/NOAA/ohc_yr_OHC_BE_gm_200506-202406.nc sha1:a918799d8e24e4f0015b9047a74d470ae9f0445c
@@ -8,6 +8,7 @@ import pandas as pd
8
8
  import pooch
9
9
  from ilamb3 import run
10
10
 
11
+ from climate_ref_core.constraints import AddSupplementaryDataset
11
12
  from climate_ref_core.dataset_registry import dataset_registry_manager
12
13
  from climate_ref_core.datasets import FacetFilter, SourceDatasetType
13
14
  from climate_ref_core.diagnostics import (
@@ -104,14 +105,14 @@ def _build_cmec_bundle(df: pd.DataFrame) -> dict[str, Any]:
104
105
  # This assumes that the member_id and grid_label are always the last two parts of the source string
105
106
  # and don't contain '-'
106
107
  extracted_source = model_df.source.str.extract(r"([\w-]+)-([\w\d]+)-([\w\d]+)")
107
- model_df["source_id"] = extracted_source[0]
108
- model_df["member_id"] = extracted_source[1]
109
- model_df["grid_label"] = extracted_source[2]
108
+ model_df.loc[:, "source_id"] = extracted_source[0]
109
+ model_df.loc[:, "member_id"] = extracted_source[1]
110
+ model_df.loc[:, "grid_label"] = extracted_source[2]
110
111
 
111
112
  # Strip out units from the name
112
113
  # These are available in the attributes
113
114
  extracted_source = model_df.name.str.extract(r"(.*)\s\[.*\]")
114
- model_df["name"] = extracted_source[0]
115
+ model_df.loc[:, "name"] = extracted_source[0]
115
116
 
116
117
  model_df = model_df.rename(
117
118
  columns={
@@ -120,6 +121,10 @@ def _build_cmec_bundle(df: pd.DataFrame) -> dict[str, Any]:
120
121
  }
121
122
  )
122
123
 
124
+ # Convert the value column to numeric, coercing errors to NaN
125
+ model_df.loc[:, "value"] = pd.to_numeric(model_df["value"], errors="coerce")
126
+ model_df = model_df.astype({"value": "float64"})
127
+
123
128
  dimensions = ["experiment_id", "source_id", "member_id", "grid_label", "region", "metric", "statistic"]
124
129
  attributes = ["type", "units"]
125
130
 
@@ -165,15 +170,6 @@ def _set_ilamb3_options(registry: pooch.Pooch, registry_file: str) -> None:
165
170
  ilamb3.conf.set(regions=["global", "tropical"])
166
171
 
167
172
 
168
- def _measure_facets(registry_file: str) -> list[str]:
169
- """
170
- Set options for ILAMB based on which registry file is being used.
171
- """
172
- if registry_file == "ilamb":
173
- return ["areacella", "sftlf"]
174
- return []
175
-
176
-
177
173
  def _load_csv_and_merge(output_directory: Path) -> pd.DataFrame:
178
174
  """
179
175
  Load individual csv scalar data and merge into a dataframe.
@@ -219,12 +215,23 @@ class ILAMBStandard(Diagnostic):
219
215
  self.variable_id,
220
216
  *ilamb_kwargs.get("relationships", {}).keys(),
221
217
  *ilamb_kwargs.get("alternate_vars", []),
222
- *_measure_facets(registry_file),
218
+ *ilamb_kwargs.get("related_vars", []),
223
219
  )
224
220
  }
225
221
  ),
226
- FacetFilter(facets={"frequency": ("mon", "fx")}),
222
+ FacetFilter(facets={"frequency": ("mon",)}),
227
223
  FacetFilter(facets={"experiment_id": ("historical", "land-hist")}),
224
+ # Exclude unneeded snc tables
225
+ FacetFilter(facets={"table_id": ("ImonAnt", "ImonGre")}, keep=False),
226
+ ),
227
+ constraints=(
228
+ AddSupplementaryDataset.from_defaults("areacella", SourceDatasetType.CMIP6),
229
+ AddSupplementaryDataset.from_defaults("sftlf", SourceDatasetType.CMIP6),
230
+ )
231
+ if registry_file == "ilamb"
232
+ else (
233
+ AddSupplementaryDataset.from_defaults("areacello", SourceDatasetType.CMIP6),
234
+ AddSupplementaryDataset.from_defaults("sftof", SourceDatasetType.CMIP6),
228
235
  ),
229
236
  group_by=("experiment_id",),
230
237
  ),
@@ -4,8 +4,7 @@ from climate_ref_ilamb import provider as ilamb_provider
4
4
  from climate_ref_core.diagnostics import Diagnostic
5
5
 
6
6
  skipped_diagnostics = [
7
- "csoil-hwsd2", # Incorrect time spans
8
- "nbp-hoffman", # Incorrect time spans
7
+ "ohc-noaa", # Missing sample data
9
8
  ]
10
9
 
11
10
  diagnostics = [
@@ -1,9 +1,12 @@
1
1
  import ilamb3
2
+ import pandas as pd
2
3
  import pytest
3
4
  from climate_ref_ilamb.standard import ILAMBStandard, _set_ilamb3_options
5
+ from climate_ref_pmp import provider as ilamb_provider
4
6
 
7
+ from climate_ref.solver import solve_executions
5
8
  from climate_ref_core.dataset_registry import dataset_registry_manager
6
- from climate_ref_core.datasets import DatasetCollection
9
+ from climate_ref_core.datasets import DatasetCollection, SourceDatasetType
7
10
 
8
11
 
9
12
  def test_standard_site(cmip6_data_catalog, definition_factory):
@@ -94,3 +97,49 @@ def test_standard_fail():
94
97
  def test_options():
95
98
  _set_ilamb3_options(dataset_registry_manager["ilamb"], "ilamb")
96
99
  assert set(["global", "tropical"]).issubset(ilamb3.conf["regions"])
100
+
101
+
102
+ def test_expected_executions():
103
+ diagnostic = ILAMBStandard(
104
+ registry_file="ilamb",
105
+ metric_name="cSoil-HWSD2",
106
+ sources={"cSoil": "ilamb/cSoil/HWSD2/cSoil_fx_HWSD2_19600101-20220101.nc"},
107
+ )
108
+
109
+ # No Obs4MIPs datasets are used yet
110
+ data_catalog = {
111
+ SourceDatasetType.CMIP6: pd.DataFrame(
112
+ [
113
+ ["cSoil", "ACCESS-ESM1-5", "historical", "r1i1p1f1", "mon", "gn", "Amon", "v20191115"],
114
+ ["cSoil", "ACCESS-ESM1-5", "ssp119", "r1i1p1f1", "mon", "gn", "Amon", "v20191115"],
115
+ ["cSoil", "ACCESS-ESM1-5", "historical", "r2i1p1f1", "mon", "gn", "Amon", "v20191115"],
116
+ ["ts", "ACCESS-ESM1-5", "historical", "r1i1p1f1", "mon", "gn", "Amon", "v20191115"],
117
+ ["areacella", "ACCESS-ESM1-5", "fx", "r1i1p1f1", "mon", "gn", "Amon", "v20191115"],
118
+ ],
119
+ columns=(
120
+ "variable_id",
121
+ "source_id",
122
+ "experiment_id",
123
+ "member_id",
124
+ "frequency",
125
+ "grid_label",
126
+ "table_id",
127
+ "version",
128
+ ),
129
+ ),
130
+ }
131
+ executions = list(solve_executions(data_catalog, diagnostic, provider=ilamb_provider))
132
+ assert len(executions) == 1
133
+
134
+ # ts
135
+ assert executions[0].datasets[SourceDatasetType.CMIP6].selector == (("experiment_id", "historical"),)
136
+ assert executions[0].datasets[SourceDatasetType.CMIP6].datasets["variable_id"].tolist() == [
137
+ "cSoil",
138
+ "cSoil",
139
+ "areacella",
140
+ ]
141
+ assert executions[0].datasets[SourceDatasetType.CMIP6].datasets["member_id"].tolist() == [
142
+ "r1i1p1f1",
143
+ "r2i1p1f1",
144
+ "r1i1p1f1",
145
+ ]
@@ -1,36 +0,0 @@
1
- [project]
2
- name = "climate-ref-ilamb"
3
- version = "0.5.5"
4
- description = "ILAMB diagnostic provider for the Rapid Evaluation Framework"
5
- readme = "README.md"
6
- authors = [{ name = "Nathan Collier", email = "nathaniel.collier@gmail.com" }]
7
- requires-python = ">=3.11"
8
- classifiers = [
9
- "Development Status :: 3 - Alpha",
10
- "Operating System :: OS Independent",
11
- "Intended Audience :: Developers",
12
- "Intended Audience :: Science/Research",
13
- "Programming Language :: Python",
14
- "Programming Language :: Python :: 3",
15
- "Programming Language :: Python :: 3.11",
16
- "Programming Language :: Python :: 3.12",
17
- "Programming Language :: Python :: 3.13",
18
- "Topic :: Scientific/Engineering",
19
- "License :: OSI Approved :: Apache Software License",
20
- ]
21
- dependencies = [
22
- "climate-ref-core",
23
- "ilamb3>=2025.4.28",
24
- ]
25
-
26
- [project.license]
27
- text = "Apache-2.0"
28
-
29
- [dependency-groups]
30
- dev = [
31
- "types-pyyaml>=6.0.12",
32
- ]
33
-
34
- [build-system]
35
- requires = ["hatchling"]
36
- build-backend = "hatchling.build"
@@ -1,27 +0,0 @@
1
- registry: iomb
2
-
3
- thetao-WOA2023-surface:
4
- sources:
5
- thetao: ilamb/WOA/thetao_mon_WOA_A5B4_gn_200501-201412.nc
6
- variable_cmap: Reds
7
- depth: 0.0
8
- alternate_vars:
9
- - tos
10
-
11
- so-WOA2023-surface:
12
- sources:
13
- so: ilamb/WOA/so_mon_WOA_A5B4_gn_200501-201412.nc
14
- variable_cmap: YlGn
15
- depth: 0.0
16
- alternate_vars:
17
- - sos
18
-
19
- amoc-RAPID:
20
- analyses:
21
- - timeseries
22
- alternate_vars:
23
- - msftmz
24
- transform:
25
- - msftmz_to_rapid
26
- sources:
27
- amoc: ilamb/RAPID/amoc_mon_RAPID_BE_NA_200404-202302.nc