openairclim.utils.create_artificial_inventories
Create emission inventories with random values.
- class openairclim.utils.create_artificial_inventories.ArtificialInventory(year: int, ac_lst: list[str] | None = None, lon_range: list[float] = [0.0, 360.0], lat_range: list[float] = [-90.0, 90.0], plev_range: list[float] = [200.0, 1000.0], scaling: float = 1.0, size: int = 10000)[source]
Bases:
objectClass for generating artificial emission inventories.
- convert_df_to_xr() Self[source]
Convert the pandas dataframe to an xarray dataset.
- Returns:
This instance, for chaining. The converted dataset is stored on
self.inv.- Return type:
Self
- Raises:
RuntimeError – If called before create_uniform_dist().
- create(distribution: str = 'uniform') Dataset[source]
Create an emission inventory with the specified distribution.
- Parameters:
distribution (str, optional) – The distribution to use for creating the emission inventory. Can be either “uniform” or “normal”. Defaults to “uniform”.
- Returns:
The emission inventory as an xarray dataset.
- Return type:
xr.Dataset
- create_uniform_dist() Self[source]
Create an emission inventory with a uniform distribution.
- Returns:
This instance, for chaining.
- Return type:
Self
- mean_dict = {'CO2': 1346749.125, 'H2O': 540429.125, 'NOx': 6783.677734375, 'distance': 87872.8671875, 'fuel': 432343.28125, 'lat': 27.598291397094727, 'lon': 163.00254821777344, 'plev': 438.63165283203125}
- stat_size = 606169
- class openairclim.utils.create_artificial_inventories.ArtificialInventoryDict(year_arr: list[int], delta: float = 0.03, ac_lst: list[str] | None = None)[source]
Bases:
objectClass for generating artificial emission inventories.
- Parameters:
- year_arr
List of inventory years.
- Type:
- year_0
First year in the list.
- Type:
- delta
Linear increase rate of emissions.
- Type:
- inv_dict
Dictionary of xarray datasets, where the keys are the inventory years and the values are the datasets for that year.
- Type:
- create(evolution: str = 'increment') dict[source]
Create an emission inventory with the specified evolution.
- openairclim.utils.create_artificial_inventories.convert_xr_dict_to_nc(inv_dict: dict, prefix: str = 'rnd_inv', out_path: str = '.') None[source]
Convert a dictionary of xarray datasets to netCDF files and save.
Create out_path if not existing.
- Parameters:
inv_dict (dict) – Dictionary of xarray datasets, where the keys are the inventory years and the values are the datasets for that year.
prefix (str, optional) – Prefix for the output netCDF files. Defaults to “rnd_inv”.
out_path (str, optional) – The path to the output directory. Defaults to OUT_PATH.
- Returns:
None
- openairclim.utils.create_artificial_inventories.main()[source]
Parse command-line arguments and create artificial emission inventories.