######################################### Generating emission files from raw data ######################################### .. role:: bash(code) :language: bash 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 your are a new user of the CIF or if you use a raw type of data for the fist time, it is safer to follow the steps: 1. Prepare a yaml for only generating the emissions (as shown below). 2. Run the system with this yaml. 3. Check the generated inputs, as explained in :ref:`chimere_check_inputs_readymade`. Principles ========== To internally pre-process various types of files, the CIF reads files of known formats and applies a chosen set of transformations (such as interpolation in space) to obtain :doc:`input netcdf files for CHIMERE`. The supported raw inputs are the ones supported by the various available plugins for the emissions, which are found in :doc:`datastreams of type Flux` (see also :doc:`cheat-sheet`). It is possible to specify different input sources for the various emitted species which do not require a sub-hourly interpolation. These species must be listed as :bash:`parameters` of :bash:`flux` and their names must match the names in :doc:`ANTHROPIC`. For each parameter, the specifications of the component plugin are inherited by default but it is possible to individualize everything, including the plugin to use, as shown in the following examples. .. 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 input arguments of the :doc:`EDGAR,v5 plugin` are specified (optional argument for choosing (or not) 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 the :bash:`flux` are specified as above, all the emitted species will be taken from the same :bash:`varname` and therefore, will have the same 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 how the :bash:`varname` information expected by :bash:`datavect` as well as the :bash:`unit_conversion` used by the :bash:`flux` plugin can be specified, and subsequently inherited i.e. used by various plugins, for each parameter.XXX STILL TRUE?XX **WARNING** since only S1 and S2 are described, an exception will be raised if other :doc:`ANTHROPIC` species exist. To avoid this, it can be interesting to use a general set of files for all species but a few, detailed as parameters. This generally happens when running tests consisting in modifying one (or a very few) species compared to reference AEMISSIONS. This is 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 Note that an error will be raised if the number of levels in the pre-processed AEMISSIONS files is not consistent. Various plugins can be used for various (sets) of species following the same principle. More advanced users may add plugins as required for new inputs: see details :doc:`here ` The :bash:`bioflux` specifications follow the same principles as :bash:`flux`. All the examples provided for AEMISSIONS apply to BEMISSIONS, with the addition of :bash:`emis_type`.