First inversion with CHIMERE¶
Here we run an inversion with CHIMERE from a yaml elaborated for a forward simulation. Therefore, only the changes and additions compared to the forward yaml are described here.
It is a good practice which is very strongly recommended always to run a forward simulation and perform extensive checks on it before running an inversion.
Prepare the executable¶
If you do not use the automatic compilation by the CIF, be sure to compile the tangent-linear and/or adjoint codes (depending on the type of inversion to run) with:
./compile_chimere -m L ./compile_chimere -m A
See here for more details.
⟹ check that you obtain executables in sub-directories
src_ad named respectively
tlchimere.e (about 2.7M in size) and
achimere.e (about 2.9M in size).
Section for PyCIF parameters¶
Don’t forget to specify a
WORKDIR for the inversion, with enough space available. Most inversions require iterations and then, require more space than the matching forward simulation.
Here, an inversion is the chosen mode for running the model. See mode for the various inversions available. In our example below, a variational inversion is chosen:
mode: plugin: name: 4dvar version: std type: mode save_out_netcdf: True
The optional argument saves the results in netcdf files, which are larger but easier to read and post-process than the pickle files generated by default by the CIF. To optimize the computing time and disk space, it may be useful to run the inversion first without this option, then, when it is converged, to re-run it with the option as explained here.
The observation operator (
obsoperator) and control vector (
controlvect) are unchanged for this first inversion. The model (
model), observation vector (
obsvect:), platform (
platform), domain (
domain), chemistry (
chemistry) paragraphs are of course the same as for the forward simulation.
Neverthelss, some options can be particularly useful for an inversion, whereas they may not have been used in the matching forward simulation, such as:
autorestart, since an inversion takes generally more time than a forward simulation
autoflush, since an inversion with iterations takes more space than the forward
for the model:
autoflush/force_clean_run, for removing the very large files that the adjoint may generate,
useRAMonly, very useful for the adjoint (not at all for the forward) IF enough RAM is available
dir_obsvect for using the monitor.nc output generated after the forward simulation XXX TRUE XXX or a monitor.nc elaborated from the forward simulation (e.g. by filtering out non valid data)
Data vector (
Components which are not inverted¶
The component for observations and the components for the usual inputs of CHIMERE which are not to be inverted are the same as for the forward simulation. XX parameters dans concs???XXX
Components to be inverted¶
For each component to be inverted, the parameters must be detailed and at least the horizontal resolution to control must be specified. Any component that does not comply will NOT be inverted.
For example, to invert S1 emissions, from the forward 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 file: AEMISSIONS.%Y%m%d%H.X.nc plugin: name: CHIMERE version: AEMISSIONS type: flux file_freq: XH
specify at least:
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 file: AEMISSIONS.%Y%m%d%H.X.nc plugin: name: CHIMERE version: AEMISSIONS type: flux file_freq: XH parameters: S1: dir: directory_containing_AEMISSIONS.YYYYMMDDHH.*.nc_files file: AEMISSIONS.%Y%m%d%H.X.nc plugin: name: CHIMERE version: AEMISSIONS type: flux hresol: hpixels err: 0.1
The emissions of S1 will be inverted at the pixel’s resolution with variances set at 10% of the prior flux value in each pixel; no correlations are used.
Many possibilities are easily accessible for the resolutions (horizontal, vertical and temporal), the correlations (through time and space) and the specification of error values: see the control vector related arguments in the data vector for full descriptions, as well as the examplesXX link?XX.
Run the system¶
Before running the inversion, it is recommended to run a test of the adjoint (and, if relevant, of the TL) with the configuration chosen for the inversion.
Check and post-process the results¶
Examples of codes for post-processing the results of an inversion are provided in various projects such as VERIFY.