Commit e12b59ac authored by Isabelle Pison's avatar Isabelle Pison
Browse files

dev tuto on adding a new flux plugin: beginning

parent ca97484a
################################################
How to add a new type of flux data to be processed by the CIF into a model's inputs
################################################
.. role:: bash(code)
:language: bash
0. Have a yaml file ready with a simulation that works with a known flux plugin. For the :bash:`obsoperator`, choose the option :bash:`onlyinit` so that only the inputs are computed, not the whole simulation.
.. code-block:: yaml
obsoperator:
plugin:
name: standard
version: std
onlyinit: True
1. Following the instructions for :doc:`adding and registrering a new plugin</devtutos/newplugin/newplugin>`, add and register an empty plugin for the new type of flux data - the example deals with the INS data.
.. code-block:: bash
cd pycif/plugins/fluxes
mkdir ins
cd ins
touch __init__.py
then, add name and version in __init__.py:
.. code-block:: python
_name = "INS"
_version = "2012web"
XXXXXXXX
......@@ -32,10 +32,16 @@ Registering your new :bash:`plugin` to pyCIF
:bash:`plugins` in pyCIF are identified with:
- a name
- optional: a version (defaukt: std)
- optional: a version (default: std)
When the new plugin is created, it must be registered, so it can be called by other routines of pyCIF.
This can be done XXXecrire __version dans le .pyXXXX
This can be done by providing the name and (if relevant) version in :bash:`__init__.py` :
.. code-block:: python
_name = "the_name"
_version = "the_version_if_not_std"
You can check that your :bash:`plugin` is correctly registered by using the following commands in python:
......@@ -56,15 +62,56 @@ Below is an example of requirements for the :bash:`model` CHIMERE:
.. code-block:: python
requirements = {'domain': {'name': 'CHIMERE', 'version': 'std',
'empty': False, 'any': False},
'chemistry': {'name': 'CHIMERE', 'version': 'gasJtab',
'empty': False, 'any': False},
'fluxes': {'name': 'CHIMERE', 'version': 'AEMISSIONS',
'empty': True, 'any': False},
'meteo': {'name': 'CHIMERE', 'version': 'std',
'empty': False, 'any': False}}
XXXX + ne pas oublier la doc via les input_arguments - lien vers la page how to contribute docXXXX
requirements = {
"domain": {
"name": "CHIMERE",
"version": "std",
"empty": False,
"any": False,
},
"chemistry": {
"name": "CHIMERE",
"version": "gasJtab",
"empty": False,
"any": False,
},
"fluxes": {
"name": "CHIMERE",
"version": "AEMISSIONS",
"empty": True,
"any": False,
"subplug": True,
"preftree": "datavect/components",
},
[...]
}
The documentation must be provided by the :bash:`input_arguments` section, as detailed in :doc:`the description of the automatic documentation</contrib_doc>`.
.. code-block:: python
input_arguments = {
"direxec": {
"doc": "Path to CHIMERE sources and/or executables. "
"For executables, ``fwdchimere.e``, ``tlchimere.e`` and ``achimere.e`` should be in "
"``${path}/src``, ``${path}/src_tl`` and ``${path}/src_ad`` respective sub-folders.",
"default": None,
"accepted": str
},
"ideepconv": {
"doc": "Computation of the deep convection.",
"default": None,
"accepted": {
0: "No deep convection",
1: "Select deep convection automatically according to resolution, "
"deep conv fluxes from Tiedtke",
2: "Select deep convection automatically according to resolution, "
"deep conv fluxes from meteorological data"
}
},
[...]
}
With the example above, the :bash:`model` plugin, CHIMERE, requires a :bash:`domain` plugin to work.
In the sub-routines of the :bash:`model` plugin, data from the :bash:`domain` can simply be summoned with:
......
......@@ -240,8 +240,8 @@ ensures that the new compilation starts from scratch. Option `N` indicates that
dir_precomp: the_path_for_the_directory_of_which_chemical_scheme_named_above_is_a_subdir/
j. :datavect:
so far, there is only the standard :bash:`datavect`. For the fisrt forward simulation with comparison to some observations, its components must include the dependencies listed in the :doc:`cheat-sheet</documentation/plugins/dependencies>` for the :bash:`model` (e) plugin, which are not already specified outside :bash:`datavect`: they are the items I to VI in (e). These components include the usual inputs required by CHIMERE: :bash:`meteo` (I) for the meteorological inputs (see step 2), :bash:`fluxes` (II) for emissons not interpolated within the 1-hour time steps in CHIMERE),
XXXXXXXXXXx :bash:`biofluxes` (emissions linearly interpolated within the 1-hour time steps) if relevant i.e. if :bash:`optemisb` is True, :bash:`inicond`, :bash:`latcond` and :bash:`topcond` (initial, lateral and top conditions) and :bash:`concs` for the observations to be compared with the simulations.
so far, there is only the standard :bash:`datavect`. For the fisrt forward simulation with comparison to some observations, its components must include the dependencies listed in the :doc:`cheat-sheet</documentation/plugins/dependencies>` for the :bash:`model` (e) plugin, which are not already specified outside :bash:`datavect`: they are the items I to VI in (e). These components include the usual inputs required by CHIMERE: :bash:`meteo` (I) for the meteorological inputs (see step 2), :bash:`fluxes` (II) for emissions not interpolated within the 1-hour time steps in CHIMERE),
XXXXXXXXXXx :bash:`biofluxes` for emissions linearly interpolated within the 1-hour time steps if relevant i.e. if :bash:`optemisb` is True, :bash:`inicond`, :bash:`latcond` and :bash:`topcond` (initial, lateral and top conditions) and :bash:`concs` for the observations to be compared with the simulations.
I. The components are plugins, they therefore require a name and version to be specified. Here, according to the :doc:`cheat-sheet</documentation/plugins/dependencies>`, the yaml should read:
......@@ -362,7 +362,7 @@ XXXXXXXXXXx :bash:`biofluxes` (emissions linearly interpolated within the 1-hour
plugin:
name: EDGAR
version: v5
dir: directory_containing_raw_v50.nc_EDGAR_files
* a raw inventory to be read and processed for all species but one, which is already pre-processed:
......@@ -420,6 +420,8 @@ XXXXXXXXXXx :bash:`biofluxes` (emissions linearly interpolated within the 1-hour
XXXXXXXXXXXXXXXXXXXXBelow is an example for boundary conditions processed from ECMWF grid files and for fluxes processed from the French INS (XXX files).
III. The biofluxes
III. The biofluxes
IV. The inicond, latcond and topcond
V. The observations
_name = "INS"
_version = "2012web"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment