How to derive a branded variable name¶
Here we show how to translate "old" CMIP variable names plus information about dimensions and cell methods. into CMIP branded variables.
Imports¶
from cmip_branded_variable_mapper import map_to_cmip_branded_variable
Creating branded variables¶
The basic API is very simple: map_to_cmip_branded_variable With this API, we can generate a branded variable name from a variable name, its cell methods and its dimensions (as a tuple, not a whitespace-separated string).
tas_branded_variable = map_to_cmip_branded_variable(
variable_name="tas",
cell_methods="area: time: mean",
dimensions=("longitude", "latitude", "time", "height2m"),
)
tas_branded_variable
'tas_tavg-h2m-hxy-u'
tos_branded_variable = map_to_cmip_branded_variable(
variable_name="tos",
cell_methods="area: mean where sea time: point",
dimensions=("longitude", "latitude", "time1"),
)
tos_branded_variable
'tos_tpt-u-hxy-sea'
hfds_branded_variable = map_to_cmip_branded_variable(
variable_name="hfds",
cell_methods="area: mean where sea time: mean",
dimensions=("longitude", "latitude", "time"),
)
hfds_branded_variable
'hfds_tavg-u-hxy-sea'
Note¶
In the exceptionally rare case where a variable has no associated cell methods,
you can simply supply cell_methods=None
when calling map_to_cmip_branded_variable.
Scope of the package¶
There are clearly many things missing here. For example, the package provides no information about what combinations of variable names, cell methods and dimensions are valid. These are good questions, but they're also outside the remit of this package. If you do have insights/thoughts, please raise an issue and we will do our best to put this information in a more useful place.