4. Setting the mapper with input fluxes

Here, we propose to prepare fluxes for the model. This is possible in the template by using the option include_fluxes in the model paragraph.

 1verbose: 1
 2workdir: ~/model_test/
 3logfile: log.txt
 4datei: 2000-01-01
 5datef: 2000-02-01
 6
 7mode:
 8  plugin:
 9    name: forward
10    version: std
11
12model:
13  plugin:
14    name: template
15    version: std
16  require_domain: True
17  require_chemistry: True
18  only_outputs: True
19  include_fluxes: True
20
21obsoperator:
22  plugin:
23    name: standard
24    version: std
25
26chemistry:
27  schemeid: template_CO2
28  acspecies:
29    CO2:
30      restart_id: 1
31      mass: 12
32  emis_species:
33    CO2:
34
35domain:
36  nlat: 15
37  nlon: 10
38  plugin:
39    name: dummy
40    version: std
41  xmax: 50
42  xmin: -10
43  ymax: 60
44  ymin: 40
45
46datavect:
47  plugin:
48    name: standard
49    version: std
50  components:
51    concs:
52      parameters:
53        CO2:
54          duration: 2H22min
55          frequency: 1H
56          nstations: 1
57          plugin:
58            name: random
59            type: measurements
60            version: param
61          seed: true
62          zmax: 100

Try running the yaml as is. It will return an error because inputs (fluxes in our case) are not defined in the Yaml, more specifically in the datavect paragraph. One can examine debugging text files in $workdir`/obsoperator/ to get further information about expected inputs.

At this step, one has to include a flux plugin to fetch flux files for one’s model if not already available. Please consult the dedicated tutorial here to implement a new flux Plugin.

Therein, one should define a get_domain function to define the flux domain, as well as a list_dates in the function fetch. Make sure that the domain and dates in the flux plugin are consistent with the ones in the model mapper. If everything is consistent, pyCIF will not read the data and one should just link original files in native2inputs

Below is an example with fluxes generated using a basic formula. One can use it to check what steps are computed and what is provided to the function native2inputs:

  1#####################
  2# pyCIF config file #
  3#####################
  4
  5# Define here all parameters for pyCIF following YAML syntax
  6# For details on YAML syntax, please see:
  7# http://docs.ansible.com/ansible/latest/YAMLSyntax.html
  8
  9###############################################################################
 10# pyCIF parameters
 11
 12rootdir: &rootdir /tmp/CIF/
 13outdir: &outdir  !join [*rootdir, /.tox/py38/tmp]
 14verbose: 2
 15workdir:  !join [*outdir, /6-2_includefluxes]
 16logfile: log.txt
 17datei: 2000-01-01 00:00:00
 18datef: 2000-02-01 00:00:00
 19
 20###############################################################################
 21
 22# http://community-inversion.eu/documentation/plugins/modes/forward.html
 23
 24mode:
 25  plugin:
 26    name: forward
 27    version: std
 28
 29###############################################################################
 30
 31# http://community-inversion.eu/documentation/plugins/models/template.html
 32
 33model:
 34  plugin:
 35    name: template
 36    version: std
 37
 38  require_domain: true
 39  require_chemistry: true
 40  only_outputs: true
 41  include_fluxes: true
 42
 43###############################################################################
 44
 45# http://community-inversion.eu/documentation/plugins/obsoperators/standard.html
 46
 47obsoperator:
 48  plugin:
 49    name: standard
 50    version: std
 51
 52###############################################################################
 53
 54chemistry:
 55  schemeid: template_CO2
 56  acspecies:
 57    CO2:
 58      restart_id: 1
 59      mass: 12
 60  emis_species:
 61    CO2: null
 62
 63###############################################################################
 64
 65# http://community-inversion.eu/documentation/plugins/domains/dummy.html
 66
 67domain:
 68  plugin:
 69    name: dummy
 70    version: std
 71
 72  nlat: 15
 73  nlon: 10
 74  xmax: 50
 75  xmin: -10
 76  ymax: 60
 77  ymin: 40
 78
 79###############################################################################
 80
 81# http://community-inversion.eu/documentation/plugins/datavects/standard.html
 82
 83datavect:
 84  plugin:
 85    name: standard
 86    version: std
 87
 88  components:
 89    concs:
 90      parameters:
 91        CO2:
 92          plugin:
 93            name: random
 94            type: measurements
 95            version: param
 96          duration: 2H22min
 97          frequency: 1H
 98          nstations: 1
 99          seed: true
100          zmax: 100
101
102    flux:
103      parameters:
104        CO2:
105          plugin:
106            name: dummy
107            type: flux
108            version: txt
109          flx_formula:
110          - product:
111            - sum:
112              - cos: null
113                variable: zlat
114                period: 500
115              - sin: null
116                variable: zlon
117                period: 1000
118            - sum:
119              - square: null
120                variable: zlat
121                period: 1000
122              - square: null
123                variable: zlon
124                period: 1000