openghg_inversions.postprocessing.make_paris_outputs#
- openghg_inversions.postprocessing.make_paris_outputs.add_variable_attrs(ds: Dataset, attrs: dict[str, dict[str, Any]], units: float | None = None) Dataset#
Update data variables and coordinates of Dataset based on attributes dictionary.
If units provided, data variables with “units” attribute will be rescaled by units. This is to convert e.g. from 1e-9 mol/mol to mol/mol.
- openghg_inversions.postprocessing.make_paris_outputs.convert_time_to_unix_epoch(x: Dataset, units: str = '1s') Dataset#
Convert time coordinate of xarray Dataset or DataArray to number of “units” since 1 Jan 1970 (the “UNIX epoch”).
- openghg_inversions.postprocessing.make_paris_outputs.get_data_var_attrs(template_file: str | Path, species: str | None = None) dict[str, dict[str, Any]]#
Extract data variable attributes from template file.
- openghg_inversions.postprocessing.make_paris_outputs.infer_flux_frequency(flux: DataArray) str#
Attempt to infer flux frequency.
This does not work in all cases. If the flux has a “time_period” attribute, then that will be used. Otherwise, we try to infer the period by looking at the differences between timestamps. If only one timestamp is found, then a default value of “yearly” is returned.
- Parameters:
flux – flux DataArray
- Returns:
frequency string that can be parsed by pd.to_timedelta, or is “yearly” or “monthly”
- Raises:
ValueError – if inferred frequency is not “yearly” or “monthly”, and cannot be parsed by pd.to_timedelta
- openghg_inversions.postprocessing.make_paris_outputs.make_global_attrs(output_type: Literal['flux', 'conc'], author: str | None = None, species: str = 'inert', domain: str = 'EUROPE', apriori_description: str = 'EDGAR 8.0', history: str | None = None, comment: str | None = None) dict[str, str]#
- openghg_inversions.postprocessing.make_paris_outputs.make_paris_flux_outputs_from_rhime(rhime_outputs: Dataset, species: str, domain: str, country_file: str | Path | None = None, time_point: Literal['start', 'midpoint'] = 'midpoint', report_mode: bool = False, inversion_grid: bool = True, flux_frequency: Literal['monthly', 'yearly'] | str = 'yearly', start_date: str | None = None, end_date: str | None = None) Dataset#
- openghg_inversions.postprocessing.make_paris_outputs.make_paris_outputs(inv_out: InversionOutput, country_file: str | Path | None = None, time_point: Literal['start', 'midpoint'] = 'midpoint', report_mode: bool = False, inversion_grid: bool = True, obs_avg_period: str = '4h', domain: str | None = None) tuple[Dataset, Dataset]#
- openghg_inversions.postprocessing.make_paris_outputs.paris_concentration_outputs(inv_out: InversionOutput, report_mode: bool = False, obs_avg_period: str = '4h') Dataset#
Create PARIS concentration outputs.
TODO: add offset
- openghg_inversions.postprocessing.make_paris_outputs.paris_flux_output(inv_out: InversionOutput, country_file: str | Path | None = None, time_point: Literal['start', 'midpoint'] = 'midpoint', report_mode: bool = False, inversion_grid: bool = True, flux_frequency: Literal['monthly', 'yearly'] | str = 'yearly') Dataset#