pycif.plugins.models.wrfchem — API reference#
Configuration reference: wrfchem plugin
- pycif.plugins.models.wrfchem.ini_mapper.ini_mapper(model, transform_type, general_mapper={}, backup_comps={}, transforms_order=[], ref_transform='', transform_name='', **kwargs)[source]#
Note: Clean up as soon as it runs.
VERSION HISTORY 2021-10-06 freum Added ‘namelist’ and ‘model’ to inputs 2021-10-01 aberchet Uncommented ‘isobs’ and ‘force_loadout’ in ‘concs’ 2021-09-22 freum Edited out model.input_dates 2021-09-20 freum Updated emis dict 2021-08-19 freum Adapted for wrfchem, with some open questions 2021-08-18 Original code in models/lmdz/ini_mapper.py
- pycif.plugins.models.wrfchem.ini_periods.ini_periods(self, **kwargs)[source]#
Initialize variables related to model run periods
Variables set (not all implemented):
According to documentation: self.subsimu_dates self.tstep_all self.tstep_dates
Additional variables in lmdz plugin: self.input_dates self.meteo_dates self.iniobs self.reset_obs self.chain
DOCUMENTATION https://satinv.pages.in2p3.fr/cif/html/devtutos/newmodel/ obsvect.html?highlight=ini_periods
VERSION HISTORY 2021-08-18 freum Adapted for wrfchem - Similar to models/TM5/ini_periods.py (branch TM5) - Added comments - Some questions remain 2021-08-18 Original code in models/lmdz/ini_periods.py
- pycif.plugins.models.wrfchem.run.run(self, runsubdir, mode, workdir, ddi, do_simu=True, **kwargs)[source]#
Run WRF
- Parameters:
runsubdir (str) – working directory for the current run
mode (str) – forward or backward
workdir (str) – pycif working directory
do_simu (bool) – if False, considers that the simulation was already run
VERSION HISTORY
- 2021-08-19 Original code from online doc and from
plugins/models/lmdz/run.py
From ctdas-wrf’s wrchem utilities.
- class pycif.plugins.models.wrfchem.utilities.utilities[source]#
Bases:
objectUtilities for wrfchem model
Created on Mon Jul 22 15:03:02 2019
VERSION HISTORY 2021-09-25 freum Adapted from CTDAS-WRF wrfchem_helper.py - Everything not (yet) needed is commented
@author: friedemann
- class pycif.plugins.models.wrfchem.wrfchem_helper.WRFChemHelper(settings)[source]#
Bases:
objectContains helper functions for sampling WRF-Chem
- static get_int_coefs(pb_ret, pb_mod, level_def)[source]#
Computes a coefficients matrix to transfer a model profile onto a retrieval pressure axis.
If level_def==”layer_average”, this assumes that profiles are constant in each layer of the retrieval, bound by the pressure boundaries pb_ret. In this case, the WRF model layer is treated in the same way, and coefficients integrate over the assumed constant model layers. This works with non-staggered WRF variables (on “theta” points). However, this is actually not how WRF is defined, and the implementation should be changed to z-staggered variables. Details for this change are in a comment at the beginning of the code.
If level_def==”pressure_boundary” (IMPLEMENTATION IN PROGRESS), assumes that profiles, kernel and pwf are defined at pressure boundaries that don’t have a thickness (this is how OCO-2 data are defined, for example). In this case, the coefficients linearly interpolate adjacent model level points. This is incompatible with the treatment of WRF in the above-described layer-average assumption, but is closer to how WRF is actually defined. The exception is that pb_mod is still constructed and non-staggered variables are not defined at psurf. This can only be fixed by switching to z-staggered variables.
In cases where retrieval surface pressure is higher than model surface pressure, and in cases where retrieval top pressure is lower than model top pressure, the model profile will be extrapolated with constant tracer mixing ratios. In cases where retrieval surface pressure is lower than model surface pressure, and in cases where retrieval top pressure is higher than model top pressure, only the parts of the model column that fall within the retrieval presure boundaries are sampled.
Arguments#
- pb_ret (
array_like) Pressure boundaries of the retrieval column
- pb_mod (
array_like) Pressure boundaries of the model column
- level_def (
string) “layer_average” or “pressure_boundary” (IMPLEMENTATION IN PROGRESS). Refers to the retrieval profile.
Note 2021-09-13: Inspected code for pressure_boundary. Should be correct. Interpolates linearly between two model levels.
Returns#
- coefs (
array_like) Integration coefficient matrix. Each row sums to 1.
Usage#
import numpy as np pb_ret = np.linspace(900., 50., 5) pb_mod = np.linspace(1013., 50., 7) model_profile = 1. - np.linspace(0., 1., len(pb_mod)-1)**3 coefs = get_int_coefs(pb_ret, pb_mod, "layer_average") retrieval_profile = np.matmul(coefs, model_profile)
- pb_ret (