Skip to content
Snippets Groups Projects
Commit 81145b75 authored by lkugler's avatar lkugler
Browse files

.

parent 4e1a36c6
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:fd5c3005-f237-4495-9185-2d4d474cafd5 tags: %% Cell type:markdown id:fd5c3005-f237-4495-9185-2d4d474cafd5 tags:
# Tutorial 1: The assimilation step # Tutorial 1: The assimilation step
DART-WRF is a python package which automates many things like configuration, saving configuration and output, handling computing resources, etc. DART-WRF is a python package which automates many things like configuration, saving configuration and output, handling computing resources, etc.
The data for this experiment is accessible for students on the server srvx1.
%% Cell type:markdown id:93d59d4d-c514-414e-81fa-4ff390290811 tags: %% Cell type:markdown id:93d59d4d-c514-414e-81fa-4ff390290811 tags:
### Configuring the experiment ### Configuring the experiment
Firstly, you need to configure the experiment in `config/cfg.py`. Firstly, you need to configure the experiment in `config/cfg.py`.
Let's go through the most important settings: Let's go through the most important settings:
- expname should be a unique identifier and will be used as folder name
- model_dx is the model resolution in meters
- n_ens is the ensemble size
- update_vars are the WRF variables which shall be updated by the assimilation
- filter_kind is 1 for the EAKF (see the DART documentation for more)
- prior and post_inflation defines what inflation we want (see the DART docs)
- sec is the statistical sampling error correction from Anderson (2012)
```python ```python
exp = utils.Experiment() exp = utils.Experiment()
exp.expname = "test_newcode" exp.expname = "test_newcode"
exp.model_dx = 2000 exp.model_dx = 2000
exp.n_ens = 10 exp.n_ens = 10
exp.update_vars = ['U', 'V', 'W', 'THM', 'PH', 'MU', 'QVAPOR', 'QCLOUD', 'QICE', 'PSFC'] exp.update_vars = ['U', 'V', 'W', 'THM', 'PH', 'MU', 'QVAPOR', 'QCLOUD', 'QICE', 'PSFC']
exp.filter_kind = 1 exp.filter_kind = 1
exp.prior_inflation = 0 exp.prior_inflation = 0
exp.post_inflation = 4 exp.post_inflation = 4
exp.sec = True exp.sec = True
exp.cov_loc_vert_km_horiz_km = (3, 20)
```
In case you want to generate new observations like for an observing system simulations experiment, OSSE), set
```python
exp.use_existing_obsseq = False`.
``` ```
In case you want to generate new observations (observing system simulations experiment, OSSE), set `sxp.use_existing_obsseq = False`.
`exp.nature` defines where observations will be drawn from, e.g.: `exp.nature` defines which WRF files will be used to draw observations from, e.g.:
```python ```python
exp.nature = '/mnt/jetfs/scratch/lkugler/data/sim_archive/exp_v1.18_P1_nature/2008-07-30_06:00/1' exp.nature = '/users/students/lehre/advDA_s2023/data/sample_nature/'
``` ```
`exp.input_profile` is used, if you create initial conditions from a so called wrf_profile (see WRF guide). `exp.input_profile` is used, if you create initial conditions from a so called wrf_profile (see WRF guide).
```python ```python
exp.input_profile = '/mnt/jetfs/home/lkugler/data/initial_profiles/wrf/ens/2022-03-31/raso.fc.<iens>.wrfprof' exp.input_profile = '/doesnt_exist/initial_profiles/wrf/ens/raso.fc.<iens>.wrfprof'
``` ```
Vertical localization is tricky to set.
For horizontal localization half-width of 20 km and 3 km vertically, set
`exp.cov_loc_vert_km_horiz_km = (3, 20)`
You can also set it to zero for no vertical localization.
For horizontal localization half-width of 20 km and 3 km vertically, set
```python
exp.cov_loc_vert_km_horiz_km = (3, 20)
```
You can also set it to False for no vertical localization.
Set you desired observations like this. #### Single observation
Set your desired observations like this.
```python ```python
t = dict(plotname='Temperature', plotunits='[K]', t = dict(plotname='Temperature', plotunits='[K]',
kind='RADIOSONDE_TEMPERATURE', kind='RADIOSONDE_TEMPERATURE',
n_obs=1, obs_locations=[(45., 0.)], n_obs=1, # number of observations
error_generate=0.2, error_assimilate=0.2, obs_locations=[(45., 0.)], # location of observations
heights=[1000,], # range(1000, 17001, 2000), error_generate=0.2, # observation error used to generate observations
cov_loc_radius_km=50) error_assimilate=0.2, # observation error used for assimilation
heights=[1000,], # for radiosondes, use range(1000, 17001, 2000)
cov_loc_radius_km=50) # horizontal localization half-width
exp.observations = [t,] exp.observations = [t,] # select observations for assimilation
``` ```
#### Multiple observations
To generate a grid of observations, use To generate a grid of observations, use
```python ```python
vis = dict(plotname='VIS 0.6µm', plotunits='[1]', vis = dict(plotname='VIS 0.6µm', plotunits='[1]',
kind='MSG_4_SEVIRI_BDRF', sat_channel=1, kind='MSG_4_SEVIRI_BDRF', sat_channel=1,
n_obs=961, obs_locations='square_array_evenly_on_grid', n_obs=961, obs_locations='square_array_evenly_on_grid',
error_generate=0.03, error_assimilate=0.03, error_generate=0.03, error_assimilate=0.03,
cov_loc_radius_km=20) cov_loc_radius_km=20)
``` ```
But caution, n_obs should only be one of the following: But caution, n_obs should only be one of the following:
- 22500 for 2km observation density/resolution - 22500 for 2km observation density/resolution
- 5776 for 4km; - 5776 for 4km;
- 961 for 10km; - 961 for 10km;
- 256 for 20km; - 256 for 20km;
- 121 for 30km - 121 for 30km
For vertically resolved data, like radar, n_obs is the number of observations at each observation height level. For vertically resolved data, like radar, n_obs is the number of observations at each observation height level.
%% Cell type:markdown id:16bd3521-f98f-4c4f-8019-31029fd678ae tags: %% Cell type:markdown id:16bd3521-f98f-4c4f-8019-31029fd678ae tags:
### Configuring the hardware ### Configuring the hardware
In case you use a cluster which is not supported, configure paths inside `config/clusters.py`. In case you use a cluster which is not supported, configure paths inside `config/clusters.py`.
### Assimilate observations ### Assimilate observations
We start by importing some modules: We start by importing some modules:
```python ```python
import datetime as dt import datetime as dt
from dartwrf.workflows import WorkFlows from dartwrf.workflows import WorkFlows
``` ```
To assimilate observations at dt.datetime `time` we set the directory paths and times of the prior ensemble forecasts: To assimilate observations at dt.datetime `time` we set the directory paths and times of the prior ensemble forecasts:
```python ```python
prior_path_exp = '/mnt/jetfs/scratch/lkugler/data/sim_archive/exp_v1.19_P3_wbub7_noDA' prior_path_exp = '/users/students/lehre/advDA_s2023/data/sample_ensemble/'
prior_init_time = dt.datetime(2008,7,30,12) prior_init_time = dt.datetime(2008,7,30,12)
prior_valid_time = dt.datetime(2008,7,30,12,30) prior_valid_time = dt.datetime(2008,7,30,12,30)
assim_time = prior_valid_time assim_time = prior_valid_time
``` ```
Finally, we run the data assimilation by calling Finally, we run the data assimilation by calling
```python ```python
w = WorkFlows(exp_config='cfg.py', server_config='srvx1.py') w = WorkFlows(exp_config='cfg.py', server_config='srvx1.py')
w.assimilate(assim_time, prior_init_time, prior_valid_time, prior_path_exp) w.assimilate(assim_time, prior_init_time, prior_valid_time, prior_path_exp)
``` ```
Congratulations! You're done! Congratulations! You're done!
%% Cell type:code id:82e809a8-5972-47f3-ad78-6290afe4ae17 tags: %% Cell type:code id:82e809a8-5972-47f3-ad78-6290afe4ae17 tags:
``` python ``` python
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment