Skip to content

Diagnosing variables

Thomas Nipen edited this page Oct 16, 2022 · 15 revisions

Gridpp has convenience functions for converting between related weather variables. The functions have both scalar and vector versions.

Humidity

There are several humidity variables: dewpoint temperature, relative humidity, and wetbulb temperature. These can be diagnosed from each other in combination with temperature (and pressure for wetbulb):

temperature = 278 # K
dewpoint = 275 # K
rh = 0.9 # fraction
pressure = 101325 # pa
value = gridpp.dewpoint(temperature, rh)
value = gridpp.relative_humidity(temperature, dewpoint)
value = gridpp.wetbulb(temperature, pressure, rh)

Wind

Gridpp can convert from x and y components to wind_speed (in the future between direction as well):

x = 10
y = 5
wind_speed = gridpp.wind_speed(x, y)

Pressure

To compute the pressure at a specific altitude, use:

pressure = 90000   # pa
altitude = 1000    # m
new_altitude = 100 # m
temperature = 273  # K
new_pressure = gridpp.pressure(altitude, new_altitude, pressure, temperature)

A convenience function can do the same calculation for sea_level:

pressure = 90000  # pa
altitude = 1000   # m
temperature = 273 # K
rh = 0.7          # 1
sea_level_pressure = gridpp.sea_level_pressure(pressure, altitude, temperature, rh)

Aviation

To compute QNH from surface pressure and altitude:

pressure = 90000  # pa
altitude = 1000   # m
qnh = gridpp.qnh(pressure, altitude)
Clone this wiki locally