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
01afdeb5
Commit
01afdeb5
authored
1 year ago
by
lkugler
Browse files
Options
Downloads
Patches
Plain Diff
.
parent
154415e1
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/obs/create_obsseq_out.py
+44
-1
44 additions, 1 deletion
dartwrf/obs/create_obsseq_out.py
with
44 additions
and
1 deletion
dartwrf/obs/create_obsseq_out.py
+
44
−
1
View file @
01afdeb5
...
@@ -8,6 +8,14 @@ from dartwrf.exp_config import exp
...
@@ -8,6 +8,14 @@ from dartwrf.exp_config import exp
from
dartwrf.server_config
import
cluster
from
dartwrf.server_config
import
cluster
def
generate_obsseq_out
(
time
):
def
generate_obsseq_out
(
time
):
"""
Generate an obs_seq.out file from the current experiment
Args:
time (datetime): time of the observations
Returns:
obsseq.ObsSeq: obs_seq.out representation
"""
def
ensure_physical_vis
(
oso
):
# set reflectance < surface albedo to surface albedo
def
ensure_physical_vis
(
oso
):
# set reflectance < surface albedo to surface albedo
print
(
"
2.2) removing obs below surface albedo
"
)
print
(
"
2.2) removing obs below surface albedo
"
)
...
@@ -56,6 +64,11 @@ def generate_obsseq_out(time):
...
@@ -56,6 +64,11 @@ def generate_obsseq_out(time):
return
oso
return
oso
def
run_perfect_model_obs
(
nproc
=
12
,
verbose
=
True
):
def
run_perfect_model_obs
(
nproc
=
12
,
verbose
=
True
):
"""
Run the perfect_model_obs program to generate observations
Returns:
None
"""
if
verbose
:
if
verbose
:
print
(
"
generating observations - running ./perfect_model_obs
"
)
print
(
"
generating observations - running ./perfect_model_obs
"
)
os
.
chdir
(
cluster
.
dart_rundir
)
os
.
chdir
(
cluster
.
dart_rundir
)
...
@@ -67,4 +80,34 @@ def run_perfect_model_obs(nproc=12, verbose=True):
...
@@ -67,4 +80,34 @@ def run_perfect_model_obs(nproc=12, verbose=True):
if
not
os
.
path
.
exists
(
cluster
.
dart_rundir
+
"
/obs_seq.out
"
):
if
not
os
.
path
.
exists
(
cluster
.
dart_rundir
+
"
/obs_seq.out
"
):
raise
RuntimeError
(
raise
RuntimeError
(
"
obs_seq.out does not exist in
"
+
cluster
.
dart_rundir
,
"
obs_seq.out does not exist in
"
+
cluster
.
dart_rundir
,
"
\n
look for
"
+
cluster
.
dart_rundir
+
"
/log.perfect_model_obs
"
)
"
\n
look for
"
+
cluster
.
dart_rundir
+
"
/log.perfect_model_obs
"
)
\ No newline at end of file
if
__name__
==
'
__main__
'
:
"""
Generate obs_seq.out files from an experiment
Usage:
python3 create_obsseq_out.py 2008-07-30_12:00,2008-07-30_12:01
Args:
times (str): comma-separated list of times of the observations
"""
import
argparse
import
datetime
as
dt
parser
=
argparse
.
ArgumentParser
(
description
=
'
Generate obs_seq.out files from an experiment
'
)
parser
.
add_argument
(
'
times
'
,
type
=
str
,
help
=
'
times of the observations
'
)
args
=
parser
.
parse_args
()
times
=
args
.
times
.
split
(
'
,
'
)
# before running perfect_model_obs, we need to set up the run_DART folder
from
dartwrf
import
assim_synth_obs
as
aso
from
dartwrf
import
dart_nml
aso
.
prepare_run_DART_folder
()
nml
=
dart_nml
.
write_namelist
()
for
time
in
times
:
print
(
"
time
"
,
time
)
time
=
dt
.
datetime
.
strptime
(
time
,
'
%Y-%m-%d_%H:%M
'
)
aso
.
prepare_nature_dart
(
time
)
# link WRF files to DART directory
generate_obsseq_out
(
time
)
\ No newline at end of file
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