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 /tmp/pytest-of-root/pytest-0
14verbose: 2
15workdir: !!python/object/apply:pathlib.PosixPath
16- /
17- tmp
18- pytest-of-root
19- pytest-0
20- 6-2_includefluxes
21logfile: log.txt
22datei: 2000-01-01 00:00:00
23datef: 2000-02-01 00:00:00
24
25###############################################################################
26
27# http://community-inversion.eu/documentation/plugins/modes/forward.html
28
29mode:
30 plugin:
31 name: forward
32 version: std
33
34###############################################################################
35
36# http://community-inversion.eu/documentation/plugins/models/template.html
37
38model:
39 plugin:
40 name: template
41 version: std
42
43 require_domain: true
44 require_chemistry: true
45 only_outputs: true
46 include_fluxes: true
47
48###############################################################################
49
50# http://community-inversion.eu/documentation/plugins/obsoperators/standard.html
51
52obsoperator:
53 plugin:
54 name: standard
55 version: std
56
57###############################################################################
58
59chemistry:
60 schemeid: template_CO2
61 acspecies:
62 CO2:
63 restart_id: 1
64 mass: 12
65 emis_species:
66 CO2: null
67
68###############################################################################
69
70# http://community-inversion.eu/documentation/plugins/domains/dummy.html
71
72domain:
73 plugin:
74 name: dummy
75 version: std
76
77 nlat: 15
78 nlon: 10
79 xmax: 50
80 xmin: -10
81 ymax: 60
82 ymin: 40
83
84###############################################################################
85
86# http://community-inversion.eu/documentation/plugins/datavects/standard.html
87
88datavect:
89 plugin:
90 name: standard
91 version: std
92
93 components:
94 concs:
95 parameters:
96 CO2:
97 plugin:
98 name: random
99 type: measurements
100 version: param
101 duration: 2H22min
102 frequency: 1h
103 nstations: 1
104 seed: true
105 zmax: 100
106
107 flux:
108 parameters:
109 CO2:
110 plugin:
111 name: dummy
112 type: flux
113 version: txt
114 flx_formula:
115 - product:
116 - sum:
117 - cos: null
118 variable: zlat
119 period: 500
120 - sin: null
121 variable: zlon
122 period: 1000
123 - sum:
124 - square: null
125 variable: zlat
126 period: 1000
127 - square: null
128 variable: zlon
129 period: 1000