gwexpy.interop.wrf_

Interoperability with wrf.getvar() output from wrf-python.

Functions

from_wrf_variable(cls, da, *[, ...])

Convert a wrf.getvar() xarray.DataArray to a ScalarField.

gwexpy.interop.wrf_.from_wrf_variable(cls: type, da: Any, *, vertical_dim: str | None = None, axis0_domain: Literal['time', 'frequency'] = 'time') ScalarField[source]

Convert a wrf.getvar() xarray.DataArray to a ScalarField.

WRF dimension names are mapped to GWexpy axes:

  • Time / time → axis0

  • west_east → axis1 (x)

  • south_north → axis2 (y)

  • bottom_top → axis3 (z)

2-D XLAT / XLONG coordinates are collapsed to 1-D when the grid is regular.

Parameters:
  • cls (type) – ScalarField class.

  • da (xarray.DataArray) – Output of wrf.getvar().

  • vertical_dim (str, optional) – Override the vertical dimension name. Auto-detected from bottom_top / bottom_top_stag when None.

  • axis0_domain ({"time", "frequency"}, default "time") – Physical domain of axis0.

Return type:

ScalarField