openairclim.core.calc_response

Calculates responses for each species and scenario.

openairclim.core.calc_response.calc_resp(spec: str, inv: Dataset, weights: Dataset) → ndarray[source]

Calculate response from response surfaces and emission inventories.

Uses pre-computed weighting parameters.

Parameters:
Raises:

KeyError – if species not valid

Returns:

Response array

Return type:

numpy.ndarray

openairclim.core.calc_response.calc_resp_all(config, resp_dict, inv_dict)[source]

Loop calc_response function over elements in response dictionary.

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

  • resp_dict (dict) – Dictionary of response xarray Datasets, keys are species

  • inv_dict (dict) – Dictionary of inventory xarray Datasets, keys are years

Returns:

Dictionary of dictionary of numpy arrays of computed responses,

keys are species and inventory years

Return type:

dict

openairclim.core.calc_response.calc_resp_sub(species_sub: list[str], config: dict, output_dict: dict, ac: str) → tuple[dict, dict][source]

Calculates responses for specified sub-species.

The calculation of sub-species responses depends on the results of main species which must be calculated and written to output beforehand.

Parameters:
  • species_sub (list[str]) – List of sub-species names, such as ‘PMO’

  • config (dict) – Configuration dictionary from config

  • output_dict (dict) – Dictionary with computed responses for main species, keyed by aircraft identifier

  • ac (str) – Aircraft identifier

Returns:

rf_sub_dict, dictionary with computed RF responses, and conc_sub_dict, dictionary with computed concentration responses; keys are sub-species

Return type:

tuple[dict, dict]

Raises:

KeyError – If no method defined for the sub-species