Variable Mapping Reference#
This page is intended for developers who need to understand how ACCESS-MOPPy maps raw ACCESS model output variables to CMIP-compliant output, or who want to add support for new variables or models.
Overview#
ACCESS-MOPPy uses JSON mapping files to describe how raw model variables (e.g.
UM STASH codes such as fld_s02i208, or MOM5/MOM6 diagnostics such as temp)
correspond to CMIP output variables (e.g. Amon.rsds).
At runtime, load_model_mappings() reads the appropriate
JSON file, finds the requested CMIP variable, and returns the mapping dictionary.
The relevant CMORiser subclass then uses the mapping to
load, transform, and write the data.
The mapping system also handles CMIP7 compound names transparently: a CMIP7 name is first resolved to its CMIP6 equivalent via a separate translation table, and the CMIP6 mapping is then applied as normal.
Mapping Files#
Location#
All mapping files live inside the installed package under:
src/access_moppy/mappings/
The files shipped with ACCESS-MOPPy are:
File |
Description |
|---|---|
|
Primary mapping file for ACCESS-ESM1.6 (atmosphere, ocean, land, sea ice, aerosol) |
|
Mapping file for ACCESS-CM3 (atmosphere, ocean) |
|
Mapping file for ACCESS-OM3 (ocean, time-invariant) |
|
Translation table: CMIP7 branded name → CMIP6 |
|
Translation table: CMIP6 |
Selecting a mapping file#
The mapping file to use is determined by the model_id argument of
ACCESS_ESM_CMORiser (default: "ACCESS-ESM1.6").
load_model_mappings() constructs the filename as
{model_id}_mappings.json and looks for it inside the access_moppy.mappings
package resource directory.
Top-level Structure of a Mapping File#
Each mapping file is a JSON object with the following top-level keys:
{
"model_info": { ... },
"aerosol": { "var1": { ... }, "var2": { ... } },
"atmosphere": { "var1": { ... }, "var2": { ... } },
"land": { "var1": { ... }, "var2": { ... } },
"landIce": { "var1": { ... }, "var2": { ... } },
"ocean": { "var1": { ... }, "var2": { ... } },
"sea_ice": { "var1": { ... }, "var2": { ... } }
}
model_infoA metadata block describing the model, its components, and — most importantly — how to discover raw output files automatically.
{ "model_id": "ACCESS-ESM1.6", "components": ["aerosol", "atmosphere", "land", "landIce", "ocean", "sea_ice"], "description": "Variable mappings for ACCESS-ESM1.6 Earth System Model", "file_discovery": { ... } }The
file_discoverysub-block drives automatic file discovery (see File Discovery below). Two further optional sub-blocks describe the grid a component writes on, both keyed by component and then by the stagger point a field sits on ("T"/"U"/"V"/"other", with"default"as the fallback):{ "cmip7_grid_labels": { "atmosphere": {"default": "g115", "U": "g109", "V": "g108", "other": "g110"}, "sea_ice": {"default": "g118", "U": "g116", "V": "g116"} }, "cell_measures": { "ocean": {"T": "area: areacello"} } }
cmip7_grid_labelsThe CMIP7 grid label registered for each point, used when the caller does not pin
grid_labelexplicitly. The point is taken from the mapping entry’s dimension names for the atmosphere, and from the inferred grid type at runtime for ocean and sea ice. Ocean output by basin and latitude (the overturning streamfunctions) uses the"basin"key; ACCESS-ESM1.6 sets it to its velocity gridg116, whose rows these streamfunctions are summed along, until a basin grid of its own is registered.cell_measuresThe measure this model publishes for each point, e.g.
"area: areacello". It is used only where the CMOR table declines to name one and leaves it to the modelling centre — the"--MODEL","--OPT"and"--UGRID"placeholders, which affect the sea-ice velocities and drift stresses (siu,siv,sidmasstranx, …), the ocean grid spacings and the sub-daily aerosol mixing ratios. Where the table names a real measure that value is authoritative and this block is ignored.Leave it out unless the model actually publishes an area measure for that point. With no entry, the placeholder is dropped and no
cell_measuresattribute is written, which is what CMOR itself does. ACCESS-ESM1.6 ships nocell_measuresblock: CMIP7 registers an area measure for the atmosphere (areacella), ocean (areacello), river (areacellr) and ice-sheet (areacellg) grids, but none for the sea-ice B-grid corner thatsiu/sivsit on, so there is nothing valid to name there.
Each component key (aerosol, atmosphere, etc.) maps variable names or
exact table.variable names to complete recipes. Processing, file discovery
and the ESMValTool variable index use the same selection rules:
Look for an exact key, such as
Emon.rsds, across all components.If no exact key exists, look for the short name, such as
rsds. When its entry hassupported_compound_names, the requested product must be listed.Reject ambiguous matches. An unsupported request returns
{}fromload_model_mappings; the driver raisesValueErrorbefore discovering or opening inputs, including explicitly supplied files and xarray datasets.
CMIP7 branded names are translated to their CMIP6 equivalents before selection.
Legacy short-name entries without an allowlist retain their previous behavior.
For new or revised recipes, list the products that may share the calculation.
The allowlist scopes the recipe; it does not guarantee that an archive contains
all inputs at the required cadence. Compatible MIP table names such as
APmon.rsds and LPmon.tran remain listed alongside the legacy names.
Table-specific recipes#
Add an exact key when two products need different calculations or inputs.
For example, the Emon.rsds entry takes precedence over the shared
rsds entry, even though they sit under different components. It must contain
the full recipe: model_variables, calculation, units, dimensions and any
other required fields. Fields are not merged with the short-name entry.
An exact entry that excludes the request with its own allowlist does not fall
back to the short-name recipe.
A shared entry can be scoped like this (other recipe fields omitted):
"rsds": {
"supported_compound_names": ["Amon.rsds", "day.rsds", "3hr.rsds"],
...
}
Put the recipe under the component whose file-discovery configuration locates
its native inputs, or supply a file_pattern. The output realm comes from
the requested vocabulary; it does not select or mask the native data.
load_variable_entry and load_variable_component accept a
table.variable name. Bare-name inspection raises ValueError when more
than one recipe exists for that name.
Annual wood-product carbon fluxes#
The ACCESS-ESM1-5 and ACCESS-ESM1-6 fDeforestToProduct and
fProductDecomp recipes use annual native diagnostics in g m-2 yr-1:
fld_s03i895 for transfers into products, and the sum of
fld_s03i907, fld_s03i908 and fld_s03i909 for decomposition.
These contributions already include tile-area weighting and must be summed
over tiles without multiplying by the current tile fractions.
Both mappings use calc_product_pool_kg_m2 to sum the tile contributions
and convert grams to kilograms, followed by multiplication by
1 / (365.2422 * 86400) to convert annual values to per-second fluxes.
The fixed year length follows the convention documented in issue #802;
it is not the duration of the output month. fProductDecomp no longer
requires fld_s03i317 as an input.
The #808 follow-up passes landfrac=1.0 and masks pure ocean with
mask_land(result, fld_s03i395). This preserves the annual conversion
from #802 while retaining the required land-area denominator. The shared
helper’s default whole-cell behavior is unchanged.
Baseline land means and coastal normalization#
The ACCESS-ESM1-5 and ACCESS-ESM1-6 cSoil, cVeg, lai, fBNF
and snc recipes return means over land, consistent with
area: mean where land. Native surface tile fractions (fld_s03i317)
sum to one over the land portion of a cell. Retain this tile weighting;
do not multiply the result by native land fraction (fld_s03i395).
A cell with 10% land must retain the same land-area value as a fully
land-covered cell with the same tile values and fractions.
The five recipes pass landfrac=1.0 to their existing calculation and
then apply mask_land(result, fld_s03i395). Pure-ocean cells are missing,
including when the inner calculation returns zero. Snow-free land remains
zero for snc. The calculations are:
Variable |
Land-area calculation |
|---|---|
|
Sum |
|
Sum |
|
Sum |
|
Sum |
|
|
Caller audit and scope#
Both model mappings use the same native diagnostics. The four carbon, LAI
and nitrogen-fixation products are land means in CMIP6 and CMIP7. Snow cover
needs an era-specific calculation: CMIP6 LImon.snc explicitly describes
the percentage of the whole grid cell occupied by snow resting on land;
CMIP7 landIce.snc.tavg-u-hxy-lnd.mon.glb instead declares a land mean.
The exact LImon.snc recipe therefore keeps the legacy whole-cell
calculation by default and supplies the corrected land mean under
calculation_overrides.CMIP7. This replaces only the calculation; input
fields and discovery are identical. load_model_mappings infers CMIP7
from a branded name, or accepts cmip_version="CMIP7" with a legacy
request. The driver passes the output vocabulary version when resolving
CMIP7 requests in either syntax. Other snow-cover products are unchanged.
Shared helper implementations and defaults are unchanged.
calc_carbon_pool_kg_m2 delegates to
calc_mass_pool_kg_m2 and is also used by cLeaf, cLitter and
cRoot. The mass helper also has the nitrogen-pool alias.
weighted_tile_sum additionally serves cSoilFast, cSoilMedium,
cSoilSlow, fNdep, fNgas, fNleach, fNloss, fNnetmin,
fNup, tran and (ESM1-5 only) nbp. Before this correction,
calc_snc had only the two model snc mapping callers. These other
recipes were outside the five-variable correction; the additional carbon and
nitrogen recipes are addressed below. Valid whole-cell recipes,
including 3hr.tran, retain their required land-fraction scaling.
The annual conversion and product tile-summing changes in PR #809 are retained.
Validation and published-data follow-up#
Numerical mapping regressions cover both models, CMIP6/7 request names,
pseudo_level_0 and pseudo_level axes, eager and Dask inputs,
unequal tiles, full land, fractional coasts, ocean masking and snow-free
land. The 72 land-mean cases fail on the original mappings and pass after
correction; eight additional cases preserve CMIP6 whole-cell snow cover.
Global integrals must use land area, areacella * sftlf / 100, where
sftlf is in percent. Check coastal values and ocean masking separately;
a global total alone can conceal the wrong averaging domain.
The optional native integration tests exercise CMIP7 writing for all five variables and compare every cell and monthly land-area integral with an explicit calculation from native ACCESS-ESM1-6 historical inputs:
ACCESS_MOPPY_DATA_ROOT=/path/to/esm-historical PYTHONPATH=src \
python -m pytest tests/integration/test_baseline_land_means.py -q
Local validation on 2 November 2026 passed for all twelve months of 1951, including CMOR writing and CMIP7 repacking. The snow tests additionally verify CMIP7 selection using the legacy request name and preserve CMIP6 whole-cell output. Direct mapping checks also passed for June 1951, 1952 and 1953, with 2,434 fractional coastal cells per grid (relative tolerance 1e-12; written float32 output uses 1e-6).
For June 1952 (output102/atmosphere/netCDF/aiihca.pa-195206_mon.nc),
the following global integrals use land area from native bounds and land
fraction, with a spherical radius of 6,371,000 m. snc is divided by
100 before integrating. These are historical validation results, not
estimates of the published piControl release’s global error.
Variable |
Units |
Corrected integral |
Original recipe with land area |
|---|---|---|---|
|
Pg C |
819.0460 |
786.0390 |
|
Pg C |
630.4198 |
595.9141 |
|
Million km2 leaf area |
170.3869 |
161.3088 |
|
kg N s-1 |
6645.1850 |
6383.2033 |
|
Million km2 snow-covered land |
29.4636 |
28.0644 |
At the 10%-land cell (31.25 S, 153.75 E), corrected cSoil, cVeg,
lai and fBNF are 9.675680, 10.066345, 3.052340 and 4.286376e-12
in their mapped units. At (58.75 N, 281.25 E), snc is 100% instead of
10%. Native carbon-pool and nitrogen-fixation unit attributes are absent
from these files; the existing conversions were retained, not independently
re-established from model source in this validation.
Issue #808 tracks the published-data erratum. The inspected published samples are ACCESS-ESM1-6 piControl/r1i1p1f1, g115/v20261002, model years 0101-0109, recording MOPPy 1.8.1. The published/fraction map values illustrate an inferred correction; they are not independently validated replacements. Historical native samples are from a different run and period. No native ACCESS-ESM1-5 run has been validated for this correction.
The following remain outstanding after this code change:
Compare the sampled published piControl files with matching native output.
Inventory exact affected experiment/member/dataset/version identifiers and producing MOPPy releases across the published archive.
Prepare and formally register the erratum with the publication team.
Reprocess production data, validate replacements and record new versions and the handling of affected versions in #808.
Merging this code fix does not resolve the published-data erratum.
Additional carbon and nitrogen land means#
The follow-up to #808 applies the same land-area normalization to these
19 recipes in both ACCESS-ESM1-5 and ACCESS-ESM1-6. Their monthly CMIP6 and
CMIP7 definitions declare area: mean where land:
Group |
Variables |
|---|---|
Carbon pools |
|
Nitrogen pools |
|
Nitrogen fluxes |
|
Product fluxes |
|
Each recipe passes unity for the final land fraction and applies the native
land mask. Tile-density diagnostics retain their tile-fraction weighting.
Product diagnostics already weighted over land are summed without applying
tile fractions again; cLand and nLand retain both kinds of terms.
The g-to-kg conversions, daily nitrogen-flux constants and annual product-flux
conversion remain unchanged.
cRoot also corrects a separate input error: it uses native root carbon
fld_s03i854, rather than leaf carbon fld_s03i852. Unlike the area-only
correction, this input change can affect fully land-covered cells as well.
The native integration test compares the written field with weighted root
diagnostic 854; the synthetic test supplies distinct root and leaf values.
The shared-helper caller audit leaves cSoilFast, cSoilMedium and
cSoilSlow outside this change, along with daily snow. They require separate
follow-up. Whole-cell transpiration and the ESM1-5 nbp expression retain
their existing internal land-fraction factors. Native grid-cell productivity
and respiration fluxes still require division by land fraction, as described
in #115; this is
different from removing a mapping-applied factor from a land-area quantity.
The 304 numerical regression cases cover all 19 variables, both model mappings, CMIP6/7 requests, both tile-axis names, eager/Dask inputs, unequal tile values, pure land, 50% and 10% coasts, and zero/missing/finite ocean inputs. They fail on the pre-correction mappings. Product-flux tests also preserve the annual unit conversion from #802.
Native integration tests exercise the actual mappings through CMOR writing and CMIP7 repacking. Select a complete native year with:
ACCESS_MOPPY_DATA_ROOT=/path/to/esm-historical \
ACCESS_MOPPY_TEST_YEAR=1951 PYTHONPATH=src \
python -m pytest tests/integration/test_additional_land_means.py -q
Local validation on 2 November 2026 passed all 19 cases for each of 1951,
1952 and 1953: 57 CMOR/repack tests covering 684 variable-months and 2,434
fractional coastal cells per month. These runs use the corrected production
recipes, including root diagnostic 854 for cRoot.
The tests compare every monthly cell, output coordinates, ocean masks and
global integrals using areacella * sftlf / 100. Written values use
rtol=1e-6 and zero absolute tolerance. For signed fNnetmin contributions
that nearly cancel, a per-cell float32 rounding bound is additionally allowed:
gamma_(n+4) * sum(abs(tile_value * tile_fraction)) * conversion, where
gamma_k = k*eps / (1-k*eps). The output must also exactly match an
independent calculation using the native float32 precision. This does not
relax global-integral tolerances.
These historical inputs are from a different run and period than the published piControl sample. Existing conversions are retained, since native pool/flux unit attributes are absent. ESM1-5 native validation, matching published-run validation, a complete affected-release inventory, formal erratum registration and production reprocessing remain outstanding.
Land-only incoming shortwave radiation#
Emon.rsds (CMIP7 land.rsds.tavg-u-hxy-lnd.mon.glb) is supported for
ACCESS-ESM1-5 and ACCESS-ESM1-6 by its own recipe. It uses native incoming
shortwave radiation fld_s01i235 and land fraction fld_s03i395:
rsds = fld_s01i235.where(fld_s03i395 > 0)
Pure-ocean cells are missing. Cells containing any land, including fractional
coastal cells, retain their incoming flux without multiplication or division
by land fraction. UM supplies the same incoming radiation across the grid cell;
the upstream mapping clarification
identifies this product as the global rsds field masked over land.
This rule is specific to incoming radiation; it does not establish the same
rule for upward radiation or other surface fluxes.
Use cmip_version="CMIP7" with either name. Discovery includes both native
fields, and an explicit input must also contain both. The recipe works lazily
with Dask and can be partitioned in time. Regenerate earlier Emon.rsds
output to remove the previously unmasked ocean values.
Other averaging-domain variants#
The other products in issue #803 use these rules for
ACCESS-ESM1-5 and ACCESS-ESM1-6. land_tile_mean weights by fld_s03i317
and divides by the total tile fraction; it returns missing over ocean and
propagates missing values on occupied tiles.
Product |
Calculation |
Required inputs and availability |
|---|---|---|
|
|
Daily |
|
Land tile mean of |
Monthly |
|
Land tile mean of |
All three fluxes and |
|
Land tile mean of |
Three-hourly |
|
Still blocked: whole-cell upward radiation cannot supply a coastal land-only mean. |
Needs a verified land-only radiation diagnostic. The sample archive
lacks |
Eday.clt follows the upstream land-mask clarification.
The sublimation tile diagnostic follows the upstream mapping.
The evaporation sum was checked against the native total moisture flux
fld_s03i223 on pure-land cells in monthly ACCESS-ESM1-6 output, agreeing
to numerical precision; this validates the budget, not the availability of
daily inputs. Monthly data must not be substituted for missing daily or
three-hourly diagnostics. Without the required native output at the requested
frequency, these products cannot be CMORised, even when a mapping exists.
Eday.evspsbl and 3hr.tran are excluded from the shipped batch configs.
Discovery recognises Eday and land three-hourly streams. These recipes
also accept their CMIP7 aliases and explicit inputs containing the required
diagnostics. Numerical tests cover ocean, fractional coast and pure land;
integration tests compare written cloud cover and sublimation to native data.
LImon.sbl declares native_realm: "land" in its recipe, so native grid
resolution comes from CABLE. Its output realm remains landIce. This does
not enable unsupported ice-sheet products. native_realm is an optional
mapping field for this distinction; the named source component must have a
registered native resolution. The whole-cell Amon.sbl recipe retains
fld_s03i298 and identifies its native component as atmos.
The LImon.sbl recipe supports CMIP6 and CMIP7 only: the newer MIP table
selected for CMIP6Plus uses that name for a whole-cell mean, so it is rejected
rather than applying the legacy land-only calculation.
The upstream rsus discussion
suggests fld_s01i235 - fld_s01i257, but explicitly calls for checking what
those diagnostics contain. Emon.rsus is removed from the batch configs
until its native output is available and its coastal values can be verified. Eday.sbl
is also excluded: the bundled CMIP6 definition is a land mean, while its CMIP7
alias describes a whole-cell mean.
For surface fluxes that differ between land and ocean, masking ocean cells
alone cannot recover a land-only mean in a mixed coastal cell.
Dividing a whole-cell flux by land fraction is valid only when its ocean
contribution is known to be zero. Conversely, a per-land-area transpiration
flux needs land-fraction weighting to become a whole-cell flux. Do not infer
these operations from the output realm or area_label alone.
To enable a held product, verify the native diagnostic’s definition and area
normalization, add its complete recipe, and test pure-ocean, mixed-coast and
pure-land cells numerically. Check that discovery selects all required inputs
and that the CMIP6 and CMIP7 requests select the intended recipe. Metadata
compliance alone cannot validate this calculation. Previously generated
Emon.rsus files should be withheld from publication and
regenerated after their recipes are validated.
Variable Entry Fields#
Each variable entry inside a component block shares the same set of optional and required fields:
Field |
Required |
Description |
|---|---|---|
|
Yes |
The CF conventions standard name for the output variable.
May be an empty string |
|
Yes |
Ordered dictionary that maps model dimension names (keys) to CMIP dimension names (values). This tells the CMORiser how to rename coordinates. Example: "dimensions": {"time": "time", "lat": "lat", "lon": "lon"}
|
|
Yes |
Expected physical units of the CMIP output variable (e.g. |
|
Yes |
Sign convention metadata: |
|
Yes |
List of raw model variable names that must be loaded from the input files.
These are passed by name into the calculation context.
|
|
No |
Exact CMIP6 |
|
No |
CMIP versions allowed by the driver. Use when the same table name has
changed meaning across vocabularies, e.g. |
|
No |
Source component used for native nominal resolution, without changing
the output realm. For example, |
|
Yes |
Dictionary that specifies how to derive the output variable. See Calculation Types below. |
|
No |
Complete replacement calculations keyed by output vocabulary version,
for example |
|
No |
Present for variables on vertical levels. Describes the vertical coordinate type and the variables needed to reconstruct it. See Vertical Axis (zaxis) Field below. |
|
No |
A glob pattern (or list of patterns), relative to "file_pattern": "output[0-9][0-9][0-9]/ocean/ocean-2d-surface_temp-1mon-mean-y_*.nc"
When absent, discovery falls back to the |
|
No |
Name of a bundled NetCDF resource file (stored under |
Example — simple direct variable#
"rldscs": {
"CF standard Name": "surface_downwelling_longwave_flux_in_air_assuming_clear_sky",
"dimensions": {"time": "time", "lat": "lat", "lon": "lon"},
"units": "W m-2",
"positive": "down",
"model_variables": ["fld_s02i208"],
"calculation": {
"type": "direct",
"formula": "fld_s02i208"
}
}
Calculation Types#
The calculation dictionary always contains a "type" key. The five supported
types are described below.
direct#
The output variable is taken straight from one model variable with no transformation.
"calculation": {
"type": "direct",
"formula": "<model_variable_name>"
}
formula#
The output is derived by calling a registered function from the
custom_functions registry (see
Custom Functions Registry).
"calculation": {
"type": "formula",
"operation": "<function_name>",
"args": ["<var1>", "<var2>", ...],
"kwargs": {"<key>": "<var_or_literal>"}
}
argsis a list of positional arguments. Each item is either a string (variable name looked up in the input context), a number (used as-is), or a nested expression dictionary (see Expression Language below).kwargsis a dictionary of keyword arguments. Values follow the same rules asargsitems.Alternatively,
operandsmay be used instead ofargsfor legacy entries — both are treated identically by the expression evaluator.
Optional operands example (ocean hfds):
"calculation": {
"type": "formula",
"operation": "calc_hfds",
"args": ["sfc_hflux_from_runoff", "sfc_hflux_coupler", "sfc_hflux_pme"],
"kwargs": {
"frazil_3d_int_z": {"optional": "frazil_3d_int_z"},
"frazil_2d": {"optional": "frazil_2d"}
}
}
Wrapping a value in {"optional": "<var>"} means the variable is passed as
None if it is absent from the input dataset, instead of raising a
KeyError.
operation#
A shorthand for common two-argument arithmetic operations. Functionally equivalent
to formula but expressed more compactly:
"calculation": {
"type": "operation",
"operation": "<op_name>",
"args": ["<var1>", "<var2>"]
}
Supported operation values: "add", "subtract", "multiply",
"divide", "power".
Example (land npp — net primary productivity divided by tile fraction):
"calculation": {
"type": "operation",
"operation": "divide",
"args": ["fld_s03i262", "fld_s03i395"]
}
dataset_function#
Calls a more complex dataset-level function that receives the entire xarray Dataset and may modify dimensions or coordinates (e.g. interpolating from hybrid-height levels to physical height levels).
"calculation": {
"type": "dataset_function",
"function": "<function_name>",
"kwargs": {}
}
Available dataset_function values: "cl_level_to_height",
"cli_level_to_height", "clw_level_to_height", "level_to_height".
These functions are defined in
access_moppy.derivations.calc_atmos and registered in
custom_functions.
internal#
The output variable is computed entirely internally from ancillary information (grid geometry, etc.) without reading any user-provided input file.
"calculation": {
"type": "internal",
"function": "<function_name>",
"args": []
}
Currently the only available function is "calculate_areacella" (atmospheric
grid-cell area, computed from latitude/longitude coordinate arrays).
Variables that use this type do not require input_data to be passed to
ACCESS_ESM_CMORiser.
Expression Language#
The formula calculation type uses a small recursive expression language that is
evaluated by evaluate_expression().
An expression can be one of:
Expression form |
Meaning |
|---|---|
|
Look up the named variable in the input context (an xarray DataArray). |
|
A literal numeric value (integer or float). |
|
Explicit literal — useful when the value might be a string or ambiguous. |
|
Look up the variable; return |
|
Nested function call: recursively evaluate |
Expressions can be arbitrarily nested, allowing compound derivations to be expressed in a single JSON structure.
Custom Functions Registry#
All functions available to the formula, operation, and dataset_function
calculation types are registered in the dictionary
access_moppy.derivations.custom_functions.
Built-in operations#
Name |
Description |
|---|---|
|
Sum of any number of arguments: |
|
Difference: |
|
Product: |
|
Ratio: |
|
Exponentiation: |
|
|
|
Arithmetic mean of multiple arguments |
|
|
|
|
|
Select a single index slice: |
|
Resample to monthly minimum |
|
Resample to monthly maximum |
|
Drop a named dimension/axis |
|
Drop the time dimension (for time-invariant fields stored in time-varying files) |
|
Squeeze (remove) size-1 dimensions |
Atmosphere functions#
Defined in access_moppy.derivations.calc_atmos.
Name |
Description |
|---|---|
|
Convert cloud fraction from hybrid-height levels to physical height levels |
|
Convert cloud ice content from hybrid-height levels to physical height levels |
|
Convert cloud liquid water from hybrid-height levels to physical height levels |
|
Generic hybrid-height level → physical height conversion |
|
Compute atmospheric grid-cell area from lat/lon coordinates |
Aerosol functions#
Defined in access_moppy.derivations.calc_aerosol.
Name |
Description |
|---|---|
|
Sum spectral band optical depths to produce a broadband aerosol optical depth |
Land functions#
Defined in access_moppy.derivations.calc_land.
Name |
Description |
|---|---|
|
Extract top-soil layer diagnostic |
|
Derive land cover fractions from tile data |
|
Extract a specific tile fraction |
|
Weighted sum over surface tiles |
|
Convert carbon pool units to kg m⁻² |
|
Total land carbon including wood products |
|
Convert mass pool to kg m⁻² |
|
Convert nitrogen pool units to kg m⁻² |
|
Total land nitrogen including wood products |
|
Wood-harvest product pool in kg m⁻² (already per land area: no tile weighting) |
|
Compute frozen soil moisture |
|
Compute liquid soil moisture |
|
Compute total soil moisture |
|
Compute soil temperature profile |
Ocean functions#
Defined in access_moppy.derivations.calc_ocean.
Name |
Description |
|---|---|
|
Compute ocean grid-cell area |
|
Downward ocean heat flux (composite of runoff, coupler, P-E terms, plus optional frazil) |
|
Upward geothermal heat flux |
|
Barotropic mass streamfunction |
|
Meridional overturning circulation streamfunction |
|
Shortwave radiation absorbed in ocean |
|
Volume-weighted global ocean average |
|
Total mass transport across an ocean section |
|
Zonal mass transport corrected for barotropic flow |
|
Meridional mass transport corrected for barotropic flow |
|
Global mean thermosteric sea level change |
|
Extract ocean floor (bottom-cell) values |
Sea ice functions#
Defined in access_moppy.derivations.calc_seaice.
Name |
Description |
|---|---|
|
Sea ice extent (area where concentration > 15 %) |
|
Hemisphere-specific sea ice aggregate |
|
Northern/southern hemisphere sea ice area |
|
Northern/southern hemisphere sea ice volume |
|
Northern/southern hemisphere sea ice snow mass |
|
Northern/southern hemisphere sea ice extent |
|
Snow thickness from grid-cell snow mass, ice concentration, and snow density |
The ACCESS-ESM1-6 sisnthick mapping passes snow_density: 330.0
(kg/m³). CICE5’s ACCESS driver uses this density to convert snow volume
per grid-cell area into the native sisnmass diagnostic; the thickness
conversion must use the same value. See the
CICE5 snow density
and
snow-mass diagnostic.
The helper’s default remains 317.0 for compatibility with existing callers;
other model mappings are unchanged.
Vertical Axis (zaxis) Field#
For variables defined on vertical levels the mapping entry may include a zaxis
block that describes the vertical coordinate:
"zaxis": {
"type": "hybrid_height",
"coordinate_variables": {
"sigma_theta": "b",
"surface_altitude": "orog",
"theta_level_height": "lev"
},
"formula": "z = a + b*orog"
}
type: currently always"hybrid_height"(UM eta-based hybrid height coordinate).coordinate_variables: mapping from the UM variable name (key) to the CMIP output coordinate name (value).formula: human-readable label for the vertical coordinate reconstruction formula.
The actual vertical interpolation is carried out by the dataset_function
registered functions (e.g. level_to_height) using the auxiliary variables
identified in coordinate_variables.
Resource Files#
Some variables (e.g. areacello, zfull) are derived from static ancillary
data that is bundled with ACCESS-MOPPy rather than read from user-supplied files.
These are listed in the ressource_file field (note the non-standard spelling,
kept for historical compatibility).
Bundled resource files live under:
src/access_moppy/resources/
When ressource_file is set and no input_data is provided to
ACCESS_ESM_CMORiser, the bundled file is resolved via
importlib.resources.files() and used automatically.
CMIP7 Compound Name Translation#
CMIP7 uses a longer “branded” compound name format:
realm.variable.operation.frequency.domain
(e.g. atmos.rsds.tavg-u-hxy-u.mon.GLB).
The files cmip7_to_cmip6_compound_name_mapping.json and
cmip6_to_cmip7_compound_name_mapping.json provide a bidirectional look-up
table between these names and the familiar CMIP6 table.variable form.
These mappings are generated from the official CMIP7 Data Request API and contain
~1 974 entries. The function
_get_cmip7_to_cmip6_mapping() resolves a CMIP7 name
to its CMIP6 equivalent (with support for regex patterns when a single exact match
is not available).
The resolved CMIP6 name is then passed to load_model_mappings()
as usual, so the variable-level mapping files only need to be maintained in CMIP6
terms.
Adding New Mappings#
To add support for a new variable, open the relevant model mapping JSON file and add an entry under the appropriate component key.
Checklist#
Identify the correct component (
atmosphere,ocean, etc.) based on the model realm.Use the CMIP6 variable short name as the JSON key.
Fill in all required fields:
CF standard Name,dimensions,units,positive,model_variables,calculation.Choose the simplest applicable
calculation.type:Single variable, no transform →
directArithmetic on two variables →
operationCustom function with ≥ 1 argument →
formulaDataset-level level interpolation →
dataset_functionNo input data needed →
internal
If the function you need does not yet exist in
custom_functions, implement it in the appropriatecalc_*.pymodule underaccess_moppy.derivations, import it inaccess_moppy.derivations.__init__, and register it in thecustom_functionsdictionary.Run the test suite to ensure no regressions.
Example — adding a new atmosphere variable#
Suppose you want to add huss (near-surface specific humidity, fld_s03i237):
"huss": {
"CF standard Name": "specific_humidity",
"dimensions": {"time": "time", "lat": "lat", "lon": "lon"},
"units": "1",
"positive": null,
"model_variables": ["fld_s03i237"],
"calculation": {
"type": "direct",
"formula": "fld_s03i237"
}
}
Adding a new model#
Create
src/access_moppy/mappings/<MODEL_ID>_mappings.jsonfollowing the same top-level structure (model_info+ component keys).Add a
file_discoveryblock tomodel_info(see File Discovery) so that MOPPy can auto-discover raw files for the new model.Pass
model_id="<MODEL_ID>"toACCESS_ESM_CMORiserto activate the new mapping file.If the model uses a different CMORiser class (e.g. a new ocean component), implement a
CMORisersubclass and wire it up inaccess_moppy.driver.
File Discovery#
Overview#
discover_files() automatically locates raw
model output files for a CMIP variable given only an archive root directory.
It is used as a fallback by the batch system when no explicit file_patterns
entry is present in the batch config.
Resolution order#
Per-variable
file_patternin the mapping entry — explicit override for edge-cases (unusual filenames, legacy layouts, or derived variables drawing from multiple file types).Component-level
frequency_patternsfrommodel_info.file_discovery— the normal path, resolved by substituting{model_var}frommodel_variablesand globbing underinput_folder.FileDiscoveryError— raised when neither source provides a pattern; the batch job fails with an actionable message.
file_discovery block in model_info#
"file_discovery": {
"output_dir_pattern": "output[0-9][0-9][0-9]",
"components": {
"atmosphere": {
"subdir": "atmosphere/netCDF",
"frequency_patterns": {
"mon": "*.pa-*_mon.nc",
"day": "*.pe-*_dai.nc",
"3hr": "*.pi-*_3hr.nc",
"6hr": "*.pj-*_6hr.nc",
"subhr": "*.pc-*.nc"
}
},
"sea_ice": {
"subdir": "ice",
"frequency_patterns": {
"mon": "iceh-1monthly-mean_*.nc",
"day": "iceh-1daily-mean_*.nc"
}
},
"ocean": {
"subdir": "ocean",
"frequency_patterns": {
"mon": "ocean-*-{model_var}-1mon-mean-y_*.nc",
"day": "ocean-*-{model_var}-1day-mean-y_*.nc",
"yr": "ocean-*-{model_var}-1yr-mean-y_*.nc",
"fx": "ocean-*-{model_var}-fx.nc"
}
}
}
}
output_dir_patternGlob fragment matched against the top-level output sub-directories (e.g.
output000,output001, …).subdirPath relative to the output directory where the component’s files live.
frequency_patternsDictionary keyed by frequency token (
"mon","day","3hr","6hr","yr","fx") mapping to a filename glob.When the pattern contains
{model_var}, it is substituted with each entry in the variable’smodel_variableslist and all results are merged — this is how multi-variable derivations (e.g. ocean overturning computed from two transport fields) collect all required files.When the pattern has no
{model_var}placeholder (atmosphere, sea ice), a single glob is issued that returns all files for that frequency, regardless of which variable is requested. All variables at that frequency are packed into the same file in those components.
frequency_patterns keys#
The key is derived from the CMIP table name of the requested variable:
Key |
CMIP tables that map to it |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Year-based filtering#
discover_files() accepts optional
start_year and end_year arguments. After globbing, files outside the
requested range are removed by parsing the year directly from the filename
— no files are opened, so filtering adds negligible overhead even for large
archives.
The following filename conventions are recognised:
ocean-2d-tos-1mon-mean-y_1850.nc→ year1850iceh-1monthly-mean_1850-01.nc→ year1850aiihca.pa-185001_mon.nc→ year1850tos_mean_ocean_1mon_185001-185012.nc→ start year1850(proposed unified naming scheme)
Adapting to a different file layout#
Each model version can have its own mapping file with a different
file_discovery block. To add support for a new file organisation:
Create (or copy) a mapping JSON — e.g.
ACCESS-ESM1.6-unified_mappings.json.Update
model_info.file_discoverywith the newsubdirvalues andfrequency_patternsglobs.For per-variable overrides (renamed files, unusual paths), add a
file_patternfield directly to the variable entry.Point the batch config at the new mapping:
model_id: ACCESS-ESM1.6-unified.
Old and new runs can be processed side-by-side; the model_id in each
batch config selects the correct layout independently.