Skip to content
Snippets Groups Projects
Commit 9720101a authored by Stefano Serafin's avatar Stefano Serafin
Browse files

Improved documentation

parent 3184e238
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
# References
For the data assimilation algorithms:
* Anderson, J. L., 2001: An ensemble adjustment Kalman filter for data assimilation. Mon. Weather Rev., 129, 2884–2903. [https://doi.org/10.1175/1520-0493(2001)129%3C2884:AEAKFF%3E2.0.CO;2]
* Anderson, J. L., 2003: A local least squares framework for ensemble filtering. Mon. Weather Rev., 131, 634–642. [https://doi.org/10.1175/1520-0493(2003)131%3C0634:ALLSFF%3E2.0.CO;2]
* Hunt, B. R., E. J. Kostelich, and I. Szunyogh, 2007: Efficient data assimilation for spatiotemporal chaos: A local ensemble transform Kalman filter. Physica D, 230, 112–126.
[http://dx.doi.org/10.1016/j.physd.2006.11.008]
For the single-column model of the convective boundary layer (CBL):
* Troen, I. B., and L. Mahrt, 1986: A simple model of the atmospheric boundary layer; sensitivity to surface evaporation. Bound.-Layer Meteorol., 37, 129–148. [https://doi.org/10.1007/BF00122760]
%% Cell type:markdown id: tags:
# How to run a simple OSSE experiment
The default configuration files (in `json` format) are set to compute a single analysis that assimilates a single observation. For configuration details, see below. Simply run:
%% Cell type:code id: tags:
``` python
from ENDA import experiment
import pickle
import json
from PE_CBL_graphics import *
def get_experiment(settings_file):
with open(settings_file, 'r') as fp:
settings = json.load(fp)
exp = load_or_run(settings)
return exp
def load_or_run(settings):
try:
exp = pickle.load(open(settings['path']+'/'+settings['filename'], "rb"))
print('loaded experiment %s'%(settings['path']+'/'+settings['filename']))
except:
print('loading %s failed, running it'%(settings['path']+'/'+settings['filename']))
exp = experiment(settings)
pickle.dump(exp, open(settings['path']+'/'+settings['filename'], 'wb'))
return exp
exp = get_experiment('./default_da.json')
```
%% Output
loading .//experiment.pickle failed, running it
Spinup : # ...done
Nature run : # ...done
Cycle 0000 : ########## ...done
%% Cell type:code id: tags:
``` python
from matplotlib import pyplot as p
fig = p.figure(151)
fig.set_size_inches(6,4)
ax1 = fig.add_subplot(1,1,1)
ax1 = plot_CBL_assimilation(exp,_,ax = ax1)
ax1.set_xlabel(r'$\theta$ (K)')
ax1.set_ylabel(r'$z$ (m)')
ax1.set_title(r'Ensemble state at $t=3600$ s')
ax1.legend(frameon=False)
```
%% Output
<matplotlib.legend.Legend at 0x1542d54f7850>
%% Cell type:markdown id: tags:
# Configuration of the CBL model
See the file `default_cbl.json`
```
{
"g": 9.806,
"f": 0.0001,
"kvonk": 0.4,
"z0": 0.1,
"ug": 0,
"vg": 10,
"theta_0": 290,
"gamma": 0.003,
"Hmax": 0.1,
"H0_perturbation_ampl_init": 0.0,
"H0_perturbation_ampl_time": 0.0,
"exct": 0.3,
"pfac": 1.5,
"Kmin": 0.1,
"Kmax": 200,
"is_bwind": false,
"is_cgrad": true,
"is_cycle": false,
"dz": 50,
"ztop": 4000,
"rnseed": 181612,
"perturb_ensemble_state": true,
"perturbations_type": "smooth",
"perturbations_theta_amplitude": 0.1,
"perturbations_uv_amplitude": 0.1,
"perturbations_smooth_number": 11,
"perturbations_symmetric": true,
"error_growth_perturbations_amplitude": 0.1,
"perturb_ensemble_parameters": true,
"parameter_number": 1,
"parameter_transform": "pit",
"parameter_ensemble_min": 0.5,
"parameter_ensemble_max": 4.5,
"parameter_true": 1.5,
"do_parameter_estimation": true,
"parameter_inflation_rtps_alpha": 0.4,
"return_covariances_increments_and_innovations": true
}
```
%% Cell type:markdown id: tags:
# Configuration of the data assimilation cycle
See the file `default_da.json`
```
{
"cbl_settings_file": "./default_cbl.json",
"type": "OSSE",
"tspinup": 10800,
"trun": 3600,
"tspinup_assim": 0,
"assimilation_interval": 3600,
"randomize_obs": true,
"nobs": 1,
"obs_coordinates_min": 433,
"obs_coordinates_max": 433,
"obs_kinds": "theta",
"obs_error_sdev_generate": 0.2,
"obs_error_sdev_assimilate": 0.1,
"localization_cutoff": 400,
"nens": 50,
"FILTER": "EAKF",
"inflation_rtps_alpha": 0.1,
"simulate_underdispersiveness": false,
"rnseed": 181612,
"path": "./",
"filename": "experiment.pickle",
"label": "X",
"nature_run_from_file": false,
"do_parameter_estimation": true
}
```
# Tools for idealized parameter estimation experiments # Contents
* `PE_CBL.py` A software package to run ensemble data assimilation and parameter estimation experiments with the EAKF and LETKF.
Main driver program for parameter estimation with a convective boundary layer model. Includes a few examples.
* `models.py` ## General-purpose code
Model code. At the moment, it only includes a CBL model. * Module `ENDA.py`: Data assimilation code. Includes implementations of the EAKF and the LETKF. Also includes classes for data assimilation cycles, diagnostics and experiments (nature run + cycle + diagnostics).
* `ENDA.py` ## Basic parameter estimation code
Data assimilation code. Includes implementations of the EAKF and the LETKF. Also includes classes for data assimilation cycles, diagnostics and experiments (nature run + cycle + diagnostics). These were used in a manuscript on parameter estimation for a convective boundary layer parameterization scheme (single-column model, SCM):
* Script `PE_CBL.py`: Main code.
* Module `PE_CBL_models.py`: Classes and functions for the SCM intialization and integration
* Module `PE_CBL_graphics.py`: Functions to plot results.
* A set of `*tar.gz` archives, containing `.json` configuration files for the parameter estimation experiments.
* `graphics.py` ## Additional parameter estimation code
Includes all the code for generating figures. * Module `observations.py`: Code to ingest external observations (e.g. from an LES model, or actual observations) in parameter estimation experiments.
* Module `verification.py`: Code to verify experiments against external observations.
The code depends on `numpy`, `scipy`, `matplotlib.pyplot` ## Other
\ No newline at end of file * Script `replace_text.py`: A tool to edit a set of similar config files all at once.
* Notebook `Overview.ipynb`: Simple usage examples. Much more exhaustive examples are provided in `PE_CBL.py`.
## Dependencies
The code depends on `numpy`, `scipy`, `matplotlib`, `json`, `pandas`, `pickle`, `os`, `glob`
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment