gcages.renaming#
Renaming between naming conventions
At present, the naming convention for both sides is implicit. We are considering adding the concept of controlled vocabularies to help clarify this, but have not done so yet.
Classes:
| Name | Description |
|---|---|
SupportedNamingConventions |
Supported naming conventions |
Functions:
| Name | Description |
|---|---|
convert_variable_name |
Convert a variable name to another naming convention |
rename_variables |
Rename variables |
SupportedNamingConventions #
Bases: StrEnum
Supported naming conventions
Attributes:
| Name | Type | Description |
|---|---|---|
AR6_CFC_INFILLING_DB |
The naming convention used in AR6's CFC infilling database |
|
CMIP7_SCENARIOMIP |
The naming convention used during preparation of ScenarioMIP for CMIP7 |
|
GCAGES |
This package's naming convention |
|
IAMC |
Integrated Assessment Modelling Consortium (IAMC) naming convention |
|
OPENSCM_RUNNER |
OpenSCM-Runner naminv convention |
|
RCMIP |
Reduced Complexity Model Intercomparison Project (RCMIP) naming convention |
Source code in src/gcages/renaming.py
AR6_CFC_INFILLING_DB
class-attribute
instance-attribute
#
The naming convention used in AR6's CFC infilling database
Somehow this ended up being different to all the other conventions.
CMIP7_SCENARIOMIP
class-attribute
instance-attribute
#
The naming convention used during preparation of ScenarioMIP for CMIP7
IAMC
class-attribute
instance-attribute
#
Integrated Assessment Modelling Consortium (IAMC) naming convention
Not a perfect definition so the implementation here is a bit of a guess based on experience. https://github.com/IAMconsortium/common-definitions is a better source of truth, but it also moves more quickly, is not used universally and covers many more variables than we care about within the gcages context.
OPENSCM_RUNNER
class-attribute
instance-attribute
#
OpenSCM-Runner naminv convention
Used by the package which actually runs simple climate models (SCMs), see https://github.com/openscm/openscm-runner
RCMIP
class-attribute
instance-attribute
#
Reduced Complexity Model Intercomparison Project (RCMIP) naming convention
See rcmip.org and e.g.
- https://rcmip-protocols-au.s3-ap-southeast-2.amazonaws.com/v5.1.0/rcmip-emissions-annual-means-v5-1-0.csv
- https://rcmip-protocols-au.s3-ap-southeast-2.amazonaws.com/v5.1.0/rcmip-concentrations-annual-means-v5-1-0.csv
- https://rcmip-protocols-au.s3-ap-southeast-2.amazonaws.com/v5.1.0/rcmip-radiative-forcing-annual-means-v5-1-0.csv
convert_variable_name #
convert_variable_name(
variable_in: str,
from_convention: SupportedNamingConventions,
to_convention: SupportedNamingConventions,
database: DataFrame = EMISSIONS_VARIABLES,
) -> str
Convert a variable name to another naming convention
Parameters#
variable_in Variable name to convert
from_convention Convention to convert from
to_convention Convention to convert to
database Database to use for the conversions
Returns#
: Converted variable name
Raises#
UnrecognisedValueError
variable_in is not a recognised value in from_convention
Source code in src/gcages/renaming.py
rename_variables #
rename_variables(
pandas_obj: P,
from_convention: SupportedNamingConventions,
to_convention: SupportedNamingConventions,
index_level: str = "variable",
copy: bool = True,
) -> P
Rename variables
This is just a convenience function that provides a slightly simpler, if less flexible interface than using convert_variable_name directly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pandas_obj
|
P
|
Pandas object in which to rename variables |
required |
from_convention
|
SupportedNamingConventions
|
Naming convention to convert from |
required |
to_convention
|
SupportedNamingConventions
|
Naming convention to convert to |
required |
index_level
|
str
|
Index level in which variable information is stored in |
'variable'
|
copy
|
bool
|
If |
True
|
Returns:
| Type | Description |
|---|---|
P
|
|