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:

 1rootdir: &rootdir /tmp/CIF/
 2outdir: &outdir  !join [*rootdir, /.tox/py38/tmp]
 3verbose: 1
 4workdir:  !join [*outdir, /6-2_includefluxes]
 5logfile: log.txt
 6datei: 2000-01-01 00:00:00
 7datef: 2000-02-01 00:00:00
 8mode:
 9  plugin:
10    name: forward
11    version: std
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
20obsoperator:
21  plugin:
22    name: standard
23    version: std
24chemistry:
25  schemeid: template_CO2
26  acspecies:
27    CO2:
28      restart_id: 1
29      mass: 12
30  emis_species:
31    CO2: null
32domain:
33  nlat: 15
34  nlon: 10
35  plugin:
36    name: dummy
37    version: std
38  xmax: 50
39  xmin: -10
40  ymax: 60
41  ymin: 40
42datavect:
43  plugin:
44    name: standard
45    version: std
46  components:
47    concs:
48      parameters:
49        CO2:
50          duration: 2H22min
51          frequency: 1H
52          nstations: 1
53          plugin:
54            name: random
55            type: measurements
56            version: param
57          seed: true
58          zmax: 100
59    flux:
60      parameters:
61        CO2:
62          plugin:
63            name: dummy
64            type: flux
65            version: txt
66          flx_formula:
67          - product:
68            - sum:
69              - cos: null
70                variable: zlat
71                period: 500
72              - sin: null
73                variable: zlon
74                period: 1000
75            - sum:
76              - square: null
77                variable: zlat
78                period: 1000
79              - square: null
80                variable: zlon
81                period: 1000