climate-ref-esmvaltool 0.5.0__tar.gz → 0.5.2__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 (44) hide show
  1. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/.gitignore +0 -1
  2. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/PKG-INFO +1 -1
  3. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/pyproject.toml +1 -1
  4. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/dataset_registry/data.txt +12 -0
  5. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/diagnostics/__init__.py +2 -0
  6. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/diagnostics/climate_at_global_warming_levels.py +1 -1
  7. climate_ref_esmvaltool-0.5.2/src/climate_ref_esmvaltool/diagnostics/cloud_radiative_effects.py +76 -0
  8. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/diagnostics/example.py +1 -1
  9. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/diagnostics/sea_ice_area_seasonal_cycle.py +1 -1
  10. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/recipe.py +2 -1
  11. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/recipes.txt +1 -0
  12. climate_ref_esmvaltool-0.5.2/tests/integration/test_diagnostics.py +12 -0
  13. climate_ref_esmvaltool-0.5.2/tests/unit/diagnostics/input_files_cloud_radiative_effects.json +218 -0
  14. climate_ref_esmvaltool-0.5.2/tests/unit/diagnostics/test_cloud_radiative_effects.py +27 -0
  15. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/test_metrics.py +4 -6
  16. climate_ref_esmvaltool-0.5.0/tests/integration/test_metrics.py +0 -34
  17. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/LICENCE +0 -0
  18. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/NOTICE +0 -0
  19. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/README.md +0 -0
  20. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/__init__.py +0 -0
  21. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/_version.py +0 -0
  22. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/diagnostics/base.py +0 -0
  23. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/diagnostics/ecs.py +0 -0
  24. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/diagnostics/tcr.py +0 -0
  25. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/diagnostics/tcre.py +0 -0
  26. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/diagnostics/zec.py +0 -0
  27. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/py.typed +0 -0
  28. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/requirements/conda-lock.yml +0 -0
  29. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/requirements/environment.yml +0 -0
  30. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/src/climate_ref_esmvaltool/types.py +0 -0
  31. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/diagnostics/input_files_climate_at_global_warming_levels.json +0 -0
  32. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/diagnostics/input_files_ecs.json +0 -0
  33. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/diagnostics/input_files_sea_ice_area.json +0 -0
  34. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/diagnostics/input_files_tcr.json +0 -0
  35. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/diagnostics/input_files_tcre.json +0 -0
  36. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/diagnostics/input_files_zec.json +0 -0
  37. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/diagnostics/test_base.py +0 -0
  38. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/diagnostics/test_climate_at_global_warming_levels.py +0 -0
  39. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/diagnostics/test_ecs.py +0 -0
  40. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/diagnostics/test_sea_ice_area.py +0 -0
  41. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/diagnostics/test_tcr.py +0 -0
  42. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/diagnostics/test_tcre.py +0 -0
  43. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/diagnostics/test_zec.py +0 -0
  44. {climate_ref_esmvaltool-0.5.0 → climate_ref_esmvaltool-0.5.2}/tests/unit/test_provider.py +0 -0
@@ -74,7 +74,6 @@ coverage.xml
74
74
  *.pot
75
75
 
76
76
  # Django stuff:
77
- *.log
78
77
  local_settings.py
79
78
  db.sqlite3
80
79
  db.sqlite3-journal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: climate-ref-esmvaltool
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: ESMValTool diagnostic provider for the Rapid Evaluation Framework
5
5
  Author-email: ESMValTool development team <esmvaltool-dev@listserv.dfn.de>
6
6
  License: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "climate-ref-esmvaltool"
3
- version = "0.5.0"
3
+ version = "0.5.2"
4
4
  description = "ESMValTool diagnostic provider for the Rapid Evaluation Framework"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -1,3 +1,15 @@
1
+ ESMValTool/OBS/Tier2/CERES-EBAF/OBS_CERES-EBAF_sat_Ed4.2_Amon_rlut_200003-202311.nc ede887cf2d83c848a0d71316799232e4d717662bd2f78d5aa1fc166b41d9953b
2
+ ESMValTool/OBS/Tier2/CERES-EBAF/OBS_CERES-EBAF_sat_Ed4.2_Amon_rlutcs_200003-202311.nc e70e3273092edf01527970693271641fc6474d1974887d7d272e7d656bab83c2
3
+ ESMValTool/OBS/Tier2/CERES-EBAF/OBS_CERES-EBAF_sat_Ed4.2_Amon_rsut_200003-202311.nc e31e648886c4fa9c09686672a06ab18fbba687ff0d6de2891616d4c8b74e215d
4
+ ESMValTool/OBS/Tier2/CERES-EBAF/OBS_CERES-EBAF_sat_Ed4.2_Amon_rsutcs_200003-202311.nc eb96edd9274670aa705eab2a6d1ee0cca11e01ac17096706463e032b58e6be47
5
+ ESMValTool/OBS/Tier2/ESACCI-CLOUD/OBS_ESACCI-CLOUD_sat_AVHRR-AMPM-fv3.0_Amon_rlut_198201-201612.nc 075144d673a9f2ff49fbe59e701535bf80c04908797a9dca83781000a9b1b7f2
6
+ ESMValTool/OBS/Tier2/ESACCI-CLOUD/OBS_ESACCI-CLOUD_sat_AVHRR-AMPM-fv3.0_Amon_rlutcs_198201-201612.nc 21f096ecafff659e5c7e3338060425f7194e5d1b39c9510865496e04ecac3d75
7
+ ESMValTool/OBS/Tier2/ESACCI-CLOUD/OBS_ESACCI-CLOUD_sat_AVHRR-AMPM-fv3.0_Amon_rsut_198201-201612.nc f2c3f3afcdc2e730df7985c210a3de89b0d4f83b150e0c3846f7ac3c5fa9c54a
8
+ ESMValTool/OBS/Tier2/ESACCI-CLOUD/OBS_ESACCI-CLOUD_sat_AVHRR-AMPM-fv3.0_Amon_rsutcs_198201-201612.nc d180d3140d4c1f6b9bb1960e07b45f192643f047e7c272c8c8c7070296ca3ab7
9
+ ESMValTool/OBS/Tier2/ISCCP-FH/OBS_ISCCP-FH_sat_v0_Amon_rlut_198401-201612.nc 650b347df432f6e5f3f693310aad695a7502f2905ac545753c7d4ccb0592adbe
10
+ ESMValTool/OBS/Tier2/ISCCP-FH/OBS_ISCCP-FH_sat_v0_Amon_rlutcs_198401-201612.nc a90d9e035447f8778a2f64362411c079536d9dea559f6d53d032710b2c9b00e3
11
+ ESMValTool/OBS/Tier2/ISCCP-FH/OBS_ISCCP-FH_sat_v0_Amon_rsut_198401-201612.nc 8afa3afd416500b17bceda5689c43d64277a4c32f99521f79a3603d0e3fe0570
12
+ ESMValTool/OBS/Tier2/ISCCP-FH/OBS_ISCCP-FH_sat_v0_Amon_rsutcs_198401-201612.nc 922aebf600f56a69c7b0b9d4b72eca0edb3dd495bd7a05209a07d4e50bd69b57
1
13
  ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_fx_areacello.nc aead9fc03e6773f66c3fa522ddd9cc36ff6a5b47cfab02d3cb9481b52cc2f7cb
2
14
  ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_197901-197912.nc b5fe29fd2864248580043af4bca27a4771cf216ef7db74d645590ba10809dbe8
3
15
  ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_198001-198012.nc ce988e813cae4c59bbb622420e7e339b9e435117486af8aa81afaa54e19d7d68
@@ -1,6 +1,7 @@
1
1
  """ESMValTool diagnostics."""
2
2
 
3
3
  from climate_ref_esmvaltool.diagnostics.climate_at_global_warming_levels import ClimateAtGlobalWarmingLevels
4
+ from climate_ref_esmvaltool.diagnostics.cloud_radiative_effects import CloudRadiativeEffects
4
5
  from climate_ref_esmvaltool.diagnostics.ecs import EquilibriumClimateSensitivity
5
6
  from climate_ref_esmvaltool.diagnostics.example import GlobalMeanTimeseries
6
7
  from climate_ref_esmvaltool.diagnostics.sea_ice_area_seasonal_cycle import SeaIceAreaSeasonalCycle
@@ -10,6 +11,7 @@ from climate_ref_esmvaltool.diagnostics.zec import ZeroEmissionCommitment
10
11
 
11
12
  __all__ = [
12
13
  "ClimateAtGlobalWarmingLevels",
14
+ "CloudRadiativeEffects",
13
15
  "EquilibriumClimateSensitivity",
14
16
  "GlobalMeanTimeseries",
15
17
  "SeaIceAreaSeasonalCycle",
@@ -62,7 +62,7 @@ class ClimateAtGlobalWarmingLevels(ESMValToolDiagnostic):
62
62
  ),
63
63
  ),
64
64
  )
65
- facets = ("model", "metric")
65
+ facets = ()
66
66
 
67
67
  @staticmethod
68
68
  def update_recipe(recipe: Recipe, input_files: pandas.DataFrame) -> None:
@@ -0,0 +1,76 @@
1
+ import pandas
2
+
3
+ from climate_ref_core.constraints import (
4
+ AddSupplementaryDataset,
5
+ RequireContiguousTimerange,
6
+ RequireFacets,
7
+ RequireOverlappingTimerange,
8
+ )
9
+ from climate_ref_core.datasets import FacetFilter, SourceDatasetType
10
+ from climate_ref_core.diagnostics import DataRequirement
11
+ from climate_ref_esmvaltool.diagnostics.base import ESMValToolDiagnostic
12
+ from climate_ref_esmvaltool.recipe import dataframe_to_recipe
13
+ from climate_ref_esmvaltool.types import Recipe
14
+
15
+
16
+ class CloudRadiativeEffects(ESMValToolDiagnostic):
17
+ """
18
+ Plot climatologies and zonal mean profiles of cloud radiative effects (sw + lw) for a dataset.
19
+ """
20
+
21
+ name = "Climatologies and zonal mean profiles of cloud radiative effects"
22
+ slug = "cloud-radiative-effects"
23
+ base_recipe = "ref/recipe_ref_cre.yml"
24
+
25
+ facets = ()
26
+
27
+ variables = (
28
+ "rlut",
29
+ "rlutcs",
30
+ "rsut",
31
+ "rsutcs",
32
+ )
33
+ data_requirements = (
34
+ DataRequirement(
35
+ source_type=SourceDatasetType.CMIP6,
36
+ filters=(
37
+ FacetFilter(
38
+ facets={
39
+ "variable_id": variables,
40
+ "experiment_id": ("historical",),
41
+ }
42
+ ),
43
+ ),
44
+ group_by=("source_id", "member_id", "grid_label"),
45
+ constraints=(
46
+ RequireFacets("variable_id", variables),
47
+ RequireContiguousTimerange(group_by=("instance_id",)),
48
+ RequireOverlappingTimerange(group_by=("instance_id",)),
49
+ AddSupplementaryDataset.from_defaults("areacella", SourceDatasetType.CMIP6),
50
+ ),
51
+ ),
52
+ # TODO: Use CERES-EBAF, ESACCI-CLOUD, and ISCCP-FH from obs4MIPs once available.
53
+ )
54
+
55
+ @staticmethod
56
+ def update_recipe(recipe: Recipe, input_files: pandas.DataFrame) -> None:
57
+ """Update the recipe."""
58
+ recipe_variables = dataframe_to_recipe(input_files)
59
+ recipe_variables = {k: v for k, v in recipe_variables.items() if k != "areacella"}
60
+
61
+ # Select a timerange covered by all datasets.
62
+ start_times, end_times = [], []
63
+ for variable in recipe_variables.values():
64
+ for dataset in variable["additional_datasets"]:
65
+ start, end = dataset["timerange"].split("/")
66
+ start_times.append(start)
67
+ end_times.append(end)
68
+ start_time = max(start_times)
69
+ start_time = max(start_time, "20010101T000000") # Earliest observational dataset availability
70
+ timerange = f"{start_time}/{min(end_times)}"
71
+
72
+ datasets = recipe_variables["rsut"]["additional_datasets"]
73
+ for dataset in datasets:
74
+ dataset.pop("timerange")
75
+ recipe["datasets"] = datasets
76
+ recipe["timerange_for_models"] = timerange
@@ -28,7 +28,7 @@ class GlobalMeanTimeseries(ESMValToolDiagnostic):
28
28
  ),
29
29
  ),
30
30
  )
31
- facets = ("model", "metric")
31
+ facets = ()
32
32
 
33
33
  @staticmethod
34
34
  def update_recipe(recipe: Recipe, input_files: pandas.DataFrame) -> None:
@@ -39,7 +39,7 @@ class SeaIceAreaSeasonalCycle(ESMValToolDiagnostic):
39
39
  ),
40
40
  # TODO: Use OSI-450-nh and OSI-450-sh from obs4MIPs once available.
41
41
  )
42
- facets = ("model", "metric")
42
+ facets = ()
43
43
 
44
44
  @staticmethod
45
45
  def update_recipe(recipe: Recipe, input_files: pandas.DataFrame) -> None:
@@ -126,7 +126,8 @@ _RECIPES = pooch.create(
126
126
  base_url=f"https://raw.githubusercontent.com/ESMValGroup/ESMValTool/{_ESMVALTOOL_COMMIT}/esmvaltool/recipes/",
127
127
  env="REF_METRICS_ESMVALTOOL_DATA_DIR",
128
128
  )
129
- _RECIPES.load_registry(str(importlib.resources.files("climate_ref_esmvaltool").joinpath("recipes.txt")))
129
+ with importlib.resources.files("climate_ref_esmvaltool").joinpath("recipes.txt").open("rb") as _buffer:
130
+ _RECIPES.load_registry(_buffer)
130
131
 
131
132
 
132
133
  def load_recipe(recipe: str) -> Recipe:
@@ -4,4 +4,5 @@ recipe_ecs.yml 0cc57034fcb64e32015b4ff949ece5df8cdb8c6f493618b50cede
4
4
  recipe_tcr.yml 35f9ef035a4e71aff5cac5dd26c49da2162fc00291bf3b0bd16b661b7b2f606b
5
5
  recipe_tcre.yml 4668e357e00c515a8264ac75cb319ce558289689e10189e6f9e982886c414c94
6
6
  recipe_zec.yml b0af7f789b7610ab3f29a6617124aa40c40866ead958204fc199eaf82863de51
7
+ ref/recipe_ref_cre.yml 4f35d9639f1008be3b5382a5bd8933a855cb5368ccf5d04a1c70227172e2e82c
7
8
  ref/recipe_ref_sea_ice_area_basic.yml 552e282a16ec355778b06f33897e1b8ba8388e5f8a5f814c4c42d91f63007457
@@ -0,0 +1,12 @@
1
+ import pytest
2
+ from climate_ref_esmvaltool import provider
3
+
4
+ from climate_ref_core.diagnostics import Diagnostic
5
+
6
+ diagnostics = [pytest.param(diagnostic, id=diagnostic.slug) for diagnostic in 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)
@@ -0,0 +1,218 @@
1
+ {
2
+ "start_time":{
3
+ "4":"1850-01-16T12:00:00.000",
4
+ "3":"1850-01-16T12:00:00.000",
5
+ "2":"1850-01-16T12:00:00.000",
6
+ "1":"1850-01-16T12:00:00.000"
7
+ },
8
+ "end_time":{
9
+ "4":"2014-12-16T12:00:00.000",
10
+ "3":"2014-12-16T12:00:00.000",
11
+ "2":"2014-12-16T12:00:00.000",
12
+ "1":"2014-12-16T12:00:00.000"
13
+ },
14
+ "path":{
15
+ "4":"\/work\/bd0854\/DATA\/ESMValTool2\/CMIP6_DKRZ\/CMIP\/CSIRO\/ACCESS-ESM1-5\/historical\/r1i1p1f1\/Amon\/rsut\/gn\/v20191115\/rsut_Amon_ACCESS-ESM1-5_historical_r1i1p1f1_gn_185001-201412.nc",
16
+ "3":"\/work\/bd0854\/DATA\/ESMValTool2\/CMIP6_DKRZ\/CMIP\/CSIRO\/ACCESS-ESM1-5\/historical\/r1i1p1f1\/Amon\/rsutcs\/gn\/v20191115\/rsutcs_Amon_ACCESS-ESM1-5_historical_r1i1p1f1_gn_185001-201412.nc",
17
+ "2":"\/work\/bd0854\/DATA\/ESMValTool2\/CMIP6_DKRZ\/CMIP\/CSIRO\/ACCESS-ESM1-5\/historical\/r1i1p1f1\/Amon\/rlutcs\/gn\/v20191115\/rlutcs_Amon_ACCESS-ESM1-5_historical_r1i1p1f1_gn_185001-201412.nc",
18
+ "1":"\/work\/bd0854\/DATA\/ESMValTool2\/CMIP6_DKRZ\/CMIP\/CSIRO\/ACCESS-ESM1-5\/historical\/r1i1p1f1\/Amon\/rlut\/gn\/v20191115\/rlut_Amon_ACCESS-ESM1-5_historical_r1i1p1f1_gn_185001-201412.nc"
19
+ },
20
+ "activity_id":{
21
+ "4":"CMIP",
22
+ "3":"CMIP",
23
+ "2":"CMIP",
24
+ "1":"CMIP"
25
+ },
26
+ "branch_method":{
27
+ "4":"standard",
28
+ "3":"standard",
29
+ "2":"standard",
30
+ "1":"standard"
31
+ },
32
+ "branch_time_in_child":{
33
+ "4":0.0,
34
+ "3":0.0,
35
+ "2":0.0,
36
+ "1":0.0
37
+ },
38
+ "branch_time_in_parent":{
39
+ "4":21915.0,
40
+ "3":21915.0,
41
+ "2":21915.0,
42
+ "1":21915.0
43
+ },
44
+ "experiment":{
45
+ "4":"all-forcing simulation of the recent past",
46
+ "3":"all-forcing simulation of the recent past",
47
+ "2":"all-forcing simulation of the recent past",
48
+ "1":"all-forcing simulation of the recent past"
49
+ },
50
+ "experiment_id":{
51
+ "4":"historical",
52
+ "3":"historical",
53
+ "2":"historical",
54
+ "1":"historical"
55
+ },
56
+ "frequency":{
57
+ "4":"mon",
58
+ "3":"mon",
59
+ "2":"mon",
60
+ "1":"mon"
61
+ },
62
+ "grid":{
63
+ "4":"native atmosphere N96 grid (145x192 latxlon)",
64
+ "3":"native atmosphere N96 grid (145x192 latxlon)",
65
+ "2":"native atmosphere N96 grid (145x192 latxlon)",
66
+ "1":"native atmosphere N96 grid (145x192 latxlon)"
67
+ },
68
+ "grid_label":{
69
+ "4":"gn",
70
+ "3":"gn",
71
+ "2":"gn",
72
+ "1":"gn"
73
+ },
74
+ "institution_id":{
75
+ "4":"CSIRO",
76
+ "3":"CSIRO",
77
+ "2":"CSIRO",
78
+ "1":"CSIRO"
79
+ },
80
+ "nominal_resolution":{
81
+ "4":"250 km",
82
+ "3":"250 km",
83
+ "2":"250 km",
84
+ "1":"250 km"
85
+ },
86
+ "parent_activity_id":{
87
+ "4":"CMIP",
88
+ "3":"CMIP",
89
+ "2":"CMIP",
90
+ "1":"CMIP"
91
+ },
92
+ "parent_experiment_id":{
93
+ "4":"piControl",
94
+ "3":"piControl",
95
+ "2":"piControl",
96
+ "1":"piControl"
97
+ },
98
+ "parent_source_id":{
99
+ "4":"ACCESS-ESM1-5",
100
+ "3":"ACCESS-ESM1-5",
101
+ "2":"ACCESS-ESM1-5",
102
+ "1":"ACCESS-ESM1-5"
103
+ },
104
+ "parent_time_units":{
105
+ "4":"days since 0101-1-1",
106
+ "3":"days since 0101-1-1",
107
+ "2":"days since 0101-1-1",
108
+ "1":"days since 0101-1-1"
109
+ },
110
+ "parent_variant_label":{
111
+ "4":"r1i1p1f1",
112
+ "3":"r1i1p1f1",
113
+ "2":"r1i1p1f1",
114
+ "1":"r1i1p1f1"
115
+ },
116
+ "product":{
117
+ "4":"model-output",
118
+ "3":"model-output",
119
+ "2":"model-output",
120
+ "1":"model-output"
121
+ },
122
+ "realm":{
123
+ "4":"atmos",
124
+ "3":"atmos",
125
+ "2":"atmos",
126
+ "1":"atmos"
127
+ },
128
+ "source_id":{
129
+ "4":"ACCESS-ESM1-5",
130
+ "3":"ACCESS-ESM1-5",
131
+ "2":"ACCESS-ESM1-5",
132
+ "1":"ACCESS-ESM1-5"
133
+ },
134
+ "source_type":{
135
+ "4":"AOGCM",
136
+ "3":"AOGCM",
137
+ "2":"AOGCM",
138
+ "1":"AOGCM"
139
+ },
140
+ "sub_experiment":{
141
+ "4":"none",
142
+ "3":"none",
143
+ "2":"none",
144
+ "1":"none"
145
+ },
146
+ "sub_experiment_id":{
147
+ "4":"none",
148
+ "3":"none",
149
+ "2":"none",
150
+ "1":"none"
151
+ },
152
+ "table_id":{
153
+ "4":"Amon",
154
+ "3":"Amon",
155
+ "2":"Amon",
156
+ "1":"Amon"
157
+ },
158
+ "variable_id":{
159
+ "4":"rsut",
160
+ "3":"rsutcs",
161
+ "2":"rlutcs",
162
+ "1":"rlut"
163
+ },
164
+ "variant_label":{
165
+ "4":"r1i1p1f1",
166
+ "3":"r1i1p1f1",
167
+ "2":"r1i1p1f1",
168
+ "1":"r1i1p1f1"
169
+ },
170
+ "member_id":{
171
+ "4":"r1i1p1f1",
172
+ "3":"r1i1p1f1",
173
+ "2":"r1i1p1f1",
174
+ "1":"r1i1p1f1"
175
+ },
176
+ "standard_name":{
177
+ "4":"toa_outgoing_shortwave_flux",
178
+ "3":"toa_outgoing_shortwave_flux_assuming_clear_sky",
179
+ "2":"toa_outgoing_longwave_flux_assuming_clear_sky",
180
+ "1":"toa_outgoing_longwave_flux"
181
+ },
182
+ "long_name":{
183
+ "4":"TOA Outgoing Shortwave Radiation",
184
+ "3":"TOA Outgoing Clear-Sky Shortwave Radiation",
185
+ "2":"TOA Outgoing Clear-Sky Longwave Radiation",
186
+ "1":"TOA Outgoing Longwave Radiation"
187
+ },
188
+ "units":{
189
+ "4":"W m-2",
190
+ "3":"W m-2",
191
+ "2":"W m-2",
192
+ "1":"W m-2"
193
+ },
194
+ "vertical_levels":{
195
+ "4":1,
196
+ "3":1,
197
+ "2":1,
198
+ "1":1
199
+ },
200
+ "init_year":{
201
+ "4":null,
202
+ "3":null,
203
+ "2":null,
204
+ "1":null
205
+ },
206
+ "version":{
207
+ "4":"v20191115",
208
+ "3":"v20191115",
209
+ "2":"v20191115",
210
+ "1":"v20191115"
211
+ },
212
+ "instance_id":{
213
+ "4":"CMIP6.CMIP.CSIRO.ACCESS-ESM1-5.historical.r1i1p1f1.Amon.rsut.gn.v20191115",
214
+ "3":"CMIP6.CMIP.CSIRO.ACCESS-ESM1-5.historical.r1i1p1f1.Amon.rsutcs.gn.v20191115",
215
+ "2":"CMIP6.CMIP.CSIRO.ACCESS-ESM1-5.historical.r1i1p1f1.Amon.rlutcs.gn.v20191115",
216
+ "1":"CMIP6.CMIP.CSIRO.ACCESS-ESM1-5.historical.r1i1p1f1.Amon.rlut.gn.v20191115"
217
+ }
218
+ }
@@ -0,0 +1,27 @@
1
+ from pathlib import Path
2
+
3
+ import pandas
4
+ from climate_ref_esmvaltool.diagnostics import CloudRadiativeEffects
5
+ from climate_ref_esmvaltool.recipe import load_recipe
6
+
7
+
8
+ def test_update_recipe():
9
+ # Insert the following code in CloudRadiativeEffects.update_recipe to
10
+ # save an example input dataframe:
11
+ # input_files.to_json(Path("input_files_cloud_radiative_effects.json"), indent=4, date_format="iso")
12
+ input_files = pandas.read_json(Path(__file__).parent / "input_files_cloud_radiative_effects.json")
13
+ recipe = load_recipe("ref/recipe_ref_cre.yml")
14
+ CloudRadiativeEffects().update_recipe(recipe, input_files)
15
+ assert recipe["datasets"] == [
16
+ {
17
+ "activity": "CMIP",
18
+ "dataset": "ACCESS-ESM1-5",
19
+ "ensemble": "r1i1p1f1",
20
+ "exp": "historical",
21
+ "grid": "gn",
22
+ "institute": "CSIRO",
23
+ "mip": "Amon",
24
+ "project": "CMIP6",
25
+ },
26
+ ]
27
+ assert recipe["timerange_for_models"] == "20010101T000000/20141216T120000"
@@ -20,12 +20,10 @@ def execution_dataset(cmip6_data_catalog) -> ExecutionDatasetCollection:
20
20
 
21
21
 
22
22
  def test_example_metric(mocker, tmp_path, execution_dataset, cmip6_data_catalog, definition_factory):
23
- provider = climate_ref_esmvaltool.provider
24
-
25
- metric = next(metric for metric in provider.diagnostics() if metric.slug == "global-mean-timeseries")
23
+ diagnostic = climate_ref_esmvaltool.provider.get("global-mean-timeseries")
26
24
  ds = cmip6_data_catalog.groupby("instance_id", as_index=False).first()
27
25
 
28
- definition = definition_factory(cmip6=DatasetCollection(ds, "instance_id"))
26
+ definition = definition_factory(diagnostic=diagnostic, cmip6=DatasetCollection(ds, "instance_id"))
29
27
  definition.output_directory.mkdir(parents=True)
30
28
 
31
29
  result_dir = definition.output_directory / "executions" / "recipe_test_a"
@@ -36,14 +34,14 @@ def test_example_metric(mocker, tmp_path, execution_dataset, cmip6_data_catalog,
36
34
  result.touch()
37
35
 
38
36
  mock_run = mocker.patch.object(
39
- provider,
37
+ climate_ref_esmvaltool.provider,
40
38
  "run",
41
39
  autospec=True,
42
40
  spec_set=True,
43
41
  side_effect=mock_run_fn,
44
42
  )
45
43
 
46
- result = metric.run(definition)
44
+ result = diagnostic.run(definition)
47
45
 
48
46
  mock_run.assert_called_with(
49
47
  [
@@ -1,34 +0,0 @@
1
- import pytest
2
- from climate_ref_esmvaltool import provider
3
-
4
- from climate_ref.models import Execution
5
- from climate_ref.solver import solve_executions
6
- from climate_ref.testing import validate_result
7
- from climate_ref_core.diagnostics import Diagnostic
8
-
9
- diagnostics = [pytest.param(metric, id=metric.slug) for metric in provider.diagnostics()]
10
-
11
-
12
- @pytest.mark.slow
13
- @pytest.mark.parametrize("diagnostic", diagnostics)
14
- def test_metrics(diagnostic: Diagnostic, data_catalog, tmp_path, config, mocker):
15
- mocker.patch.object(Execution, "execution_group")
16
- # Ensure the conda prefix is set
17
- provider.configure(config)
18
-
19
- # Get the first match from the data catalog
20
- execution = next(
21
- solve_executions(
22
- data_catalog=data_catalog,
23
- diagnostic=diagnostic,
24
- provider=provider,
25
- )
26
- )
27
-
28
- # Run the diagnostic
29
- definition = execution.build_execution_definition(output_root=config.paths.scratch)
30
- definition.output_directory.mkdir(parents=True, exist_ok=True)
31
- result = diagnostic.run(definition)
32
-
33
- # Check the result
34
- validate_result(diagnostic, config, result)