General Information¶
Interfaces¶
All submodules have both an xarray and a numpy interface. The numpy interface wraps the underlying C-extensions closely. The xarray interface wraps the numpy interface, handles coordinates automatically and is dask-compatible. It is highly recommended to use the xarray-based functions.
Coordinates and Units¶
Input data must be provided on a regular longitude-latitude grid. Grid spacing is generally allowed to differ between the longitude and latitude dimensions but must be equally spaced within each dimension. E.g., a grid with resolution 1°×2° should work, but a Gaussian grid will not.
Latitude coordinates must start in the north. The North Pole is located at +90°, the South Pole at -90°.
Vertical coordinates must be specified top-down if the vertical coordinate is a core dimension. For a pressure coordinate that means values must be increasing (ascending order), for an isentropic coordinate values must be decreasing (descending order).
The following names for data coordinates are recognized by the xarray interface:
Name |
Description |
Unit |
Notes |
Override |
---|---|---|---|---|
|
latitude |
° |
N to S |
|
|
longitude |
° |
|
|
|
pressure (isobaric levels) |
hPa |
ascending if core dim |
|
|
potential temperature (isentropic levels) |
K |
descending if core dim |
|
The following names for data fields are recognized by the xarray interface:
Name |
Description |
Unit |
Notes |
Override |
---|---|---|---|---|
|
zonal wind |
m/s |
positive towards east |
|
|
meridional wind |
m/s |
positive towards north |
|
|
temperature |
K |
|
|
|
pressure |
hPa |
|
|
|
potential temperature |
K |
|
|
|
isentropic density |
kg/K/m² |
|
|
|
relative vorticity |
1/s |
|
|
|
absolute vorticity |
1/s |
|
|
|
Ertel potential vorticity |
PVU |
|
|
|
stationary wavenumber |
unitless |
|
Overrides can be provided for nonconforming data in any function of the xarray interface that accepts a names argument.
E.g., if a pressure coordinate is called isobaricInhPa
instead of level
, use an override (based on the override name from the tables above):
>>> rwguide.xarray.pvgradient.potential_temperature_isob(..., names={ "isob": "isobaricInhPa" })
Vectorization¶
Many functions offer to use the vectorization of xarray.apply_ufunc()
.
This vectorization mode can be slower than the vectorization built into the C-extensions but often uses much less memory.