melodies_monet.util.metcalc

This file calculates a number of meteorological variables. For hydrometeorological variables, variables including dewpoint and relative humidity are not universally provided by the obs. For models, wind speed is usually not directly provided.

This script calculates all of them in one place.

Users can calculate variables directly from the observations by using the extra_calc dictionary. Potential temperature is the only variable with this supported capability.

See: control_aircraft_looping_AEROMMA_UFSAQM.yaml

Author: Liam Thompson

Functions

dewpoint(obj[, varmap, output_key])

Calculates dewpoint in K

ptemp(obj[, varmap, output_key])

Calculates potential temperature in K

relh(obj[, varmap, output_key])

Calculates Relative Humidity in %

wdir(obj[, varmap, output_key])

Calculates wind direction in degrees

wspd(obj[, varmap, output_key])

Calculates windspeed in m/s

melodies_monet.util.metcalc.dewpoint(obj, varmap=None, output_key='dewpoint')

Calculates dewpoint in K

Parameters:
  • obj (xarray dataset) – Model/obs data

  • varmap (dictionary) – Dictionary defining the data column names to use Please provide variable names for “pres_calc” in Pa and “specific_hum” in kg/kg

  • output_key (string) – String to name the new dewpoint ouput

Returns:

xarray dataset – Xarray dataset with applied calculation as a new data array

melodies_monet.util.metcalc.ptemp(obj, varmap=None, output_key='ptemp')

Calculates potential temperature in K

Parameters:
  • obj (xarray dataset) – Model/obs data

  • varmap (dictionary) – Dictionary defining the data column names to use Please provide variable names for “pres_calc” in Pa, “temp_calc” in K

  • output_key (string) – String to name the new potential temperature ouput

Returns:

xarray dataset – Xarray dataset with applied calculation as a new data array

melodies_monet.util.metcalc.relh(obj, varmap=None, output_key='rel_hum')

Calculates Relative Humidity in %

Parameters:
  • obj (xarray dataset) – Model/obs data

  • varmap (dictionary) – Dictionary defining the data column names to use Please provide variable names for “pres_calc” in Pa, “temp_calc” in K, “specific_hum” in kg/kg

  • output_key (string) – String to name the new relative humidity ouput

Returns:

xarray dataset – Xarray dataset with applied calculation as a new data array

melodies_monet.util.metcalc.wdir(obj, varmap=None, output_key='winddir')

Calculates wind direction in degrees

Parameters:
  • obj (xarray dataset) – Model/obs data

  • varmap (dictionary) – Dictionary defining the data column names to use Please provide variable names for “u_comp” in m/s, “v_comp” in m/s

  • output_key (string) – String to name the new wind direction ouput

Returns:

xarray dataset – Xarray dataset with applied calculation as a new data array

melodies_monet.util.metcalc.wspd(obj, varmap=None, output_key='windspeed')

Calculates windspeed in m/s

Parameters:
  • obj (xarray dataset) – Model/obs data

  • varmap (dictionary) – Dictionary defining the data column names to use Please provide variable names for “u_comp” in m/s, “v_comp” in m/s

  • output_key (string) – String to name the new windspeed ouput

Returns:

xarray dataset – Xarray dataset with applied calculation as a new data array