cmip_branded_variable_mapper.temporal_label#
Determination of the temporal label
Functions:
| Name | Description |
|---|---|
get_temporal_label |
Get temporal label |
Attributes:
| Name | Type | Description |
|---|---|---|
TEMPORAL_LABEL_CELL_METHODS_INITIAL_TESTS_MAPPER |
Mapper from sub-strings of cell methods to the temporal label |
|
TEMPORAL_LABEL_CELL_METHODS_TIME4_TESTS_MAPPER |
Mapper from sub-strings of cell methods to the temporal label for "time4" data |
|
TEMPORAL_LABEL_DIMENSIONS_MAPPER |
Mapper from dimensions to the temporal label |
TEMPORAL_LABEL_CELL_METHODS_INITIAL_TESTS_MAPPER
module-attribute
#
TEMPORAL_LABEL_CELL_METHODS_INITIAL_TESTS_MAPPER = (
CellMethodsSubStringMapper(
sub_string_map={
"time: max": "tmax",
"time: min": "tmin",
"time: sum": "tsum",
}
)
)
Mapper from sub-strings of cell methods to the temporal label
These are for the 'initial tests' i.e. the cell methods which are checked first. There is a coupling with dimensions in the logic in get_temporal_label, be careful!
TEMPORAL_LABEL_CELL_METHODS_TIME4_TESTS_MAPPER
module-attribute
#
TEMPORAL_LABEL_CELL_METHODS_TIME4_TESTS_MAPPER = (
CellMethodsSubStringMapper(
sub_string_map={
"time: max": "tmaxavg",
"time: min": "tminavg",
}
)
)
Mapper from sub-strings of cell methods to the temporal label for "time4" data
I.e. for data which has "time4" as a dimension
TEMPORAL_LABEL_DIMENSIONS_MAPPER
module-attribute
#
TEMPORAL_LABEL_DIMENSIONS_MAPPER = DimensionMapper(
dimension_map={
"time": "tavg",
"time1": "tpt",
"time2": "tclm",
"time3": "tclmdc",
}
)
Mapper from dimensions to the temporal label
get_temporal_label #
get_temporal_label(
cell_methods: str | None,
dimensions: tuple[str, ...],
cell_methods_initial_mapper: CellMethodsSubStringMapper = TEMPORAL_LABEL_CELL_METHODS_INITIAL_TESTS_MAPPER,
cell_methods_initial_required_dimension: str = "time",
dimensions_mapper: DimensionMapper = TEMPORAL_LABEL_DIMENSIONS_MAPPER,
cell_methods_time4_mapper: CellMethodsSubStringMapper = TEMPORAL_LABEL_CELL_METHODS_TIME4_TESTS_MAPPER,
fallback: str = "ti",
) -> str
Get temporal label
The logic this should follow is defined in Table F1 of Taylor et al.. This was last checked on June 14 2025. If updates have been made since, this code may be out of date with the underlying specification.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell_methods
|
str | None
|
Cell methods of the variable |
required |
dimensions
|
tuple[str, ...]
|
Dimensions of the variable |
required |
cell_methods_initial_mapper
|
CellMethodsSubStringMapper
|
Mapper to use to get values based on cell methods This is for the 'initial' tests i.e. checks of cell methods which are performed before any other checks. |
TEMPORAL_LABEL_CELL_METHODS_INITIAL_TESTS_MAPPER
|
cell_methods_initial_required_dimension
|
str
|
Dimension required for the result of using If this dimension is not found, then the other mapping checks are performed. |
'time'
|
dimensions_mapper
|
DimensionMapper
|
Mapper to use to get values based on dimensions If you include "time4" as a mapping here,
you can make a mess as you will effectively
disable any use of |
TEMPORAL_LABEL_DIMENSIONS_MAPPER
|
cell_methods_time4_mapper
|
CellMethodsSubStringMapper
|
Mapper to use to get values based on cell methods if "time4" is in dimensions |
TEMPORAL_LABEL_CELL_METHODS_TIME4_TESTS_MAPPER
|
fallback
|
str
|
Value to return if no other conditions are matched |
'ti'
|
Returns:
| Type | Description |
|---|---|
str
|
Temporal label to use for constructing the branded variable name |