Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 30 additions & 16 deletions src/metpy/calc/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@


@exporter.export
@preprocess_xarray
@wrap_output_like(argument='u')
@preprocess_xarray()
@check_units('[speed]', '[speed]')
def wind_speed(u, v):
r"""Compute the wind speed from u and v-components.
Expand All @@ -56,7 +57,8 @@ def wind_speed(u, v):


@exporter.export
@preprocess_xarray
@wrap_output_like(argument='u')
@preprocess_xarray()
@check_units('[speed]', '[speed]')
def wind_direction(u, v, convention='from'):
r"""Compute the wind direction from u and v-components.
Expand Down Expand Up @@ -108,7 +110,7 @@ def wind_direction(u, v, convention='from'):


@exporter.export
@preprocess_xarray
@preprocess_xarray()
@check_units('[speed]')
def wind_components(speed, wind_direction):
r"""Calculate the U, V wind vector components from the speed and direction.
Expand Down Expand Up @@ -147,7 +149,8 @@ def wind_components(speed, wind_direction):


@exporter.export
@preprocess_xarray
@wrap_output_like(argument='temperature')
@preprocess_xarray()
@check_units(temperature='[temperature]', speed='[speed]')
def windchill(temperature, speed, face_level_winds=False, mask_undefined=True):
r"""Calculate the Wind Chill Temperature Index (WCTI).
Expand Down Expand Up @@ -209,7 +212,8 @@ def windchill(temperature, speed, face_level_winds=False, mask_undefined=True):


@exporter.export
@preprocess_xarray
@wrap_output_like(argument='temperature')
@preprocess_xarray()
@check_units('[temperature]')
def heat_index(temperature, relative_humidity, mask_undefined=True):
r"""Calculate the Heat Index from the current temperature and relative humidity.
Expand Down Expand Up @@ -313,7 +317,8 @@ def heat_index(temperature, relative_humidity, mask_undefined=True):


@exporter.export
@preprocess_xarray
@wrap_output_like(argument='temperature')
@preprocess_xarray()
@check_units(temperature='[temperature]', speed='[speed]')
def apparent_temperature(temperature, relative_humidity, speed, face_level_winds=False,
mask_undefined=True):
Expand Down Expand Up @@ -392,7 +397,8 @@ def apparent_temperature(temperature, relative_humidity, speed, face_level_winds


@exporter.export
@preprocess_xarray
@wrap_output_like(argument='pressure')
@preprocess_xarray()
@check_units('[pressure]')
def pressure_to_height_std(pressure):
r"""Convert pressure data to height using the U.S. standard atmosphere [NOAA1976]_.
Expand Down Expand Up @@ -420,7 +426,8 @@ def pressure_to_height_std(pressure):


@exporter.export
@preprocess_xarray
@wrap_output_like(argument='height')
@preprocess_xarray()
@check_units('[length]')
def height_to_geopotential(height):
r"""Compute geopotential for a given height above sea level.
Expand Down Expand Up @@ -477,7 +484,8 @@ def height_to_geopotential(height):


@exporter.export
@preprocess_xarray
@wrap_output_like(argument='geopotential')
@preprocess_xarray()
def geopotential_to_height(geopotential):
r"""Compute height above sea level from a given geopotential.

Expand Down Expand Up @@ -537,7 +545,8 @@ def geopotential_to_height(geopotential):


@exporter.export
@preprocess_xarray
@wrap_output_like(argument='height')
@preprocess_xarray()
@check_units('[length]')
def height_to_pressure_std(height):
r"""Convert height data to pressures using the U.S. standard atmosphere [NOAA1976]_.
Expand All @@ -564,7 +573,8 @@ def height_to_pressure_std(height):


@exporter.export
@preprocess_xarray
@wrap_output_like(argument='latitude')
@preprocess_xarray()
def coriolis_parameter(latitude):
r"""Calculate the coriolis parameter at each point.

Expand All @@ -586,7 +596,8 @@ def coriolis_parameter(latitude):


@exporter.export
@preprocess_xarray
@wrap_output_like(argument='pressure')
@preprocess_xarray()
@check_units('[pressure]', '[length]')
def add_height_to_pressure(pressure, height):
r"""Calculate the pressure at a certain height above another pressure level.
Expand Down Expand Up @@ -615,7 +626,8 @@ def add_height_to_pressure(pressure, height):


@exporter.export
@preprocess_xarray
@wrap_output_like(argument='height')
@preprocess_xarray()
@check_units('[length]', '[pressure]')
def add_pressure_to_height(height, pressure):
r"""Calculate the height at a certain pressure above another height.
Expand Down Expand Up @@ -644,7 +656,7 @@ def add_pressure_to_height(height, pressure):


@exporter.export
@preprocess_xarray
@preprocess_xarray()
@check_units('[dimensionless]', '[pressure]', '[pressure]')
def sigma_to_pressure(sigma, pressure_sfc, pressure_top):
r"""Calculate pressure from sigma values.
Expand Down Expand Up @@ -1007,7 +1019,8 @@ def smooth_n_point(scalar_grid, n=5, passes=1):


@exporter.export
@preprocess_xarray
@wrap_output_like(argument='altimeter_value')
@preprocess_xarray()
@check_units('[pressure]', '[length]')
def altimeter_to_station_pressure(altimeter_value, height):
r"""Convert the altimeter measurement to station pressure.
Expand Down Expand Up @@ -1089,7 +1102,8 @@ def altimeter_to_station_pressure(altimeter_value, height):


@exporter.export
@preprocess_xarray
@wrap_output_like(argument='altimeter_value')
@preprocess_xarray()
@check_units('[pressure]', '[length]', '[temperature]')
def altimeter_to_sea_level_pressure(altimeter_value, height, temperature):
r"""Convert the altimeter setting to sea-level pressure.
Expand Down
14 changes: 7 additions & 7 deletions src/metpy/calc/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


@exporter.export
@preprocess_xarray
@preprocess_xarray()
@check_units('[pressure]', '[temperature]', bottom='[pressure]', top='[pressure]')
def precipitable_water(pressure, dewpoint, *, bottom=None, top=None):
r"""Calculate precipitable water through the depth of a sounding.
Expand Down Expand Up @@ -74,7 +74,7 @@ def precipitable_water(pressure, dewpoint, *, bottom=None, top=None):


@exporter.export
@preprocess_xarray
@preprocess_xarray()
@check_units('[pressure]')
def mean_pressure_weighted(pressure, *args, height=None, bottom=None, depth=None):
r"""Calculate pressure-weighted mean of an arbitrary variable through a layer.
Expand Down Expand Up @@ -123,7 +123,7 @@ def mean_pressure_weighted(pressure, *args, height=None, bottom=None, depth=None


@exporter.export
@preprocess_xarray
@preprocess_xarray()
@check_units('[pressure]', '[speed]', '[speed]', '[length]')
def bunkers_storm_motion(pressure, u, v, height):
r"""Calculate the Bunkers right-mover and left-mover storm motions and sfc-6km mean flow.
Expand Down Expand Up @@ -183,7 +183,7 @@ def bunkers_storm_motion(pressure, u, v, height):


@exporter.export
@preprocess_xarray
@preprocess_xarray()
@check_units('[pressure]', '[speed]', '[speed]')
def bulk_shear(pressure, u, v, height=None, bottom=None, depth=None):
r"""Calculate bulk shear through a layer.
Expand Down Expand Up @@ -226,7 +226,7 @@ def bulk_shear(pressure, u, v, height=None, bottom=None, depth=None):


@exporter.export
@preprocess_xarray
@preprocess_xarray()
@check_units('[energy] / [mass]', '[speed] * [speed]', '[speed]')
def supercell_composite(mucape, effective_storm_helicity, effective_shear):
r"""Calculate the supercell composite parameter.
Expand Down Expand Up @@ -268,7 +268,7 @@ def supercell_composite(mucape, effective_storm_helicity, effective_shear):


@exporter.export
@preprocess_xarray
@preprocess_xarray()
@check_units('[energy] / [mass]', '[length]', '[speed] * [speed]', '[speed]')
def significant_tornado(sbcape, surface_based_lcl_height, storm_helicity_1km, shear_6km):
r"""Calculate the significant tornado parameter (fixed layer).
Expand Down Expand Up @@ -322,7 +322,7 @@ def significant_tornado(sbcape, surface_based_lcl_height, storm_helicity_1km, sh


@exporter.export
@preprocess_xarray
@preprocess_xarray()
@check_units('[pressure]', '[speed]', '[speed]', '[length]', '[speed]', '[speed]')
def critical_angle(pressure, u, v, height, u_storm, v_storm):
r"""Calculate the critical angle.
Expand Down
Loading