Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@
path = src/access_moppy/vocabularies/CMIP7_CVs
url = git@github.com:WCRP-CMIP/CMIP7-CVs.git
branch = production
[submodule "src/access_moppy/vocabularies/CMIP6_CVs"]
path = src/access_moppy/vocabularies/CMIP6_CVs
url = git@github.com:WCRP-CMIP/CMIP6_CVs.git
branch = main
[submodule "src/access_moppy/vocabularies/CMIP6Plus_CVs"]
path = src/access_moppy/vocabularies/CMIP6Plus_CVs
url = git@github.com:WCRP-CMIP/CMIP6Plus_CVs.git
branch = main
40 changes: 40 additions & 0 deletions docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,49 @@ You can also provide additional metadata such as `experiment_id`, `source_id`, `
variant_label="r1i1p1f1",
grid_label="gn",
activity_id="CMIP",
cmip_version="CMIP6", # Optional, default is CMIP6
parent_info=parent_experiment_config # <-- This is optional, can be skipped if not needed
)

Choosing CMIP6 vs CMIP6Plus vs CMIP7
------------------------------------

From a user point of view, vocabulary selection is controlled by the ``cmip_version`` argument in ``ACCESS_ESM_CMORiser``:

- ``cmip_version="CMIP6"`` (default) uses CMIP6 controlled vocabularies
- ``cmip_version="CMIP6Plus"`` uses CMIP6Plus controlled vocabularies
- ``cmip_version="CMIP7"`` uses CMIP7 controlled vocabularies

.. code-block:: python

from access_moppy import ACCESS_ESM_CMORiser

# CMIP6 (default)
cmip6_cmoriser = ACCESS_ESM_CMORiser(
input_data=files,
compound_name="Amon.rsds",
experiment_id="historical",
source_id="ACCESS-ESM1-5",
variant_label="r1i1p1f1",
grid_label="gn",
activity_id="CMIP",
cmip_version="CMIP6",
)

# CMIP6Plus
cmip6plus_cmoriser = ACCESS_ESM_CMORiser(
input_data=files,
compound_name="Amon.rsds",
experiment_id="historical",
source_id="ACCESS-CM2",
variant_label="r1i1p1f1",
grid_label="gn",
activity_id="CMIP",
cmip_version="CMIP6Plus",
)

Use ``source_id``, ``experiment_id``, and other metadata values that exist in the selected controlled vocabulary set. CMIP6 and CMIP6Plus entries are not always identical.

Exploring Variable Mappings
---------------------------

Expand Down
44 changes: 44 additions & 0 deletions notebooks/Getting_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,50 @@
")"
]
},
{
"cell_type": "markdown",
"id": "689f6977",
"metadata": {},
"source": [
"## Choosing CMIP6 vs CMIP6Plus vs CMIP7\n",
"\n",
"You can select which controlled vocabulary set is used by passing the `cmip_version` argument when creating `ACCESS_ESM_CMORiser`:\n",
"\n",
"- `cmip_version=\"CMIP6\"` (default) uses CMIP6 vocabularies\n",
"- `cmip_version=\"CMIP6Plus\"` uses CMIP6Plus vocabularies\n",
"- `cmip_version=\"CMIP7\"` uses CMIP7 vocabularies\n",
"\n",
"```python\n",
"from access_moppy import ACCESS_ESM_CMORiser\n",
"\n",
"# CMIP6 (default)\n",
"cmip6_cmoriser = ACCESS_ESM_CMORiser(\n",
" input_data=files,\n",
" compound_name=\"Amon.rsds\",\n",
" experiment_id=\"historical\",\n",
" source_id=\"ACCESS-ESM1-5\",\n",
" variant_label=\"r1i1p1f1\",\n",
" grid_label=\"gn\",\n",
" activity_id=\"CMIP\",\n",
" cmip_version=\"CMIP6\",\n",
")\n",
"\n",
"# CMIP6Plus\n",
"cmip6plus_cmoriser = ACCESS_ESM_CMORiser(\n",
" input_data=files,\n",
" compound_name=\"Amon.rsds\",\n",
" experiment_id=\"historical\",\n",
" source_id=\"ACCESS-CM2\",\n",
" variant_label=\"r1i1p1f1\",\n",
" grid_label=\"gn\",\n",
" activity_id=\"CMIP\",\n",
" cmip_version=\"CMIP6Plus\",\n",
")\n",
"```\n",
"\n",
"> Tip: Use `source_id`, `experiment_id`, and related metadata values that exist in the selected vocabulary set, because CMIP6 and CMIP6Plus entries are not always identical."
]
},
{
"cell_type": "markdown",
"id": "12144707",
Expand Down
22 changes: 18 additions & 4 deletions src/access_moppy/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
_get_cmip7_to_cmip6_mapping,
load_model_mappings,
)
from access_moppy.vocabulary_processors import CMIP6Vocabulary, CMIP7Vocabulary
from access_moppy.vocabulary_processors import (
CMIP6PlusVocabulary,
CMIP6Vocabulary,
CMIP7Vocabulary,
)


class ACCESS_ESM_CMORiser:
Expand Down Expand Up @@ -52,7 +56,7 @@ def __init__(
:param source_id: CMIP source ID (e.g., 'ACCESS-ESM1-5').
:param variant_label: CMIP variant label (e.g., 'r1i1p1f1').
:param grid_label: CMIP grid label (e.g., 'gn').
:param cmip_version: CMIP version to use - either 'CMIP6' or 'CMIP7' (default: 'CMIP6').
:param cmip_version: CMIP version to use - one of 'CMIP6', 'CMIP6Plus', or 'CMIP7' (default: 'CMIP6').
:param activity_id: CMIP activity ID (e.g., 'CMIP').
:param output_path: Path to write the CMORised output.
:param drs_root: Optional root path for DRS structure.
Expand All @@ -65,9 +69,9 @@ def __init__(
"""

# Validate CMIP version
if cmip_version not in ("CMIP6", "CMIP7"):
if cmip_version not in ("CMIP6", "CMIP6Plus", "CMIP7"):
raise ValueError(
f"cmip_version must be 'CMIP6' or 'CMIP7', got '{cmip_version}'"
f"cmip_version must be 'CMIP6', 'CMIP6Plus', or 'CMIP7', got '{cmip_version}'"
)

self.cmip_version = cmip_version
Expand Down Expand Up @@ -179,6 +183,16 @@ def __init__(
activity_id=activity_id,
parent_info=self.parent_info,
)
elif self.cmip_version == "CMIP6Plus":
self.vocab = CMIP6PlusVocabulary(
compound_name=self.cmip6_compound_name,
experiment_id=experiment_id,
source_id=source_id,
variant_label=variant_label,
grid_label=grid_label,
activity_id=activity_id,
parent_info=self.parent_info,
)
else: # CMIP7
self.vocab = CMIP7Vocabulary(
compound_name=self.cmip7_compound_name,
Expand Down
1 change: 1 addition & 0 deletions src/access_moppy/vocabularies/CMIP6Plus_CVs
Submodule CMIP6Plus_CVs added at 9963a2
1 change: 1 addition & 0 deletions src/access_moppy/vocabularies/CMIP6_CVs
Submodule CMIP6_CVs added at 78a465

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading