######################################### Generating emission files from raw data ######################################### Here we use raw data of various types to generate emission files in the right format for CHIMERE. .. _chimere-emissions-good-practices: Good practices =============== If you are a new CIF user or are using a raw data type for the first time, follow these steps: 1. Prepare a YAML for generating emissions only (as shown below). 2. Run the system with this YAML. 3. Check the generated inputs, as explained in :ref:`chimere_check_inputs_readymade`. Principles ========== The CIF reads files of known formats and applies a chosen set of transformations (such as spatial interpolation) to produce :doc:`input NetCDF files for CHIMERE`. Supported raw inputs are those handled by the available emission plugins, found under :doc:`datastreams of type Flux` (see also the :doc:`cheat-sheet`). Different input sources can be specified for the various emitted species that do not require sub-hourly interpolation. These species must be listed as :bash:`parameters` of :bash:`flux`, with names matching those in :doc:`ANTHROPIC`. Each parameter inherits the component plugin settings by default, but all settings, including the plugin, can be overridden individually, as shown in the examples below. .. include:: datavect_infos.rst **Remarks on the vertical interpolation**: - if no method is specified, the default interpolation method is ``linear``. - if the number of levels to use for the emissions, specified in the :bash:`model` as :bash:`nlevemis` is 1, but there are several levels in the original raw emissions; one expects to project all emissions to the single CHIMERE level. In that case, the linear interpolation will not return the expected behaviour. One should choose the method ``closest``. Examples ======== Only one species taken from a raw inventory on one level ......................................................... For a chemical scheme with only one hourly-interpolated species taken from a raw inventory if :bash:`nlevemis` = 1: .. code-block:: yaml datavect: plugin: name: standard version: std components: meteo: dir: directory_containing_METEO.YYYYMMDDHH.*.nc_files file: METEO.%Y%m%d%H.X.nc plugin: name: CHIMERE version: std type: meteo file_freq: XH flux: dir: /home/comdata1/flux/EDGARV5/TOTAL/ file: v50_N2O_%Y.0.1x0.1.nc varname: emi_n2o plugin: name: EDGAR type: flux version: v5 closest_year: True file_freq: 1Y regrid: method: mass-conservation time_interpolation: method: linear unit_conversion: # edgar = kg/m2/s-1 -> molec/cm2/s scale: 1.368e+21 Note how the arguments of the :doc:`EDGAR v5 plugin` are specified (including the optional argument to select the closest available year). Only one species taken from a raw inventory on several levels ............................................................. For a chemical scheme with only one hourly-interpolated species taken from a raw inventory if :bash:`nlevemis` = :bash:`nlev`: .. code-block:: yaml datavect: plugin: name: standard version: std components: meteo: dir: directory_containing_METEO.YYYYMMDDHH.*.nc_files file: METEO.%Y%m%d%H.X.nc plugin: name: CHIMERE version: std type: meteo file_freq: XH flux: dir: /home/comdata1/Fluxes/EDGARV5/TOTAL/ file: v50_N2O_%Y.0.1x0.1.nc varname: emi_n2o plugin: name: EDGAR version: v5 type: flux file_freq: 1Y regrid: method: mass-conservation time_interpolation: method: linear unit_conversion: # edgar = kg/m2/s-1 -> molec/cm2/s scale: 1.368e+21 vertical_interpolation: method: closest fill_nans: False fill_nans_value: 0 **WARNING**: if several species are emitted and :bash:`flux` is specified as above without per-species parameters, all emitted species will be read from the same :bash:`varname` and will therefore have identical emissions. Various species from a raw inventory .................................... To take various emitted species from a raw inventory, as many :bash:`parameters` as emitted species listed in :doc:`ANTHROPIC` must be specified, each one with its particularities: .. code-block:: yaml datavect: plugin: name: standard version: std components: meteo: dir: directory_containing_METEO.YYYYMMDDHH.*.nc_files file: METEO.%Y%m%d%H.X.nc plugin: name: CHIMERE version: std type: meteo file_freq: XH flux: dir: directory_containing_raw_v50.nc_EDGAR_files file: v50_%Y.0.1x0.1.nc plugin: name: EDGAR version: v5 type: flux file_freq: 1Y regrid: method: mass-conservation time_interpolation: method: linear unit_conversion: scale: 1e+6 parameters: S1: varname: emi_S1 plugin: name: EDGAR version: v5 type: flux S2: varname: emi_S2 plugin: name: EDGAR version: v5 type: flux unit_conversion: scale: 1e+2 Note that :bash:`varname` and :bash:`unit_conversion` can be specified per parameter and are inherited by the relevant plugins. **WARNING**: since only S1 and S2 are listed, an error will be raised if other :doc:`ANTHROPIC` species exist. To avoid this, use a general set of files for all species and override only a few with explicit parameters. This approach is common when testing modifications to one or a few species relative to reference AEMISSIONS, as illustrated in the examples below. .. _chimere-emissions-one-species-combine-raw-readymade: One species (among several) taken from a raw inventory on one level .................................................................... For only one species of the whole chemical scheme taken from a raw inventory if :bash:`nlevemis` = 1: .. code-block:: yaml datavect: plugin: name: standard version: std components: meteo: dir: directory_containing_METEO.YYYYMMDDHH.*.nc_files file: METEO.%Y%m%d%H.X.nc plugin: name: CHIMERE version: std type: meteo file_freq: XH flux: dir: directory_containing_AEMISSIONS.YYYYMMDDHH.*.nc_files_on_1_level file: AEMISSIONS.%Y%m%d%H.X.nc plugin: name: CHIMERE version: AEMISSIONS type: flux file_freq: XH parameters: S1: dir: /directory_containing_raw_EDGARV5_files/ file: v50_N2O_%Y.0.1x0.1.nc varname: emi_n2o plugin: name: EDGAR version: v5 type: flux file_freq: 1Y regrid: method: mass-conservation time_interpolation: method: linear unit_conversion: # edgar = kg/m2/s-1 -> molec/cm2/s scale: 1.368e+21 One species (among several) taken from a raw inventory on several levels ........................................................................ For only one species of the whole chemical scheme taken from a raw inventory if :bash:`nlevemis` = :bash:`nlev`: .. code-block:: yaml datavect: plugin: name: standard version: std components: meteo: dir: directory_containing_METEO.YYYYMMDDHH.*.nc_files file: METEO.%Y%m%d%H.X.nc plugin: name: CHIMERE version: std type: meteo file_freq: XH flux: dir: directory_containing_AEMISSIONS.YYYYMMDDHH.*.nc_files_on_nlev_levels file: AEMISSIONS.%Y%m%d%H.X.nc plugin: name: CHIMERE version: AEMISSIONS type: flux file_freq: XH parameters: S1: dir: /directory_containing_raw_EDGARV5_files/ file: v50_N2O_%Y.0.1x0.1.nc varname: emi_n2o plugin: name: EDGAR version: v5 file_freq: 1Y regrid: method: mass-conservation time_interpolation: method: linear unit_conversion: # edgar = kg/m2/s-1 -> molec/cm2/s scale: 1.368e+21 vertical_interpolation: method: closest fill_nans: False fill_nans_value: 0 An error is raised if the number of levels in the pre-processed AEMISSIONS files is inconsistent. Multiple plugins can be used for different sets of species following the same principle. Advanced users can add plugins for new input types: see details :doc:`here `. The :bash:`bioflux` component follows the same principles as :bash:`flux`. All AEMISSIONS examples apply equally to BEMISSIONS, with the addition of :bash:`emis_type`.