Parameter component¶
Every Field carries a parameter component that describes
the physical quantity the field represents. The parameter component is accessible via the
parameter attribute of a field and is represented by a subclass of
ParameterBase.
>>> import earthkit.data as ekd
>>> field = ekd.from_source("sample", "test.grib").to_fieldlist()[0]
>>> field.parameter.variable()
'2t'
>>> field.parameter.units()
K
>>> field.parameter.standard_name()
'2_metre_temperature'
The same information is available through the generic get()
interface using the "parameter." prefix:
>>> field.get("parameter.variable")
'2t'
>>> field.get("parameter.units")
K
The parameter component is immutable. Use the
set() method (or
set() on the field) to derive a modified copy:
>>> new_field = field.set({"parameter.variable": "msl", "parameter.units": "Pa"})
>>> new_field.parameter.variable()
'msl'
Parameter types¶
The appropriate parameter subclass is determined automatically from the data:
Parameter— standard meteorological parameter with a variable name and units.ChemicalParameter— parameter that also carries a chemical constituent or aerosol type (chem/chem_long_namekeys).OpticalParameter— parameter defined at a specific wavelength (wavelength,wavelength_bounds,wavelength_unitskeys).ChemicalOpticalParameter— combines both chemical and optical information.WaveSpectraParameter— 2-D wave spectra parameter carrying direction and frequency bins (wave_direction*andwave_frequency*keys).
Accessing parameter information¶
All parameter keys are accessible through get() with the
"parameter." prefix, and can therefore be used in
sel(),
order_by(), and
metadata().
Key |
Description |
|---|---|
|
Parameter variable name as a string (e.g. |
|
Alias of |
|
CF standard name of the parameter variable. |
|
CF long name of the parameter variable. |
|
Units of the parameter as a |
|
Chemical constituent or aerosol type, or |
|
Long name of the chemical constituent or aerosol type, or |
|
Central wavelength for optical parameters, or |
|
Wavelength bounds as a 2-tuple for optical parameters, or |
|
Units of the wavelength (e.g. nanometres), or |
|
Wave propagation direction for 2-D wave spectra parameters, or |
|
0-based index of the wave direction bin, or |
|
Direction bounds as a 2-tuple, or |
|
Units of the wave direction (e.g. degrees), or |
|
Wave frequency for 2-D wave spectra parameters, or |
|
0-based index of the wave frequency bin, or |
|
Frequency bounds as a 2-tuple, or |
|
Units of the wave frequency (e.g. 1/s), or |