climate-ref-esmvaltool 0.5.0__py3-none-any.whl
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_esmvaltool/__init__.py +30 -0
- climate_ref_esmvaltool/_version.py +3 -0
- climate_ref_esmvaltool/dataset_registry/data.txt +74 -0
- climate_ref_esmvaltool/diagnostics/__init__.py +19 -0
- climate_ref_esmvaltool/diagnostics/base.py +212 -0
- climate_ref_esmvaltool/diagnostics/climate_at_global_warming_levels.py +100 -0
- climate_ref_esmvaltool/diagnostics/ecs.py +144 -0
- climate_ref_esmvaltool/diagnostics/example.py +50 -0
- climate_ref_esmvaltool/diagnostics/sea_ice_area_seasonal_cycle.py +78 -0
- climate_ref_esmvaltool/diagnostics/tcr.py +130 -0
- climate_ref_esmvaltool/diagnostics/tcre.py +136 -0
- climate_ref_esmvaltool/diagnostics/zec.py +109 -0
- climate_ref_esmvaltool/py.typed +0 -0
- climate_ref_esmvaltool/recipe.py +170 -0
- climate_ref_esmvaltool/recipes.txt +7 -0
- climate_ref_esmvaltool/requirements/conda-lock.yml +20028 -0
- climate_ref_esmvaltool/requirements/environment.yml +6 -0
- climate_ref_esmvaltool/types.py +6 -0
- climate_ref_esmvaltool-0.5.0.dist-info/METADATA +59 -0
- climate_ref_esmvaltool-0.5.0.dist-info/RECORD +23 -0
- climate_ref_esmvaltool-0.5.0.dist-info/WHEEL +4 -0
- climate_ref_esmvaltool-0.5.0.dist-info/licenses/LICENCE +201 -0
- climate_ref_esmvaltool-0.5.0.dist-info/licenses/NOTICE +3 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Rapid evaluating CMIP data with ESMValTool.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import climate_ref_esmvaltool.diagnostics
|
|
6
|
+
from climate_ref_core.dataset_registry import dataset_registry_manager
|
|
7
|
+
from climate_ref_core.providers import CondaDiagnosticProvider
|
|
8
|
+
from climate_ref_esmvaltool._version import __version__
|
|
9
|
+
from climate_ref_esmvaltool.recipe import _ESMVALTOOL_COMMIT
|
|
10
|
+
|
|
11
|
+
# Initialise the diagnostics manager.
|
|
12
|
+
provider = CondaDiagnosticProvider(
|
|
13
|
+
"ESMValTool",
|
|
14
|
+
__version__,
|
|
15
|
+
repo="https://github.com/ESMValGroup/ESMValTool.git",
|
|
16
|
+
tag_or_commit=_ESMVALTOOL_COMMIT,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
# Register the diagnostics.
|
|
20
|
+
for _diagnostic_cls_name in climate_ref_esmvaltool.diagnostics.__all__:
|
|
21
|
+
_diagnostic_cls = getattr(climate_ref_esmvaltool.diagnostics, _diagnostic_cls_name)
|
|
22
|
+
provider.register(_diagnostic_cls())
|
|
23
|
+
|
|
24
|
+
# Register OBS, OBS6, and raw data
|
|
25
|
+
dataset_registry_manager.register(
|
|
26
|
+
"esmvaltool",
|
|
27
|
+
"https://pub-b093171261094c4ea9adffa01f94ee06.r2.dev/",
|
|
28
|
+
package="climate_ref_esmvaltool.dataset_registry",
|
|
29
|
+
resource="data.txt",
|
|
30
|
+
)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_fx_areacello.nc aead9fc03e6773f66c3fa522ddd9cc36ff6a5b47cfab02d3cb9481b52cc2f7cb
|
|
2
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_197901-197912.nc b5fe29fd2864248580043af4bca27a4771cf216ef7db74d645590ba10809dbe8
|
|
3
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_198001-198012.nc ce988e813cae4c59bbb622420e7e339b9e435117486af8aa81afaa54e19d7d68
|
|
4
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_198101-198112.nc 5713ea69e8ce6d436d3acb30cc6207638d868d0f7a24b2821788418481ec9660
|
|
5
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_198201-198212.nc 980685a890b9a02cc9c190a7fd7650a7c20b37e3fb5347803db8d9aa725bda9d
|
|
6
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_198301-198312.nc 4ebff517978213235000299c3492739870373fe5e3ddc8db68d6826c20526bef
|
|
7
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_198401-198412.nc fd302b6349d13895a5f918dd116b7efbc7af41705c0a1d3fc62092fac78b7463
|
|
8
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_198501-198512.nc 4d6fabf1247e92d316029657b10b993618ee08afe0f7f7f026793d92ca2b3019
|
|
9
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_198601-198612.nc cdcda5ef9ee1a804a7c23ffcace5a15674f630a9541a08927b49ebc279adf67f
|
|
10
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_198701-198712.nc 1f14e6251be16c6130be52f67f309d19225a2186cec3ebb196a2a4d316e627ad
|
|
11
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_198801-198812.nc 7828fb3696bcea2b2f8ef0f8823f69545747f2db6d8f7b2e6b06e32c1b9faed6
|
|
12
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_198901-198912.nc 852752aee0649cd23ca76d2f6f418f8ce510ae0806865da5d4ff3b347ee56f70
|
|
13
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_199001-199012.nc 0567a0824ae24eeeef91291e98e2972913bfe6960998f8ca474378c28ff53722
|
|
14
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_199101-199112.nc 1263e0fc884524cc91266d0269619a44978b814bc0e113d05dd18a4b8ecf30e5
|
|
15
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_199201-199212.nc f64216239a8f652b0d96556dec4b1146dad304c88a45e5cfb38917661c9cbfde
|
|
16
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_199301-199312.nc 413031394e005221899e86143d016fe0f8f074f27d9d8324058aa9261853d8e7
|
|
17
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_199401-199412.nc 18aaa5c6ddee4aa3944ed3fdea44cff27fb455ebe4592edd46550742a7e90bbf
|
|
18
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_199501-199512.nc dd06c51ab71746c5ae9abe763816aaf3ef240ada749a8bfbc89afaa942e7d995
|
|
19
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_199601-199612.nc 4227b2c134e3db5110454223e621988b71c8ef689089d1e9819c0e411f179caa
|
|
20
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_199701-199712.nc 0dc78fc679f2abedf6ec61f4c19f4a4478dbb1fbbf2654eb066cb387d9ab6a00
|
|
21
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_199801-199812.nc 98b78eea8ce6c8ab812bfd873158513b840398393066beb835b4aa98609ff2f2
|
|
22
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_199901-199912.nc ad325f8091028a39e4bd0da7e11103e94f6ecc14a75a41515900e5aae037d651
|
|
23
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_200001-200012.nc 0dd3d1017797f6ac19cac32c062248321a22ee5931f79c683d9d1d8b2b77068a
|
|
24
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_200101-200112.nc c5e3b1621df7ed91e67a41858b37441877d01503dec9a4211755c30f6aab124e
|
|
25
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_200201-200212.nc e5d1627f1595a0eb8bf7f51db89023884e9e9b25e3fd168ae579e8d0d86e08fa
|
|
26
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_200301-200312.nc e2770f79ab5f6e2f3d652c0b54734e95105be1914a2de84d442b4c3faa2adda5
|
|
27
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_200401-200412.nc 503daf56c1568923a2c6e0353588a94e26d4caa10c6dc73e1393fb7ce2e70d5b
|
|
28
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_200501-200512.nc 735b2a4fb028fc5f99add5a663113293045c808a0cb3e82c0536c92540fb6ebc
|
|
29
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_200601-200612.nc 34a6547a9740347861928c788c9e866b295ea424dc5167d8e32ca74e0294d3c9
|
|
30
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_200701-200712.nc c96b4cc0c03162fac8f6d7aafc65c859991e2df5cae9c37209d1557ce4795b2b
|
|
31
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_200801-200812.nc a99830c5a656d65e814f547698d12aa5be298dac8ac7bd52b6343cfdd6c2decd
|
|
32
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_200901-200912.nc 16a6ddaaddbe733991428e3a5778ca52340d27ea3383c58a7e4e76d41c472e36
|
|
33
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_201001-201012.nc 55b1b664fea63e83b30cab3cde0eec8ad457054b8deeac9d31e27cc7cf415d65
|
|
34
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_201101-201112.nc 3ccd8d7f1bf76b09f49478e08e0996348f218bbd705dd031eb06c1beb6b21f64
|
|
35
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_201201-201212.nc e82707692e34817c09d743b5776f4fdf59c6e9e1601fb3496878ba251e4d6c06
|
|
36
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_201301-201312.nc 46db3a4001df110fa71f3c33371d0613e61bb38f1f86de8343bbfbbca880f49b
|
|
37
|
+
ESMValTool/OBS/Tier2/OSI-450-nh/OBS_OSI-450-nh_reanaly_v3_OImon_sic_201401-201412.nc fefe2db37a628e277512a9f6c20b0ac210d20a964c38ca13d6d5e59cec225ef8
|
|
38
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_fx_areacello.nc 28f6cb9f8f4e795e2d3008a84df9fe2d5587050e87efcff2dd730189ac8454d3
|
|
39
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_197901-197912.nc 3eadfb27fa0176abd0f8c890577870f106a328935a4df07fa31ada457c9d1590
|
|
40
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_198001-198012.nc 341c94dc9f16dd45b76c7bcfb877a8161a83ee519beb92a5abffbdd2c2d0bcef
|
|
41
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_198101-198112.nc fedd045a62c5f09010620fe81e607e0f637a9be97a1e0fe1aff5f3210da4ebfb
|
|
42
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_198201-198212.nc f0ab6ecbfa15180d482ebd33b4e6567d0fbd82184e738a5505b9ba5d00ff797a
|
|
43
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_198301-198312.nc a9c88f88b8165020641492677748b5c887870b180ee65ddc339ce4ff7eda3aa5
|
|
44
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_198401-198412.nc cda7b9469e05b2c13faf14a48f7da4a8026535da921278bb73b1c95fdbdb5817
|
|
45
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_198501-198512.nc d0b5db2b82b31b530487f2bf6c14f67d15171e009f01cc64a7b36703bd662e5d
|
|
46
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_198601-198612.nc 9c71beb4c7cb6fa563649ac14f4d8da6469a7e39382f6dd66b9b0200c54d73eb
|
|
47
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_198701-198712.nc e1f48dc90e30513b4c72bb210f888af6ff358f771f955c0ff6f45377c3430b22
|
|
48
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_198801-198812.nc f7bfeb4b518a800cbf244f9a8422535ffdfb3e92fa3d268a38f88cdb471de2ba
|
|
49
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_198901-198912.nc 4086c5cc0b44f25f88892b0ef5096b7175dd9cf7972fea9d5ea2fe674f9572d9
|
|
50
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_199001-199012.nc be0a4c07d9b01f86913807cf9dfcf73383021df37bbd8ef71a03a09bb8cd5176
|
|
51
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_199101-199112.nc 2480581a86eb74771279184334011bbcc750084efbbf72efaecd7c6ec3d8495c
|
|
52
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_199201-199212.nc d2bbf1350b2f4564fe60664d52be38c43902222b2e54078c64365e1ab284c410
|
|
53
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_199301-199312.nc c94f72e4a9b806479586739505c5e338f256b799ba95d4dd0e24b7c34d5eaba3
|
|
54
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_199401-199412.nc 1f7f58413a1103b1aab2b0909781b589a6c8b9bcc57441122c16cf77b3947a45
|
|
55
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_199501-199512.nc c68b8ec4ab6fb1996a08d942a8b4d9cebdcd4153258c0b0db718711aeb0e7565
|
|
56
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_199601-199612.nc 7010dfecd0cde62826fd44daa5080b725569da384ad0e37b672ed03df3bb647a
|
|
57
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_199701-199712.nc d749a4bf8a11eeb1ecb264d65a687cfada20df3676af0840d373f9f6ecaf5db1
|
|
58
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_199801-199812.nc 6fa86c6fdc5ff0a2057604cfe95f80ad0a8f2ef71f5d054785d4bde2bbbda6c5
|
|
59
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_199901-199912.nc 2a0a7d60510e9daeeea1ffb557109416888239abe244ae8687e31650d47a05cd
|
|
60
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_200001-200012.nc 147ec37e56c571397afc9833f1b8b23987cedf8108566ad24c30a09a7009a9a5
|
|
61
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_200101-200112.nc f0be737c861796072c68046b2e96cefda14473ee46c71ab714ec3d7642dbcef7
|
|
62
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_200201-200212.nc 26e2c2d9e78fb3482b99d3e338bf1fdc4f27ec7fb4eb64c054123646ceb22bfb
|
|
63
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_200301-200312.nc e8ff93274ad87bbe5491aca37112800b7016003b13cdd316cd7920f98e54534c
|
|
64
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_200401-200412.nc 716e089dba6bd34e2d2f661b4d2b65a57722b845260aec0ad3a0d3f2786cceaf
|
|
65
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_200501-200512.nc f73498ffcea9cb59dae2bd88e23c9bcde70d7c090e00102ab980f743701c154e
|
|
66
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_200601-200612.nc 648b6ed330a12cb9809b87ba2e2ebf24d8806ed8ae7664bae10e4146d0af1302
|
|
67
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_200701-200712.nc 4394f0a46644a35249ac274c77c092847fcb0b9c860d7a6ca480f9fc26aaaa1c
|
|
68
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_200801-200812.nc 8b22d86c712283c2bf7d978453f8f56d924bf82c4f6ff7834763066b081e4f5e
|
|
69
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_200901-200912.nc fe555a4ec603c95425cd257cc426f6f349ed5d33b3760d665c102798aa3144f1
|
|
70
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_201001-201012.nc 4d8b3dfdb8c0d98fd21858356eedee6ac912eb66c295d81fffcb5eb206f2c06b
|
|
71
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_201101-201112.nc 1d63f2855bdc30d86fbda942c65e104ad70069c78a433d0bccd45170e77789f8
|
|
72
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_201201-201212.nc 86187c3d1174053f2cba6dad010af49ceab77d368aa9314bf53c330b5f2217b9
|
|
73
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_201301-201312.nc 8820353570884b2ef182caaffb5986ed6268bbe199fd867f61b56e798ca01f1a
|
|
74
|
+
ESMValTool/OBS/Tier2/OSI-450-sh/OBS_OSI-450-sh_reanaly_v3_OImon_sic_201401-201412.nc 7102d0db3dc02c5b0eb0cfe3535ee50171007ef5b43eb9aae1220ac21b0b98e9
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""ESMValTool diagnostics."""
|
|
2
|
+
|
|
3
|
+
from climate_ref_esmvaltool.diagnostics.climate_at_global_warming_levels import ClimateAtGlobalWarmingLevels
|
|
4
|
+
from climate_ref_esmvaltool.diagnostics.ecs import EquilibriumClimateSensitivity
|
|
5
|
+
from climate_ref_esmvaltool.diagnostics.example import GlobalMeanTimeseries
|
|
6
|
+
from climate_ref_esmvaltool.diagnostics.sea_ice_area_seasonal_cycle import SeaIceAreaSeasonalCycle
|
|
7
|
+
from climate_ref_esmvaltool.diagnostics.tcr import TransientClimateResponse
|
|
8
|
+
from climate_ref_esmvaltool.diagnostics.tcre import TransientClimateResponseEmissions
|
|
9
|
+
from climate_ref_esmvaltool.diagnostics.zec import ZeroEmissionCommitment
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"ClimateAtGlobalWarmingLevels",
|
|
13
|
+
"EquilibriumClimateSensitivity",
|
|
14
|
+
"GlobalMeanTimeseries",
|
|
15
|
+
"SeaIceAreaSeasonalCycle",
|
|
16
|
+
"TransientClimateResponse",
|
|
17
|
+
"TransientClimateResponseEmissions",
|
|
18
|
+
"ZeroEmissionCommitment",
|
|
19
|
+
]
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
from abc import abstractmethod
|
|
2
|
+
from collections.abc import Iterable
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import ClassVar
|
|
5
|
+
|
|
6
|
+
import pandas
|
|
7
|
+
from loguru import logger
|
|
8
|
+
from ruamel.yaml import YAML
|
|
9
|
+
|
|
10
|
+
from climate_ref_core.dataset_registry import dataset_registry_manager
|
|
11
|
+
from climate_ref_core.datasets import ExecutionDatasetCollection, SourceDatasetType
|
|
12
|
+
from climate_ref_core.diagnostics import (
|
|
13
|
+
CommandLineDiagnostic,
|
|
14
|
+
ExecutionDefinition,
|
|
15
|
+
ExecutionResult,
|
|
16
|
+
)
|
|
17
|
+
from climate_ref_core.pycmec.metric import CMECMetric
|
|
18
|
+
from climate_ref_core.pycmec.output import CMECOutput, OutputCV
|
|
19
|
+
from climate_ref_esmvaltool.recipe import load_recipe, prepare_climate_data
|
|
20
|
+
from climate_ref_esmvaltool.types import MetricBundleArgs, OutputBundleArgs, Recipe
|
|
21
|
+
|
|
22
|
+
yaml = YAML()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ESMValToolDiagnostic(CommandLineDiagnostic):
|
|
26
|
+
"""ESMValTool Diagnostic base class."""
|
|
27
|
+
|
|
28
|
+
base_recipe: ClassVar[str]
|
|
29
|
+
|
|
30
|
+
@staticmethod
|
|
31
|
+
@abstractmethod
|
|
32
|
+
def update_recipe(recipe: Recipe, input_files: pandas.DataFrame) -> None:
|
|
33
|
+
"""
|
|
34
|
+
Update the base recipe for the run.
|
|
35
|
+
|
|
36
|
+
Parameters
|
|
37
|
+
----------
|
|
38
|
+
recipe:
|
|
39
|
+
The base recipe to update.
|
|
40
|
+
input_files:
|
|
41
|
+
The dataframe describing the input files.
|
|
42
|
+
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
@staticmethod
|
|
46
|
+
def format_result(
|
|
47
|
+
result_dir: Path,
|
|
48
|
+
execution_dataset: ExecutionDatasetCollection,
|
|
49
|
+
metric_args: MetricBundleArgs,
|
|
50
|
+
output_args: OutputBundleArgs,
|
|
51
|
+
) -> tuple[MetricBundleArgs, OutputBundleArgs]:
|
|
52
|
+
"""
|
|
53
|
+
Update the arguments needed to create a CMEC diagnostic and output bundle.
|
|
54
|
+
|
|
55
|
+
Parameters
|
|
56
|
+
----------
|
|
57
|
+
result_dir
|
|
58
|
+
Directory containing executions from an ESMValTool run.
|
|
59
|
+
execution_dataset
|
|
60
|
+
The diagnostic dataset used for the diagnostic execution.
|
|
61
|
+
metric_args
|
|
62
|
+
Generic diagnostic bundle arguments.
|
|
63
|
+
output_args
|
|
64
|
+
Generic output bundle arguments.
|
|
65
|
+
|
|
66
|
+
Returns
|
|
67
|
+
-------
|
|
68
|
+
The arguments needed to create a CMEC diagnostic and output bundle.
|
|
69
|
+
"""
|
|
70
|
+
return metric_args, output_args
|
|
71
|
+
|
|
72
|
+
def build_cmd(self, definition: ExecutionDefinition) -> Iterable[str]:
|
|
73
|
+
"""
|
|
74
|
+
Build the command to run an ESMValTool recipe.
|
|
75
|
+
|
|
76
|
+
Parameters
|
|
77
|
+
----------
|
|
78
|
+
definition
|
|
79
|
+
A description of the information needed for this execution of the diagnostic
|
|
80
|
+
|
|
81
|
+
Returns
|
|
82
|
+
-------
|
|
83
|
+
:
|
|
84
|
+
The result of running the diagnostic.
|
|
85
|
+
"""
|
|
86
|
+
input_files = definition.datasets[SourceDatasetType.CMIP6].datasets
|
|
87
|
+
recipe = load_recipe(self.base_recipe)
|
|
88
|
+
self.update_recipe(recipe, input_files)
|
|
89
|
+
|
|
90
|
+
recipe_path = definition.to_output_path("recipe.yml")
|
|
91
|
+
with recipe_path.open("w", encoding="utf-8") as file:
|
|
92
|
+
yaml.dump(recipe, file)
|
|
93
|
+
|
|
94
|
+
climate_data = definition.to_output_path("climate_data")
|
|
95
|
+
|
|
96
|
+
prepare_climate_data(
|
|
97
|
+
definition.datasets[SourceDatasetType.CMIP6].datasets,
|
|
98
|
+
climate_data_dir=climate_data,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
config = {
|
|
102
|
+
"drs": {
|
|
103
|
+
"CMIP6": "ESGF",
|
|
104
|
+
},
|
|
105
|
+
"output_dir": str(definition.to_output_path("executions")),
|
|
106
|
+
"rootpath": {
|
|
107
|
+
"default": str(climate_data),
|
|
108
|
+
},
|
|
109
|
+
"search_esgf": "never",
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
# Configure the paths to OBS/OBS6/native6 data
|
|
113
|
+
registry = dataset_registry_manager["esmvaltool"]
|
|
114
|
+
data_dir = registry.abspath / "ESMValTool" # type: ignore[attr-defined]
|
|
115
|
+
if not data_dir.exists():
|
|
116
|
+
logger.warning(
|
|
117
|
+
"ESMValTool observational and reanalysis data is not available "
|
|
118
|
+
f"in {data_dir}, you may want to run the command "
|
|
119
|
+
"`ref datasets fetch-data --registry esmvaltool`."
|
|
120
|
+
)
|
|
121
|
+
else:
|
|
122
|
+
config["drs"].update( # type: ignore[attr-defined]
|
|
123
|
+
{
|
|
124
|
+
"OBS": "default",
|
|
125
|
+
"OBS6": "default",
|
|
126
|
+
"native6": "default",
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
config["rootpath"].update( # type: ignore[attr-defined]
|
|
130
|
+
{
|
|
131
|
+
"OBS": str(data_dir / "OBS"),
|
|
132
|
+
"OBS6": str(data_dir / "OBS6"),
|
|
133
|
+
"native6": str(data_dir / "RAWOBS"),
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
config_dir = definition.to_output_path("config")
|
|
138
|
+
config_dir.mkdir()
|
|
139
|
+
with (config_dir / "config.yml").open("w", encoding="utf-8") as file:
|
|
140
|
+
yaml.dump(config, file)
|
|
141
|
+
|
|
142
|
+
return [
|
|
143
|
+
"esmvaltool",
|
|
144
|
+
"run",
|
|
145
|
+
f"--config-dir={config_dir}",
|
|
146
|
+
f"{recipe_path}",
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
def build_execution_result(
|
|
150
|
+
self,
|
|
151
|
+
definition: ExecutionDefinition,
|
|
152
|
+
) -> ExecutionResult:
|
|
153
|
+
"""
|
|
154
|
+
Build the diagnostic result after running an ESMValTool recipe.
|
|
155
|
+
|
|
156
|
+
Parameters
|
|
157
|
+
----------
|
|
158
|
+
definition
|
|
159
|
+
A description of the information needed for this execution of the diagnostic
|
|
160
|
+
|
|
161
|
+
Returns
|
|
162
|
+
-------
|
|
163
|
+
:
|
|
164
|
+
The resulting diagnostic.
|
|
165
|
+
"""
|
|
166
|
+
result_dir = next(definition.to_output_path("executions").glob("*"))
|
|
167
|
+
|
|
168
|
+
metric_args = CMECMetric.create_template()
|
|
169
|
+
output_args = CMECOutput.create_template()
|
|
170
|
+
|
|
171
|
+
# Add the plots and data files
|
|
172
|
+
plot_suffixes = {".png", ".jpg", ".pdf", ".ps"}
|
|
173
|
+
for metadata_file in result_dir.glob("run/*/*/diagnostic_provenance.yml"):
|
|
174
|
+
metadata = yaml.load(metadata_file.read_text(encoding="utf-8"))
|
|
175
|
+
for filename in metadata:
|
|
176
|
+
caption = metadata[filename].get("caption", "")
|
|
177
|
+
relative_path = definition.as_relative_path(filename)
|
|
178
|
+
if relative_path.suffix in plot_suffixes:
|
|
179
|
+
key = OutputCV.PLOTS.value
|
|
180
|
+
else:
|
|
181
|
+
key = OutputCV.DATA.value
|
|
182
|
+
output_args[key][f"{relative_path}"] = {
|
|
183
|
+
OutputCV.FILENAME.value: f"{relative_path}",
|
|
184
|
+
OutputCV.LONG_NAME.value: caption,
|
|
185
|
+
OutputCV.DESCRIPTION.value: "",
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
# Add the index.html file
|
|
189
|
+
index_html = f"{result_dir}/index.html"
|
|
190
|
+
output_args[OutputCV.HTML.value][index_html] = {
|
|
191
|
+
OutputCV.FILENAME.value: index_html,
|
|
192
|
+
OutputCV.LONG_NAME.value: "Results page",
|
|
193
|
+
OutputCV.DESCRIPTION.value: "Page showing the executions of the ESMValTool run.",
|
|
194
|
+
}
|
|
195
|
+
output_args[OutputCV.INDEX.value] = index_html
|
|
196
|
+
|
|
197
|
+
# Add the (debug) log file
|
|
198
|
+
output_args[OutputCV.PROVENANCE.value][OutputCV.LOG.value] = f"{result_dir}/run/main_log_debug.txt"
|
|
199
|
+
|
|
200
|
+
# Update the diagnostic and output bundle with diagnostic specific executions.
|
|
201
|
+
metric_args, output_args = self.format_result(
|
|
202
|
+
result_dir=result_dir,
|
|
203
|
+
execution_dataset=definition.datasets,
|
|
204
|
+
metric_args=metric_args,
|
|
205
|
+
output_args=output_args,
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
return ExecutionResult.build_from_output_bundle(
|
|
209
|
+
definition,
|
|
210
|
+
cmec_output_bundle=output_args,
|
|
211
|
+
cmec_metric_bundle=metric_args,
|
|
212
|
+
)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import pandas
|
|
2
|
+
|
|
3
|
+
from climate_ref_core.constraints import (
|
|
4
|
+
AddSupplementaryDataset,
|
|
5
|
+
RequireContiguousTimerange,
|
|
6
|
+
RequireFacets,
|
|
7
|
+
)
|
|
8
|
+
from climate_ref_core.datasets import FacetFilter, SourceDatasetType
|
|
9
|
+
from climate_ref_core.diagnostics import DataRequirement
|
|
10
|
+
from climate_ref_esmvaltool.diagnostics.base import ESMValToolDiagnostic
|
|
11
|
+
from climate_ref_esmvaltool.recipe import dataframe_to_recipe
|
|
12
|
+
from climate_ref_esmvaltool.types import Recipe
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ClimateAtGlobalWarmingLevels(ESMValToolDiagnostic):
|
|
16
|
+
"""
|
|
17
|
+
Calculate climate variables at global warming levels.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
name = "Climate variables at global warming levels"
|
|
21
|
+
slug = "climate-at-global-warming-levels"
|
|
22
|
+
base_recipe = "recipe_calculate_gwl_exceedance_stats.yml"
|
|
23
|
+
|
|
24
|
+
variables = (
|
|
25
|
+
"pr",
|
|
26
|
+
"tas",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
data_requirements = (
|
|
30
|
+
DataRequirement(
|
|
31
|
+
source_type=SourceDatasetType.CMIP6,
|
|
32
|
+
filters=(
|
|
33
|
+
FacetFilter(
|
|
34
|
+
facets={
|
|
35
|
+
"variable_id": variables,
|
|
36
|
+
"experiment_id": (
|
|
37
|
+
"ssp126",
|
|
38
|
+
"ssp245",
|
|
39
|
+
"ssp370",
|
|
40
|
+
"ssp585",
|
|
41
|
+
),
|
|
42
|
+
},
|
|
43
|
+
),
|
|
44
|
+
),
|
|
45
|
+
group_by=("experiment_id",),
|
|
46
|
+
constraints=(
|
|
47
|
+
RequireFacets("variable_id", variables),
|
|
48
|
+
AddSupplementaryDataset(
|
|
49
|
+
supplementary_facets={"experiment_id": "historical"},
|
|
50
|
+
matching_facets=(
|
|
51
|
+
"source_id",
|
|
52
|
+
"member_id",
|
|
53
|
+
"grid_label",
|
|
54
|
+
"table_id",
|
|
55
|
+
"variable_id",
|
|
56
|
+
),
|
|
57
|
+
optional_matching_facets=tuple(),
|
|
58
|
+
),
|
|
59
|
+
RequireFacets("experiment_id", ("historical",)),
|
|
60
|
+
RequireContiguousTimerange(group_by=("instance_id",)),
|
|
61
|
+
AddSupplementaryDataset.from_defaults("areacella", SourceDatasetType.CMIP6),
|
|
62
|
+
),
|
|
63
|
+
),
|
|
64
|
+
)
|
|
65
|
+
facets = ("model", "metric")
|
|
66
|
+
|
|
67
|
+
@staticmethod
|
|
68
|
+
def update_recipe(recipe: Recipe, input_files: pandas.DataFrame) -> None:
|
|
69
|
+
"""Update the recipe."""
|
|
70
|
+
# Set up the datasets
|
|
71
|
+
diagnostics = recipe["diagnostics"]
|
|
72
|
+
for diagnostic in diagnostics.values():
|
|
73
|
+
diagnostic.pop("additional_datasets")
|
|
74
|
+
recipe_variables = dataframe_to_recipe(input_files)
|
|
75
|
+
datasets = recipe_variables["tas"]["additional_datasets"]
|
|
76
|
+
datasets = [ds for ds in datasets if ds["exp"] != "historical"]
|
|
77
|
+
for dataset in datasets:
|
|
78
|
+
dataset.pop("timerange")
|
|
79
|
+
dataset["activity"] = ["CMIP", dataset["activity"]]
|
|
80
|
+
dataset["exp"] = ["historical", dataset["exp"]]
|
|
81
|
+
recipe["datasets"] = datasets
|
|
82
|
+
|
|
83
|
+
# Specify the timeranges
|
|
84
|
+
diagnostics["calculate_gwl_exceedance_years"]["variables"]["tas_anomaly"] = {
|
|
85
|
+
"short_name": "tas",
|
|
86
|
+
"preprocessor": "calculate_anomalies",
|
|
87
|
+
"timerange": "1850/2100",
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
diagnostics["gwl_mean_plots_tas"]["variables"]["tas"] = {
|
|
91
|
+
"short_name": "tas",
|
|
92
|
+
"preprocessor": "multi_model_gwl_stats",
|
|
93
|
+
"timerange": "2000/2100",
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
diagnostics["gwl_mean_plots_pr"]["variables"]["pr"] = {
|
|
97
|
+
"short_name": "pr",
|
|
98
|
+
"preprocessor": "multi_model_gwl_stats",
|
|
99
|
+
"timerange": "2000/2100",
|
|
100
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
import pandas
|
|
4
|
+
import xarray
|
|
5
|
+
|
|
6
|
+
from climate_ref_core.constraints import (
|
|
7
|
+
AddSupplementaryDataset,
|
|
8
|
+
RequireContiguousTimerange,
|
|
9
|
+
RequireFacets,
|
|
10
|
+
RequireOverlappingTimerange,
|
|
11
|
+
)
|
|
12
|
+
from climate_ref_core.datasets import ExecutionDatasetCollection, FacetFilter, SourceDatasetType
|
|
13
|
+
from climate_ref_core.diagnostics import DataRequirement
|
|
14
|
+
from climate_ref_core.pycmec.metric import MetricCV
|
|
15
|
+
from climate_ref_esmvaltool.diagnostics.base import ESMValToolDiagnostic
|
|
16
|
+
from climate_ref_esmvaltool.recipe import dataframe_to_recipe
|
|
17
|
+
from climate_ref_esmvaltool.types import MetricBundleArgs, OutputBundleArgs, Recipe
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class EquilibriumClimateSensitivity(ESMValToolDiagnostic):
|
|
21
|
+
"""
|
|
22
|
+
Calculate the global mean equilibrium climate sensitivity for a dataset.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
name = "Equilibrium Climate Sensitivity"
|
|
26
|
+
slug = "equilibrium-climate-sensitivity"
|
|
27
|
+
base_recipe = "recipe_ecs.yml"
|
|
28
|
+
|
|
29
|
+
variables = (
|
|
30
|
+
"rlut",
|
|
31
|
+
"rsdt",
|
|
32
|
+
"rsut",
|
|
33
|
+
"tas",
|
|
34
|
+
)
|
|
35
|
+
experiments = (
|
|
36
|
+
"abrupt-4xCO2",
|
|
37
|
+
"piControl",
|
|
38
|
+
)
|
|
39
|
+
data_requirements = (
|
|
40
|
+
DataRequirement(
|
|
41
|
+
source_type=SourceDatasetType.CMIP6,
|
|
42
|
+
filters=(
|
|
43
|
+
FacetFilter(
|
|
44
|
+
facets={
|
|
45
|
+
"variable_id": variables,
|
|
46
|
+
"experiment_id": experiments,
|
|
47
|
+
},
|
|
48
|
+
),
|
|
49
|
+
),
|
|
50
|
+
group_by=("source_id", "member_id", "grid_label"),
|
|
51
|
+
constraints=(
|
|
52
|
+
RequireFacets("variable_id", variables),
|
|
53
|
+
RequireFacets("experiment_id", experiments),
|
|
54
|
+
RequireContiguousTimerange(group_by=("instance_id",)),
|
|
55
|
+
RequireOverlappingTimerange(group_by=("instance_id",)),
|
|
56
|
+
AddSupplementaryDataset.from_defaults("areacella", SourceDatasetType.CMIP6),
|
|
57
|
+
),
|
|
58
|
+
),
|
|
59
|
+
)
|
|
60
|
+
facets = ("source_id", "region", "metric")
|
|
61
|
+
|
|
62
|
+
@staticmethod
|
|
63
|
+
def update_recipe(recipe: Recipe, input_files: pandas.DataFrame) -> None:
|
|
64
|
+
"""Update the recipe."""
|
|
65
|
+
# Only run the diagnostic that computes ECS for a single model.
|
|
66
|
+
recipe["diagnostics"] = {
|
|
67
|
+
"cmip6": {
|
|
68
|
+
"description": "Calculate ECS.",
|
|
69
|
+
"variables": {
|
|
70
|
+
"tas": {
|
|
71
|
+
"preprocessor": "spatial_mean",
|
|
72
|
+
},
|
|
73
|
+
"rtnt": {
|
|
74
|
+
"preprocessor": "spatial_mean",
|
|
75
|
+
"derive": True,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
"scripts": {
|
|
79
|
+
"ecs": {
|
|
80
|
+
"script": "climate_metrics/ecs.py",
|
|
81
|
+
"calculate_mmm": False,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
# Prepare updated datasets section in recipe. It contains two
|
|
88
|
+
# datasets, one for the "abrupt-4xCO2" and one for the "piControl"
|
|
89
|
+
# experiment.
|
|
90
|
+
recipe_variables = dataframe_to_recipe(input_files)
|
|
91
|
+
recipe_variables = {k: v for k, v in recipe_variables.items() if k != "areacella"}
|
|
92
|
+
|
|
93
|
+
# Select a timerange covered by all datasets.
|
|
94
|
+
start_times, end_times = [], []
|
|
95
|
+
for variable in recipe_variables.values():
|
|
96
|
+
for dataset in variable["additional_datasets"]:
|
|
97
|
+
start, end = dataset["timerange"].split("/")
|
|
98
|
+
start_times.append(start)
|
|
99
|
+
end_times.append(end)
|
|
100
|
+
timerange = f"{max(start_times)}/{min(end_times)}"
|
|
101
|
+
|
|
102
|
+
datasets = recipe_variables["tas"]["additional_datasets"]
|
|
103
|
+
for dataset in datasets:
|
|
104
|
+
dataset["timerange"] = timerange
|
|
105
|
+
|
|
106
|
+
recipe["datasets"] = datasets
|
|
107
|
+
|
|
108
|
+
@staticmethod
|
|
109
|
+
def format_result(
|
|
110
|
+
result_dir: Path,
|
|
111
|
+
execution_dataset: ExecutionDatasetCollection,
|
|
112
|
+
metric_args: MetricBundleArgs,
|
|
113
|
+
output_args: OutputBundleArgs,
|
|
114
|
+
) -> tuple[MetricBundleArgs, OutputBundleArgs]:
|
|
115
|
+
"""Format the result."""
|
|
116
|
+
input_files = next(c.datasets for _, c in execution_dataset.items())
|
|
117
|
+
source_id = input_files.iloc[0].source_id
|
|
118
|
+
|
|
119
|
+
ecs_ds = xarray.open_dataset(result_dir / "work" / "cmip6" / "ecs" / "ecs.nc")
|
|
120
|
+
ecs = float(ecs_ds["ecs"].values[0])
|
|
121
|
+
lambda_ds = xarray.open_dataset(result_dir / "work" / "cmip6" / "ecs" / "lambda.nc")
|
|
122
|
+
lambda_ = float(lambda_ds["lambda"].values[0])
|
|
123
|
+
|
|
124
|
+
# Update the diagnostic bundle arguments with the computed diagnostics.
|
|
125
|
+
metric_args[MetricCV.DIMENSIONS.value] = {
|
|
126
|
+
MetricCV.JSON_STRUCTURE.value: [
|
|
127
|
+
"source_id",
|
|
128
|
+
"region",
|
|
129
|
+
"metric",
|
|
130
|
+
],
|
|
131
|
+
"source_id": {source_id: {}},
|
|
132
|
+
"region": {"global": {}},
|
|
133
|
+
"metric": {"ecs": {}, "lambda": {}},
|
|
134
|
+
}
|
|
135
|
+
metric_args[MetricCV.RESULTS.value] = {
|
|
136
|
+
source_id: {
|
|
137
|
+
"global": {
|
|
138
|
+
"ecs": ecs,
|
|
139
|
+
"lambda": lambda_,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return metric_args, output_args
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import pandas
|
|
2
|
+
|
|
3
|
+
from climate_ref_core.constraints import AddSupplementaryDataset, RequireContiguousTimerange
|
|
4
|
+
from climate_ref_core.datasets import FacetFilter, SourceDatasetType
|
|
5
|
+
from climate_ref_core.diagnostics import DataRequirement
|
|
6
|
+
from climate_ref_esmvaltool.diagnostics.base import ESMValToolDiagnostic
|
|
7
|
+
from climate_ref_esmvaltool.recipe import dataframe_to_recipe
|
|
8
|
+
from climate_ref_esmvaltool.types import Recipe
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class GlobalMeanTimeseries(ESMValToolDiagnostic):
|
|
12
|
+
"""
|
|
13
|
+
Calculate the annual mean global mean timeseries for a dataset.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
name = "Global Mean Timeseries"
|
|
17
|
+
slug = "global-mean-timeseries"
|
|
18
|
+
base_recipe = "examples/recipe_python.yml"
|
|
19
|
+
|
|
20
|
+
data_requirements = (
|
|
21
|
+
DataRequirement(
|
|
22
|
+
source_type=SourceDatasetType.CMIP6,
|
|
23
|
+
filters=(FacetFilter(facets={"variable_id": ("tas",)}),),
|
|
24
|
+
group_by=("instance_id",),
|
|
25
|
+
constraints=(
|
|
26
|
+
RequireContiguousTimerange(group_by=("instance_id",)),
|
|
27
|
+
AddSupplementaryDataset.from_defaults("areacella", SourceDatasetType.CMIP6),
|
|
28
|
+
),
|
|
29
|
+
),
|
|
30
|
+
)
|
|
31
|
+
facets = ("model", "metric")
|
|
32
|
+
|
|
33
|
+
@staticmethod
|
|
34
|
+
def update_recipe(recipe: Recipe, input_files: pandas.DataFrame) -> None:
|
|
35
|
+
"""Update the recipe."""
|
|
36
|
+
# Clear unwanted elements from the recipe.
|
|
37
|
+
recipe["datasets"].clear()
|
|
38
|
+
recipe["diagnostics"].pop("map")
|
|
39
|
+
variables = recipe["diagnostics"]["timeseries"]["variables"]
|
|
40
|
+
variables.clear()
|
|
41
|
+
|
|
42
|
+
# Prepare updated variables section in recipe.
|
|
43
|
+
recipe_variables = dataframe_to_recipe(input_files)
|
|
44
|
+
recipe_variables = {k: v for k, v in recipe_variables.items() if k != "areacella"}
|
|
45
|
+
for variable in recipe_variables.values():
|
|
46
|
+
variable["preprocessor"] = "annual_mean_global"
|
|
47
|
+
variable["caption"] = "Annual global mean {long_name} according to {dataset}."
|
|
48
|
+
|
|
49
|
+
# Populate recipe with new variables/datasets.
|
|
50
|
+
variables.update(recipe_variables)
|