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
0c89705d
Commit
0c89705d
authored
1 year ago
by
lkugler
Browse files
Options
Downloads
Patches
Plain Diff
updating from master
parent
a6ada136
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
dartwrf/assim_synth_obs.py
+28
-14
28 additions, 14 deletions
dartwrf/assim_synth_obs.py
with
28 additions
and
14 deletions
dartwrf/assim_synth_obs.py
+
28
−
14
View file @
0c89705d
...
...
@@ -15,13 +15,17 @@ from dartwrf.server_config import cluster
wrfout_format
=
'
wrfout_d01_%Y-%m-%d_%H:%M:%S
'
def
link_nature_to_dart_truth
(
time
):
"""
Set a symlink from the WRFout file to be used as nature to the run_DART folder
Args:
time (dt.datetime): Time at which observations will be made
def
_prepare_DART_grid_template
():
# DART needs a wrfinput file as a template for the grid
# No data will be read from this file, but the grid information must match exactly.
symlink
(
cluster
.
dartrundir
+
"
/prior_ens1/wrfout_d01
"
,
cluster
.
dartrundir
+
"
/wrfinput_d01
"
)
def
_copy_nature_to_dart
(
time
):
"""
Copies wrfout_d01 from nature run to DART directory
TODO: This is a bit of a hack, because it is not explicit about where to take the nature from.
"""
# get wrfout_d01 from nature run
# find the file in any init directory
fformat
=
'
wrfout_d01_%Y-%m-%d_%H:%M:%S
'
f_nat
=
glob
.
glob
(
cluster
.
archive_base
+
'
/
'
+
exp
.
nature_expname
+
'
/*/1/
'
+
time
.
strftime
(
fformat
))[
0
]
...
...
@@ -33,16 +37,24 @@ def link_nature_to_dart_truth(time):
print
(
"
linked
"
,
f_nat
,
"
to
"
,
cluster
.
dart_rundir
+
"
/wrfout_d01
"
)
f_wrfout_nature
=
time
.
strftime
(
exp
.
nature
+
'
/
'
+
wrfout_format
)
if
os
.
path
.
exists
(
f_wrfout_nature
):
print
(
"
linking nature to DART & georeferencing
"
)
shutil
.
copy
(
f_wrfout_nature
,
cluster
.
dartrundir
+
"
/wrfout_d01
"
)
print
(
"
linked
"
,
f_wrfout_nature
,
"
to
"
,
cluster
.
dartrundir
+
"
/wrfout_d01
"
)
if
cluster
.
geo_em_for_WRF_ideal
:
wrfout_add_geo
.
run
(
cluster
.
geo_em_for_WRF_ideal
,
cluster
.
dart_rundir
+
"
/wrfout_d01
"
)
assert
os
.
path
.
exists
(
f_wrfout_nature
)
else
:
# if nature is not available due to any reason
print
(
'
-> has no nature, not copying nature
'
)
print
(
"
linking nature to DART & georeferencing
"
)
shutil
.
copy
(
f_wrfout_nature
,
cluster
.
dartrundir
+
"
/wrfout_d01
"
)
print
(
"
linked
"
,
f_wrfout_nature
,
"
to
"
,
cluster
.
dartrundir
+
"
/wrfout_d01
"
)
if
cluster
.
geo_em_for_WRF_ideal
:
wrfout_add_geo
.
run
(
cluster
.
geo_em_for_WRF_ideal
,
cluster
.
dart_rundir
+
"
/wrfout_d01
"
)
def
prepare_nature_dart
(
time
):
"""
Prepares DART nature (wrfout_d01) if available
Args:
time (dt.datetime): Time at which observations will be made
"""
try
:
_copy_nature_to_dart
(
time
)
except
FileExistsError
:
# if nature is not available due to any reason
print
(
'
-> has no nature, not copying nature
'
)
def
prepare_prior_ensemble
(
assim_time
,
prior_init_time
,
prior_valid_time
,
prior_path_exp
):
...
...
@@ -119,6 +131,8 @@ def write_list_of_outputfiles():
def
filter
(
nproc
=
12
):
_prepare_DART_grid_template
()
print
(
"
time now
"
,
dt
.
datetime
.
now
())
print
(
"
running filter
"
)
os
.
chdir
(
cluster
.
dart_rundir
)
...
...
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