Internal API

Routines

Extraction and Diagnostic Routines

The routines below are called internally by wrf.getvar().

wrf.g_cape.get_2dcape Return the two-dimensional fields of MCAPE, MCIN, LCL, and LFC.
wrf.g_cape.get_3dcape Return the three-dimensional CAPE and CIN.
wrf.g_cloudfrac.get_cloudfrac Return the cloud fraction for low, mid, and high level clouds.
wrf.g_ctt.get_ctt Return the cloud top temperature.
wrf.g_dbz.get_dbz Return the simulated radar reflectivity.
wrf.g_dbz.get_max_dbz Return the maximum simulated radar reflectivity.
wrf.g_dewpoint.get_dp Return the dewpoint temperature.
wrf.g_dewpoint.get_dp_2m Return the 2m dewpoint temperature.
wrf.g_geoht.get_geopt Return the geopotential.
wrf.g_geoht.get_height Return the geopotential height.
wrf.g_helicity.get_srh Return the storm relative helicity.
wrf.g_helicity.get_uh Return the updraft helicity.
wrf.g_omega.get_omega Return Omega.
wrf.g_pressure.get_pressure Return the pressure in the specified units.
wrf.g_pressure.get_pressure_hpa Return the pressure in [hPa].
wrf.g_pw.get_pw Return the preciptiable water.
wrf.g_rh.get_rh Return the relative humidity.
wrf.g_rh.get_rh_2m Return the 2m relative humidity.
wrf.g_slp.get_slp Return the sea level pressure in the specified units.
wrf.g_temp.get_theta Return the potential temperature.
wrf.g_temp.get_temp Return the temperature in the specified units.
wrf.g_temp.get_eth Return the equivalent potential temperature.
wrf.g_temp.get_tv Return the virtual temperature.
wrf.g_temp.get_tw Return the wetbulb temperature.
wrf.g_temp.get_tk Return the temperature in [K].
wrf.g_temp.get_tc Return the temperature in [degC].
wrf.g_terrain.get_terrain Return the terrain height in the specified units.
wrf.g_times.get_times Return a sequence of time objects.
wrf.g_times.get_xtimes Return a sequence of time objects.
wrf.g_uvmet.get_uvmet Return the u,v wind components rotated to earth coordinates.
wrf.g_uvmet.get_uvmet10 Return the u,v components for the 10m winds rotated to earth coordinates.
wrf.g_uvmet.get_uvmet_wspd_wdir Return the wind speed and wind direction for the wind rotated to earth coordinates.
wrf.g_uvmet.get_uvmet10_wspd_wdir Return the wind speed and wind direction for the 10m wind rotated to earth coordinates.
wrf.g_vorticity.get_avo Return the absolute vorticity.
wrf.g_vorticity.get_pvo Return the potential vorticity.
wrf.g_wind.get_u_destag Return the u-component of the wind on mass points.
wrf.g_wind.get_v_destag Return the v-component of the wind on mass points.
wrf.g_wind.get_w_destag Return the w-component of the wind on mass points.
wrf.g_wind.get_destag_wspd_wdir Return the wind speed and wind direction for the wind in the projected coordinate (i.e.
wrf.g_wind.get_destag_wspd_wdir10 Return the wind speed and wind direction for the 10m wind in projected coordinate (i.e.
wrf.g_wind.get_destag_wspd Return the wind speed in the projected coordinate (i.e.
wrf.g_wind.get_destag_wdir Return the wind direction in the projected coordinate (i.e.
wrf.g_wind.get_destag_wspd10 Return the wind speed for the 10m wind in projected coordinate (i.e.
wrf.g_wind.get_destag_wdir10 Return the wind direction for the 10m wind in projected coordinate (i.e.
wrf.g_uvmet.get_uvmet_wspd Return the wind speed for the wind rotated to earth coordinates.
wrf.g_uvmet.get_uvmet_wdir Return the wind direction for the wind rotated to earth coordinates.
wrf.g_uvmet.get_uvmet10_wspd Return the wind speed for the 10m wind rotated to earth coordinates.
wrf.g_uvmet.get_uvmet10_wdir Return the wind direction for the 10m wind rotated to earth coordinates.
wrf.g_cloudfrac.get_low_cloudfrac Return the cloud fraction for the low level clouds.
wrf.g_cloudfrac.get_mid_cloudfrac Return the cloud fraction for the mid level clouds.
wrf.g_cloudfrac.get_high_cloudfrac Return the cloud fraction for the high level clouds.
wrf.g_cape.get_cape2d_only Return the two-dimensional field of MCAPE (Max Convective Available Potential Energy).
wrf.g_cape.get_cin2d_only Return the two-dimensional field of MCIN (Max Convective Inhibition).
wrf.g_cape.get_lcl Return the two-dimensional field of LCL (Lifted Condensation Level).
wrf.g_cape.get_lfc Return the two-dimensional field of LFC (Level of Free Convection).
wrf.g_cape.get_3dcape_only Return the three-dimensional field of CAPE (Convective Available Potential Energy).
wrf.g_cape.get_3dcin_only Return the three-dimensional field of CIN (Convective Inhibition).

Decorators

Algorithm Decorators

The decorators below are used for performing common operations related to diagnostic and interpolation calculations.

wrf.decorators.convert_units A decorator that converts the units from the wrapped function’s output.
wrf.decorators.left_iteration A decorator to handle iterating over the leftmost dimensions.
wrf.decorators.cast_type A decorator to handle type casting.
wrf.decorators.extract_and_transpose A decorator to extract the data array from a xarray.DataArray
wrf.decorators.check_args A decorator to check that the wrapped function’s arguments are valid.
wrf.specialdec.uvmet_left_iter A decorator to handle iterating over the leftmost dimensions for the uvmet diagnostic.
wrf.specialdec.cape_left_iter A decorator to handle iterating over the leftmost dimensions for the cape diagnostic.
wrf.specialdec.cloudfrac_left_iter A decorator to handle iterating over the leftmost dimensions for the cloud fraction diagnostic.

Metadata Decorators

The decorators below are used for performing common operations related to setting metadata.

wrf.metadecorators.copy_and_set_metadata A decorator that sets the metadata for a wrapped function’s output.
wrf.metadecorators.set_wind_metadata A decorator that sets the metadata for a wrapped wind function’s output.
wrf.metadecorators.set_cape_metadata A decorator that sets the metadata for a wrapped CAPE function’s output.
wrf.metadecorators.set_cloudfrac_metadata A decorator that sets the metadata for a wrapped cloud fraction function’s output.
wrf.metadecorators.set_latlon_metadata A decorator that sets the metadata for a wrapped latlon function’s output.
wrf.metadecorators.set_height_metadata A decorator that sets the metadata for a wrapped height function’s output.
wrf.metadecorators.set_interp_metadata A decorator that sets the metadata for a wrapped interpolation function.
wrf.metadecorators.set_alg_metadata A decorator that sets the metadata for a wrapped raw diagnostic function.
wrf.metadecorators.set_uvmet_alg_metadata A decorator that sets the metadata for the wrapped raw UVMET diagnostic function.
wrf.metadecorators.set_cape_alg_metadata A decorator that sets the metadata for the wrapped raw CAPE diagnostic function.
wrf.metadecorators.set_cloudfrac_alg_metadata A decorator that sets the metadata for the wrapped raw cloud fraction diagnostic function.
wrf.metadecorators.set_destag_metadata A decorator that sets the metadata for the wrapped raw destaggering function.

Decorator Utilities

The routines below are used within the decorators.

wrf.either A callable class that determines which variable is present in the file.
wrf.combine_dims A callable class that mixes dimension sizes from different function arguments.
wrf.from_var A callable class that retrieves attributes from the function argument.
wrf.from_args Return a mapping of argument name to value for the called function.
wrf.args_to_list Return all of the function arguments, including defaults, as a list.
wrf.arg_location Return the function arguments as a single list along with the index within that list for a specified argument name.

Classes

Iterable Wrapper Class

The class below is an Iterable wrapper class and provides an __iter__ function that always returns the beginning of the sequence, regardless of the Iterable type.

wrf.IterWrapper A wrapper class for generators and custom iterable classes that returns a new iterator to the start of the sequence when IterWrapper.__iter__() is called.