Vertical component¶
Every Field carries a vertical component that describes
where in the atmosphere, ocean, or land the field is defined. The vertical component is accessible
via the vertical attribute of a field and is represented by a
Vertical object (or its parametric subclass
for hybrid levels).
>>> import earthkit.data as ekd
>>> field = ekd.from_source("sample", "tuv_pl.grib").to_fieldlist()[0]
>>> field.vertical.level()
1000
>>> field.vertical.level_type()
'pressure'
>>> field.vertical.units()
hPa
>>> field.vertical.positive()
'down'
The same information is available through the generic get()
interface using the "vertical." prefix:
>>> field.get("vertical.level")
1000
>>> field.get("vertical.level_type")
'pressure'
The vertical component is immutable. Use the set()
method (or set() on the field) to derive a modified copy:
>>> new_field = field.set({"vertical.level": 500})
>>> new_field.vertical.level()
500
Level types¶
The level type classifies the nature of the vertical coordinate. It is represented by a
LevelType object, which carries the
following metadata:
name – canonical identifier used throughout earthkit-data (e.g.
"pressure")abbreviation – short label (e.g.
"pl")standard_name – CF standard name (e.g.
"air_pressure")long_name – human-readable description
units – native units of the level value
layer –
Truewhen the type represents a layer (two bounding levels) rather than a single levellevel – indicates which bound is the representative level for layer types:
"top","bottom", or empty string when undefinedpositive – vertical direction in which values increase:
"up","down", or empty string when undefined
When earthkit-data encounters a level type that is not in the predefined list below, it is automatically registered at runtime so that arbitrary model-specific level types are handled transparently.
Predefined level types¶
Name |
CF standard name |
Long name |
Abbreviation |
Units |
Layer |
Level |
Positive |
|---|---|---|---|---|---|---|---|
|
abstract_single_level |
abstract single level |
|
No |
|||
|
cloud_base |
cloud base |
|
No |
|||
|
depth |
soil depth |
|
m |
Yes |
top |
down |
|
depth |
soil depth |
|
m |
No |
down |
|
|
depth |
depth |
|
m |
Yes |
top |
down |
|
entire_atmosphere |
entire atmosphere |
|
No |
|||
|
entire_lake |
entire lake |
|
No |
|||
|
entire_melt_pond |
entire melt pond |
|
No |
|||
|
general |
general |
|
1 |
No |
down |
|
|
height |
height above the surface |
|
m |
No |
up |
|
|
height_above_mean_sea_level |
height above mean sea level |
|
m |
No |
up |
|
|
high_cloud_layer |
high cloud layer |
|
hPa |
Yes |
top |
|
|
atmosphere_hybrid_sigma_pressure_coordinate |
hybrid level |
|
1 |
No (parametric) |
down |
|
|
ice_layer_on_water |
ice layer on water |
|
1 |
Yes |
top |
up |
|
ice_top_on_water |
ice top on water |
|
1 |
No |
||
|
lake_bottom |
lake bottom |
|
1 |
No |
||
|
low_cloud_layer |
low cloud layer |
|
hPa |
Yes |
top |
|
|
mean_sea |
mean sea level |
|
No |
|||
|
medium_cloud_layer |
medium cloud layer |
|
hPa |
Yes |
top |
|
|
mixed_layer_depth_by_density |
mixed layer depth by density |
|
m |
No |
down |
|
|
mixed_layer_parcel |
mixed layer parcel |
|
Pa |
No |
||
|
mixing_layer |
mixing layer |
|
No |
|||
|
most_unstable_parcel |
most unstable parcel |
|
No |
|||
|
nominal_top_of_atmosphere |
nominal top of atmosphere |
|
No |
|||
|
ocean_model |
ocean model |
|
1 |
No |
down |
|
|
ocean_model_layer |
ocean model layer |
|
1 |
Yes |
bottom |
down |
|
ocean_surface |
ocean surface |
|
No |
|||
|
ocean_surface_to_bottom |
ocean surface to bottom |
|
1 |
No |
||
|
air_potential_temperature |
air potential temperature |
|
K |
No |
up |
|
|
ertel_potential_vorticity |
potential vorticity |
|
10E-9 K m2 kg-1 s-1 |
No |
down |
|
|
air_pressure |
pressure |
|
hPa |
No |
down |
|
|
air_pressure |
pressure |
|
hPa |
Yes |
top |
down |
|
sea_ice_layer |
sea ice layer |
|
1 |
Yes |
bottom |
down |
|
unknown |
snow layer |
|
1 |
Yes |
bottom |
down |
|
snow_layer_over_ice_on_water |
snow layer over ice on water |
|
1 |
No |
||
|
soil_layer |
soil layer |
|
1 |
Yes |
bottom |
down |
|
stratosphere |
stratosphere |
|
1 |
No |
||
|
surface |
surface |
|
No |
|||
|
temperature |
temperature |
|
K |
No |
||
|
tropopause |
tropopause |
|
No |
|||
|
troposphere |
troposphere |
|
1 |
No |
||
|
unknown |
unknown |
|
No |
|||
|
water_surface_to_isothermal_ocean_layer |
water surface to isothermal ocean layer |
|
1 |
No |
Layers¶
When layer is True, the vertical component stores two bounding level values rather than a
single value. The level attribute (and the "vertical.level" key) returns the representative
scalar level, derived from either the top or the bottom bound depending on the Level column in the
table above. The full pair of bounds is available via
layer().
Parametric levels¶
The hybrid level type is parametric: the actual pressure at any grid point must be computed
from a set of coefficients (A and B) together with the surface pressure field. For hybrid
levels the vertical component exposes the following additional methods:
coefficients()– theAandBcoefficient arrayscoefficient_names()– the names of the coefficients (("A", "B"))number_of_levels()– total number of model levels
Accessing vertical information¶
All vertical keys are accessible through get() with the
"vertical." prefix, and can therefore be used in sel(),
order_by(), and
metadata().
Supported keys:
Key |
Description |
|---|---|
|
Scalar level value in the native units of the level type |
|
Level type name as a string (e.g. |
|
Layer bounds as a |
|
Abbreviation of the level type (e.g. |
|
Units of the level value |
|
Positive direction of the coordinate ( |
|
Dictionary of CF metadata ( |
|
|
|
Coefficient arrays for parametric level types, |
|
Names of the coefficients for parametric level types, |
|
Number of model levels for parametric level types, |