Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DART-WRF
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DataAssimilation
DART-WRF
Commits
b7a77743
Commit
b7a77743
authored
1 year ago
by
lkugler
Browse files
Options
Downloads
Patches
Plain Diff
docs
parent
11922cc4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/source/notebooks/tutorial1.ipynb
+18
-17
18 additions, 17 deletions
docs/source/notebooks/tutorial1.ipynb
with
18 additions
and
17 deletions
docs/source/notebooks/tutorial1.ipynb
+
18
−
17
View file @
b7a77743
...
...
@@ -16,7 +16,11 @@
"id": "93d59d4d-c514-414e-81fa-4ff390290811",
"metadata": {},
"source": [
"### Configuring the experiment\n",
"## Configuring the hardware\n",
"In case you use a cluster which is not supported, copy an existing cluster configuration and modify it, e.g. `config/jet.py`.\n",
"\n",
"\n",
"## Configuring the experiment\n",
"Firstly, you need to configure the experiment.\n",
"Copy the existing template and modify it `cp config/exp_template.py config/exp1.py`.\n",
"\n",
...
...
@@ -35,27 +39,27 @@
"exp.update_vars = ['U', 'V', 'W', 'THM', 'PH', 'MU', 'QVAPOR', 'QCLOUD', 'QICE', 'PSFC']\n",
"\n",
"```\n",
"In case you want to generate new observations like for an observing system simulations experiment, OSSE), set \n",
"\n",
"### Generating observations\n",
"In case you want to generate new observations, like for an observing system simulations experiment (OSSE), set \n",
"```python\n",
"exp.use_existing_obsseq = False\n",
"```\n",
"Else, you can use pre-existing observation files:\n",
"```python\n",
"exp.use_existing_obsseq = '/users/students/lehre/advDA_s2023/dartwrf_tutorial/very_cold_observation.out'\n",
"```\n",
"\n",
"`exp.nature` defines the path from where observations can be generated (necessary if `exp.use_existing_obsseq = False`)\n",
"in this case, you need to set the path to WRF nature run files from where DART can generate observations:\n",
"```python\n",
"exp.nature_wrfout_pattern = '/usr/data/sim_archive/exp_v1_nature/*/1/wrfout_d01_%Y-%m-%d_%H:%M:%S'\n",
"```\n",
"\n",
"`exp.input_profile` is used, if you create initial conditions from a so called wrf_profile (see WRF guide).\n",
"### Using pre-existing observation files\n",
"\n",
"You can use pre-existing observation files with\n",
"```python\n",
"exp.
input_profile = '/doesnt_exist/initial_profiles/wrf/ens/raso.fc.<iens>.wrfprof
'\n",
"exp.
use_existing_obsseq = '/usr/data/sim_archive/exp_ABC/obs_seq_out/%Y-%m-%d_%H:%M_obs_seq.out
'\n",
"```\n",
"where times are filled, depending on the assimilation time.\n",
"\n",
"\n",
"###
#
Single observation\n",
"### Single observation
experiment
\n",
"If you want to assimilate one observation, use \n",
"```python\n",
"t = dict(plotname='Temperature', plotunits='[K]',\n",
...
...
@@ -72,7 +76,7 @@
"exp.observations = [t,] # select observations for assimilation\n",
"```\n",
"\n",
"###
# M
ultiple observations\n",
"###
Assimilating m
ultiple observations\n",
"To generate a grid of observations, use\n",
"```python\n",
"vis = dict(plotname='VIS 0.6µm', plotunits='[1]',\n",
...
...
@@ -80,7 +84,7 @@
" n_obs=961, obs_locations='square_array_evenly_on_grid',\n",
" error_generate=0.03, error_assimilate=0.03,\n",
" loc_horiz_km=50)\n",
"exp.observations = [vis,]\n",
"exp.observations = [
t,
vis,]\n",
"```\n",
"\n",
"Caution, n_obs should only be one of the following:\n",
...
...
@@ -99,13 +103,10 @@
"id": "16bd3521-f98f-4c4f-8019-31029fd678ae",
"metadata": {},
"source": [
"### Configuring the hardware\n",
"In case you use a cluster which is not supported, configure paths inside `config/clusters.py`.\n",
"\n",
"\n",
"\n",
"\n",
"##
# Assimilate observations
\n",
"##
Configuring the assimilation experiment
\n",
"We start by importing some modules:\n",
"```python\n",
"import datetime as dt\n",
...
...
%% Cell type:markdown id:fd5c3005-f237-4495-9185-2d4d474cafd5 tags:
# 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.
The data for this experiment is accessible for students on the server srvx1.
%% Cell type:markdown id:93d59d4d-c514-414e-81fa-4ff390290811 tags:
### Configuring the experiment
## Configuring the hardware
In case you use a cluster which is not supported, copy an existing cluster configuration and modify it, e.g.
`config/jet.py`
.
## Configuring the experiment
Firstly, you need to configure the experiment.
Copy the existing template and modify it
`cp config/exp_template.py config/exp1.py`
.
Customize your 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
```
python
exp
=
utils
.
Experiment
()
exp
.
expname
=
"
test_newcode
"
exp
.
model_dx
=
2000
exp
.
n_ens
=
40
exp
.
update_vars
=
[
'
U
'
,
'
V
'
,
'
W
'
,
'
THM
'
,
'
PH
'
,
'
MU
'
,
'
QVAPOR
'
,
'
QCLOUD
'
,
'
QICE
'
,
'
PSFC
'
]
```
In case you want to generate new observations like for an observing system simulations experiment, OSSE), set
### Generating observations
In case you want to generate new observations, like for an observing system simulations experiment (OSSE), set
```
python
exp
.
use_existing_obsseq
=
False
```
Else, you can use pre-existing observation files:
```
python
exp
.
use_existing_obsseq
=
'
/users/students/lehre/advDA_s2023/dartwrf_tutorial/very_cold_observation.out
'
```
`exp.nature`
defines the path from where observations can be generated (necessary if
`exp.use_existing_obsseq = False`
)
in this case, you need to set the path to WRF nature run files from where DART can generate observations:
```
python
exp
.
nature_wrfout_pattern
=
'
/usr/data/sim_archive/exp_v1_nature/*/1/wrfout_d01_%Y-%m-%d_%H:%M:%S
'
```
`exp.input_profile`
is used, if you create initial conditions from a so called wrf_profile (see WRF guide).
### Using pre-existing observation files
You can use pre-existing observation files with
```
python
exp
.
input_profile
=
'
/doesnt_exist/initial_profiles/wrf/ens/raso.fc.<iens>.wrfprof
'
exp
.
use_existing_obsseq
=
'
/usr/data/sim_archive/exp_ABC/obs_seq_out/%Y-%m-%d_%H:%M_obs_seq.out
'
```
where times are filled, depending on the assimilation time.
###
#
Single observation
### Single observation
experiment
If you want to assimilate one observation, use
```
python
t
=
dict
(
plotname
=
'
Temperature
'
,
plotunits
=
'
[K]
'
,
kind
=
'
RADIOSONDE_TEMPERATURE
'
,
n_obs
=
1
,
# number of observations
obs_locations
=
[(
45.
,
0.
)],
# location of observations
error_generate
=
0.2
,
# observation error used to generate observations
error_assimilate
=
0.2
,
# observation error used for assimilation
heights
=
[
1000
,],
# for radiosondes, use range(1000, 17001, 2000)
loc_horiz_km
=
50
,
# horizontal localization half-width
loc_vert_km
=
2.5
# vertical localization half-width
)
exp
.
observations
=
[
t
,]
# select observations for assimilation
```
###
# M
ultiple observations
###
Assimilating m
ultiple observations
To generate a grid of observations, use
```
python
vis
=
dict
(
plotname
=
'
VIS 0.6µm
'
,
plotunits
=
'
[1]
'
,
kind
=
'
MSG_4_SEVIRI_BDRF
'
,
sat_channel
=
1
,
n_obs
=
961
,
obs_locations
=
'
square_array_evenly_on_grid
'
,
error_generate
=
0.03
,
error_assimilate
=
0.03
,
loc_horiz_km
=
50
)
exp
.
observations
=
[
vis
,]
exp
.
observations
=
[
t
,
vis
,]
```
Caution, n_obs should only be one of the following:
-
22500 for 2km observation density/resolution
-
5776 for 4km;
-
961 for 10km;
-
256 for 20km;
-
121 for 30km
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:
### Configuring the hardware
In case you use a cluster which is not supported, configure paths inside
`config/clusters.py`
.
##
# Assimilate observations
##
Configuring the assimilation experiment
We start by importing some modules:
```
python
import
datetime
as
dt
from
dartwrf.workflows
import
WorkFlows
```
To assimilate observations at dt.datetime
`time`
we set the directory paths and times of the prior ensemble forecasts:
```
python
prior_path_exp
=
'
/users/students/lehre/advDA_s2023/data/sample_ensemble/
'
prior_init_time
=
dt
.
datetime
(
2008
,
7
,
30
,
12
)
prior_valid_time
=
dt
.
datetime
(
2008
,
7
,
30
,
12
,
30
)
assim_time
=
prior_valid_time
```
To set up the experiment, call
```
python
w
=
WorkFlows
(
exp_config
=
'
exp1.py
'
,
server_config
=
'
srvx1.py
'
)
```
It will also create the output folders and backup the configuration files and scripts.
Finally, we run the data assimilation by calling
```
python
w
.
assimilate
(
assim_time
,
prior_init_time
,
prior_valid_time
,
prior_path_exp
)
```
Congratulations! You're done!
%% Cell type:code id:82e809a8-5972-47f3-ad78-6290afe4ae17 tags:
```
python
```
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment