openairclim.utils.create_artificial_inventories
Create emission inventories with random values
- class openairclim.utils.create_artificial_inventories.ArtificialInventory(year, ac_lst=None, lon_range=[0.0, 360.0], lat_range=[-90.0, 90.0], plev_range=[200.0, 1000.0], scaling=1.0, size=10000)[source]
Bases:
objectClass for generating artificial emission inventories.
- convert_df_to_xr()[source]
Convert the pandas dataframe to an xarray dataset.
- Returns:
The xarray dataset with the emission inventory data.
- Return type:
- 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
- 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, delta=0.03, ac_lst=None)[source]
Bases:
objectClass for generating artificial emission inventories.
- Parameters:
- inv_dict
Dictionary of xarray datasets, where the keys are the inventory years and the values are the datasets for that year.
- Type:
- openairclim.utils.create_artificial_inventories.convert_xr_dict_to_nc(inv_dict: dict, prefix: str = 'rnd_inv', out_path: str = '.')[source]
Convert a dictionary of xarray datasets to netCDF files and write to out_path. 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
- Return type:
None
- openairclim.utils.create_artificial_inventories.main()[source]
Parse command-line arguments and create artificial emission inventories.
- openairclim.utils.create_artificial_inventories.plot_sample_emission_inventory(rnd_inv_dict)[source]
Plots a sample emission inventory from the provided dictionary of xarray datasets.
- Parameters:
rnd_inv_dict (dict) – Dictionary of xarray datasets, where the keys are the inventory years and the values are the datasets for that year.
- Returns:
None
- Return type:
None