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
7b75efed
Commit
7b75efed
authored
1 month ago
by
Lukas Kugler
Browse files
Options
Downloads
Patches
Plain Diff
overwrite both time levels (_1, _2) with DART output
parent
e1495b96
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dartwrf/update_IC.py
+9
-11
9 additions, 11 deletions
dartwrf/update_IC.py
with
9 additions
and
11 deletions
dartwrf/update_IC.py
+
9
−
11
View file @
7b75efed
import
os
,
sys
,
warnings
import
datetime
as
dt
import
os
,
sys
import
netCDF4
as
nc
from
dartwrf.utils
import
Config
def
update_initials_in_WRF_rundir
(
cfg
:
Config
)
->
None
:
"""
Updates wrfrst-files in `/run_WRF/` directory
with posterior state from ./filter output, e.g. filter_restart_d01.0001
Args:
time (dt.datetime): time of assimilation (directory preceeding ./assim_stage0/...)
"""
time
=
cfg
.
time
time
=
cfg
.
time
# dt.datetime
use_wrfrst
=
True
# if wrfrst is used to restart (recommended)
if
use_wrfrst
:
...
...
@@ -40,12 +36,14 @@ def update_initials_in_WRF_rundir(cfg: Config) -> None:
# update all other variables
for
var
in
update_vars
:
if
var
in
ds_new
.
variables
:
var_new
=
var
# regular case
ds_new
.
variables
[
var
][:]
=
ds_filter
.
variables
[
var
][:]
print
(
'
updated
'
,
var
)
else
:
var_new
=
var
+
'
_2
'
# e.g. U_2, W_2
, THM_2
ds_new
.
variables
[
var
_new
][:]
=
ds_filter
.
variables
[
var
][:]
print
(
'
updated
'
,
var
_new
,
'
from
'
,
var
)
# special case, where a variable has 2 time levels, e.g. THM_1
, THM_2
for
var_suffix
in
[
'
_1
'
,
'
_2
'
]:
ds_new
.
variables
[
var
+
var_suffix
][:]
=
ds_filter
.
variables
[
var
][:]
print
(
'
updated
'
,
var
+
var_suffix
)
print
(
ic_file
,
'
created, updated from
'
,
filter_out
)
...
...
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