dapper.elm package

Submodules

dapper.elm.utils module

dapper module: elm.utils.

dapper.elm.utils.compute_humidities(temp, dewpoint_temp, surf_pressure)[source]

Ported by JPS from code written by Ryan Crumley. temp - (np.array) - array of air temperature values (temperature_2m) dewpoint_temp : (np.array) - array of dewpoint temperature values (dewpoint_temperature_2m); must be same length as temp

Returns:

RH - relative humidity (%) Q - specific humidity (kg/kg)

dapper.elm.utils.compute_specific_humidity_from_rh(temp_c, rh_percent, surf_pressure_pa)[source]
Compute specific humidity (kg/kg) from:

temp_c : air temperature in °C rh_percent : relative humidity in % surf_pressure_pa : surface pressure in Pa

dapper.elm.utils.elm_data_dicts()[source]

Defines some dictionaries for ELM-expected variables.

dapper.elm.utils.elm_var_packing_params(elm_var, data=[], dtype=<class 'numpy.int16'>)[source]

Compute robust offset and scale factor for BYPASS packing. Uses preset range if data is empty, else uses robust data quantiles. dtype can be np.int16, np.int32, np.uint16, etc.

dapper.elm.utils.gen_zone_mappings(domain_or_df, site=False)[source]

Create a dataframe of zone mappings.

Parameters:
  • domain_or_df (Domain or (geo)DataFrame) –

    • Preferred: a dapper.domain.Domain instance whose gdf has at least [‘gid’,’lon’,’lat’,’zone’].

    • Legacy: a df_loc-style (geo)DataFrame with the same columns.

  • site (bool, default False) –

    If False:

    Returns a DataFrame with columns [‘lon’, ‘lat’, ‘zone’, ‘id’].

    If True:

    Returns a dictionary: {gid: single-row DataFrame}.

dapper.elm.utils.validate_met_vars(df)[source]

Uses pre-computed statistics to ensure that the unit conversions resulted in distributions for each variable that make sense.

Module contents

dapper module: elm.__init__.