arlmet.WrfAxis#

class arlmet.WrfAxis(levels, *, offset=0.0)[source]#

Bases: VerticalAxis

Flag=5. WRF hybrid sigma-pressure levels, as HYSPLIT’s arw2arl writes them.

arw2arl writes flag 5 for a WRF run with hybrid_opt=2 (flag 1 otherwise). The stored levels are WRF’s eta on the mass levels (ZNU), bottom up, with 1.0 for the surface, and offset is WRF’s model-top pressure P_TOP [hPa].

Eta alone does not give pressure on hybrid levels: that also takes WRF’s hybrid coefficients, which arw2arl writes to a separate text file (hybrid_wrfvcoords.txt), not to the ARL file. So pressure is the PRES field, as in HYSPLIT’s prfwrf, and heights are found as for a sigma file with PRES, by HYSPLIT’s prfsig, which HYSPLIT uses for a flag-5 file when it does not have the coefficients: hypsometric from the ground (PRSS) up through PRES, the first layer with the mean of the ground temperature and the first level’s.

Examples

>>> import numpy as np
>>> from arlmet import WrfAxis
>>> axis = WrfAxis(levels=[1.0, 0.995, 0.98], offset=50.0)
>>> z = axis.to_height_agl(
...     surface_pressure=850.0,
...     temperature=np.array([285.0, 284.0]),
...     pressure=np.array([845.0, 832.0]),
... )
>>> np.round(z, 1)
array([ 49.3, 178.4])

Methods

to_height_agl(*[, surface_pressure, ...])

Height AGL [m] by hypsometric integration of pressure (PRES) from surface_pressure with temperature.

to_pressure(*[, surface_pressure])

Raise ValueError: WRF hybrid levels need the PRES field for pressure.

Inherited

From VerticalAxis: from_flag