Generating emission files from raw data#

Here we use raw data of various types to generate emission files in the right format for CHIMERE.

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 Checking the input files:.

Principles#

The CIF reads files of known formats and applies a chosen set of transformations (such as spatial interpolation) to produce input NetCDF files for CHIMERE.

Supported raw inputs are those handled by the available emission plugins, found under datastreams of type Flux (see also the 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 parameters of flux, with names matching those in 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.

The required information is:

  1. The name, type, and version of the plugin used to read the raw files, along with any plugin-specific arguments found in the plugin’s documentation.

  2. Up to four pieces of information for the component as expected by datavect (see CHIMERE usual inputs and datavect). Note that varname is almost always needed, since raw external files rarely use the same species names as CHIMERE.

  3. Recipes for building the transformations from raw data to CHIMERE inputs — i.e. the spatial and temporal interpolations and the unit conversion. Each recipe is a keyword with arguments that the CIF internally maps to plugins (this is why the documentation links point to plugins, even though users do not reference them directly in the YAML).

    1. the regrid recipe for spatial interpolation. If regrid is not specified, the CIF applies bilinear regridding by default.

    2. if required, the vertical_interpolation recipe for vertical interpolation. If not specified, linear interpolation is used by default.

    3. the time_interpolation recipe for temporal interpolation. (No options available yet; under construction.)

    4. the unit_conversion recipe for unit conversion.

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 model as 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 nlevemis = 1:

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 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 nlevemis = nlev:

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 flux is specified as above without per-species parameters, all emitted species will be read from the same varname and will therefore have identical emissions.

Various species from a raw inventory#

To take various emitted species from a raw inventory, as many parameters as emitted species listed in ANTHROPIC must be specified, each one with its particularities:

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 varname and 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 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.

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 nlevemis = 1:

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 nlevemis = nlev:

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 here.

The bioflux component follows the same principles as flux. All AEMISSIONS examples apply equally to BEMISSIONS, with the addition of emis_type.