climakitae.tools package#

Submodules#

climakitae.tools.batch module#

climakitae.tools.batch.batch_select(approach: str, selections: DataParameters, points: ndarray, load_data: bool = False, progress_bar: bool = True) DataArray#

Conducts batch mode analysis on a series of points for a given metric.

Parameters:
  • approach (str)

  • selections (DataParameters) – Selections object that describes the area of interest. The area_subset and cached_area attributes are automatically overwritten.

  • points (np.ndarray) – An array at lat/lon points to gather the specified data at.

  • load_data (boolean) – A boolean that tells the function whether or not to load the data into memory.

  • progress_bar (boolean) – A boolean that determines whether progress bar is displayed.

Returns:

cells_of_interest (DataArray) – Gridcells that the points lie within, aggregated together into one DataArray. It can or cannot be loaded into memory, depending on load_data.

climakitae.tools.derived_variables module#

Functions for deriving frequently used variables

climakitae.tools.derived_variables.compute_dewpointtemp(temperature: DataArray, rel_hum: DataArray) DataArray#

Calculate dew point temperature

Parameters:
  • temperature (DataArray) – Temperature in Kelvin (K)

  • rel_hum (DataArray) – Relative humidity (0-100 scale)

Returns:

dew_point (DataArray) – Dew point (K)

climakitae.tools.derived_variables.compute_hdd_cdd(t2: DataArray, hdd_threshold: int, cdd_threshold: int) tuple[DataArray, DataArray]#

Compute heating degree days (HDD) and cooling degree days (CDD)

Parameters:
  • t2 (DataArray) – Air temperature at 2m gridded data

  • hdd_threshold (int, optional) – Standard temperature in Fahrenheit.

  • cdd_threshold (int, optional) – Standard temperature in Fahrenheit.

Returns:

tuple of DataArray – (hdd, cdd)

climakitae.tools.derived_variables.compute_hdh_cdh(t2: DataArray, hdh_threshold: int, cdh_threshold: int) tuple[DataArray, DataArray]#

Compute heating degree hours (HDH) and cooling degree hours (CDH)

Parameters:
  • t2 (DataArray) – Air temperature at 2m gridded data

  • hdh_threshold (int, optional) – Standard temperature in Fahrenheit.

  • cdh_threshold (int, optional) – Standard temperature in Fahrenheit.

Returns:

tuple of DataArray – (hdh, cdh)

climakitae.tools.derived_variables.compute_relative_humidity(pressure: DataArray, temperature: DataArray, mixing_ratio: DataArray, name: str = 'rh_derived') DataArray#

Compute relative humidity. Variable attributes need to be assigned outside of this function because the metpy function removes them

Parameters:
  • pressure (DataArray) – Pressure in hPa

  • temperature (DataArray) – Temperature in Celsius

  • mixing_ratio (DataArray) – Dimensionless mass mixing ratio in g/kg

  • name (str, optional) – Name to assign to output DataArray

Returns:

rel_hum (DataArray) – Relative humidity

Source: https://www.weather.gov/media/epz/wxcalc/mixingRatio.pdf

climakitae.tools.derived_variables.compute_specific_humidity(tdps: DataArray, pressure: DataArray, name: str = 'q2_derived') DataArray#

Compute specific humidity.

Parameters:
  • tdps (DataArray) – Dew-point temperature, in K

  • pressure (DataArray) – Air pressure, in Pascals

  • name (str, optional) – Name to assign to output DataArray

Returns:

spec_hum (DataArray) – Specific humidity

climakitae.tools.derived_variables.compute_wind_dir(u10: DataArray, v10: DataArray, name: str = 'wind_direction_derived') DataArray#

Compute wind direction at 10 meters

Parameters:
  • u10 (DataArray) – Zonal velocity at 10 meters height in m/s

  • v10 (DataArray) – Meridional velocity at 10 meters height in m/s

  • name (str, optional) – Name to assign to output DataArray

Returns:

wind_dir (DataArray) – Wind direction, in [0, 360] degrees, with 0/360 defined as north, by meteorological convention

Notes

source: https://sites.google.com/view/raybellwaves/cheat-sheets/xarray

climakitae.tools.derived_variables.compute_wind_mag(u10: DataArray, v10: DataArray, name: str = 'wind_speed_derived') DataArray#

Compute wind magnitude at 10 meters

Parameters:
  • u10 (DataArray) – Zonal velocity at 10 meters height in m/s

  • v10 (DataArray) – Meridonal velocity at 10 meters height in m/s

  • name (str, optional) – Name to assign to output DataArray

Returns:

wind_mag (DataArray) – Wind magnitude

climakitae.tools.indices module#

Functions for deriving indices

climakitae.tools.indices.effective_temp(T: DataArray) DataArray#

Compute effective temperature Effective Temp = (1/2)*(yesterday’s effective temp) + (1/2)*(today’s actual temp) To make sense of the expansion, today’s ET is consist of a portion of the actual temperature of each day up to today–half of today’s temp, 1/4 of yesterday’s temp, 1/8 of the day before yesterday’s temp etc, thus it’s “an exponentially smoothed temperature” as stated in the glossary of the reference. This derivation only considers 4 days of temperature data in the computation of EFT: today, yesterday, the day before yesterday, and two days before yesterday. Thus, the first 3 timesteps of the EFT will be NaN.

Parameters:

T (DataArray) – Daily air temperature in any units

Returns:

eft (DataArray) – Effective temperature

References

https://www.nationalgas.com/document/132516/download

climakitae.tools.indices.fosberg_fire_index(t2_F: DataArray, rh_percent: DataArray, windspeed_mph: DataArray) DataArray#

Compute the Fosberg Fire Weather Index. Use hourly weather as inputs. Ensure that the input variables are in the correct units (see below).

Parameters:
  • t2_F (DataArray) – Air temperature in units of Fahrenheit

  • rh_percent (DataArray) – Relative humidity in units of 0-100 (percent)

  • windspeed_mph (DataArray) – Windspeed in units of miles per hour

Returns:

FFWI (DataArray) – Fosberg Fire Weather Index computed for each grid cell

References

https://a.atmos.washington.edu/wrfrt/descript/definitions/fosbergindex.html sharppy/SHARPpy https://www.spc.noaa.gov/exper/firecomp/INFO/fosbinfo.html

climakitae.tools.indices.noaa_heat_index(T: DataArray, RH: DataArray) DataArray#

Compute the NOAA Heat Index. Heat Index quantifies the perceived “real feel” of air temperature on the human body, including the impact of humidity. See references for more information on this derived variable.

Parameters:
  • T (DataArray) – Temperature in deg F

  • RH (DataArray) – Relative Humidity in percentage (0-100)

Returns:

HI (DataArray) – Heat index per timestep

References

NOAA: https://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml NCAR NCL documentation: https://www.ncl.ucar.edu/Document/Functions/Heat_stress/heat_index_nws.shtml

Module contents#