openairclim.core.construct_conc

Constructs concentrations

openairclim.core.construct_conc.calc_inv_sums(spec, inv_dict, target_units='kg')[source]

Calculates the emission sums for a given species for a dictionary of emission inventories, 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:

np.ndarray, np.ndarray

openairclim.core.construct_conc.check_inv_values(inv, year, spec)[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, species)[source]

Get total emissions in Tg for each inventory and given species

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

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

Raises:

TypeError – if species argument has wrong type

Returns:

Inventory years and dictionary with arrays of emissions in Tg,

keys are spec

Return type:

np.ndarray, dict

openairclim.core.construct_conc.interp_bg_conc(config, spec)[source]

Interpolates background concentrations for given species within time_range, for 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 np.ndarray of interpolated concentrations,

key is species

Return type:

dict