openairclim.core.construct_conc

Constructs concentrations.

openairclim.core.construct_conc.calc_inv_sums(spec: str, inv_dict: dict, target_units: str = 'kg') → tuple[ndarray, ndarray][source]

Calculates the emission sums for a given species and set of inventories.

Sums are converted to target_units using each inventory’s own declared units.

Parameters:
  • spec (str) – Name of species

  • inv_dict (dict) – Dictionary of emission inventory xarrays, keys are inventory years

  • target_units (str) – Unit string the returned sums are converted to. Defaults to “kg”.

Returns:

Inventory years and inventory sums for given species, in target_units

Return type:

numpy.ndarray, numpy.ndarray

openairclim.core.construct_conc.check_inv_values(inv: Dataset, year: str, spec: str) → None[source]

Checks values in given inventory for a specific species.

Parameters:
  • inv (xarray.Dataset) – Emission inventory dataset for a specific year.

  • year (str) – Year of the inventory.

  • spec (str) – Species name.

Raises:

ValueError – If there are any negative emissions for the given species in the inventory.

openairclim.core.construct_conc.get_emissions(inv_dict: dict, species: str | list[str]) → tuple[ndarray, dict][source]

Get total emissions in Tg for each inventory and given species.

Parameters:
  • inv_dict (dict) – Dictionary of emission inventory xarrays, keys are inventory years

  • species (str) – String or list of strings, species names

Raises:

TypeError – if species argument has wrong type

Returns:

Inventory years and dictionary with arrays of emissions in Tg, keys are spec

Return type:

numpy.ndarray, dict

openairclim.core.construct_conc.interp_bg_conc(config: dict, spec: str) → dict[source]

Interpolates background concentrations for a given species.

Uses time_range, a background file, and scenario set in config.

TODO: Take into account various conc units in background file.

Parameters:
  • config (dict) – Configuration dictionary from config

  • spec (str) – Species name

Returns:

Dictionary with numpy.ndarray of interpolated concentrations, key is species

Return type:

dict