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
10164915
Commit
10164915
authored
1 year ago
by
lkugler
Browse files
Options
Downloads
Patches
Plain Diff
quick-fix error-assimilate does not exist
parent
f4f8e571
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
+13
-9
13 additions, 9 deletions
dartwrf/assim_synth_obs.py
with
13 additions
and
9 deletions
dartwrf/assim_synth_obs.py
+
13
−
9
View file @
10164915
...
@@ -283,16 +283,20 @@ def set_obserr_assimilate_in_obsseqout(oso, outfile="./obs_seq.out"):
...
@@ -283,16 +283,20 @@ def set_obserr_assimilate_in_obsseqout(oso, outfile="./obs_seq.out"):
where_oso_iskind
=
oso
.
df
.
kind
==
kind
where_oso_iskind
=
oso
.
df
.
kind
==
kind
if
obscfg
[
"
error_assimilate
"
]
==
False
:
if
obscfg
[
"
error_assimilate
"
]
==
False
:
osf_prior
=
obsseq
.
ObsSeq
(
cluster
.
dartrundir
+
"
/obs_seq.final
"
)
# this file will be generated by `evaluate()`
#
osf_prior = obsseq.ObsSeq(cluster.dartrundir + "/obs_seq.final") # this file will be generated by `evaluate()`
where_osf_iskind
=
osf_prior
.
df
.
kind
==
kind
#
where_osf_iskind = osf_prior.df.kind == kind
assim_err
=
get_parametrized_error
(
obscfg
,
osf_prior
.
df
[
where_osf_iskind
])
#
assim_err = get_parametrized_error(obscfg, osf_prior.df[where_osf_iskind])
oso
.
df
.
loc
[
where_oso_iskind
,
'
variance
'
]
=
assim_err
**
2
#
oso.df.loc[where_oso_iskind, 'variance'] = assim_err**2
#assert np.allclose(assim_err, oso.df['variance']**2) # check
#assert np.allclose(assim_err, oso.df['variance']**2) # check
pass
else
:
else
:
# overwrite with user-defined values
# overwrite with user-defined values
oso
.
df
.
loc
[
where_oso_iskind
,
'
variance
'
]
=
obscfg
[
"
error_assimilate
"
]
**
2
try
:
oso
.
df
.
loc
[
where_oso_iskind
,
'
variance
'
]
=
obscfg
[
"
error_assimilate
"
]
**
2
except
:
pass
oso
.
to_dart
(
outfile
)
oso
.
to_dart
(
outfile
)
...
@@ -532,7 +536,7 @@ def main(time, prior_init_time, prior_valid_time, prior_path_exp):
...
@@ -532,7 +536,7 @@ def main(time, prior_init_time, prior_valid_time, prior_path_exp):
do_QC
=
getattr
(
exp
,
"
reject_smallFGD
"
,
False
)
# True: triggers additional evaluations of prior & posterior
do_QC
=
getattr
(
exp
,
"
reject_smallFGD
"
,
False
)
# True: triggers additional evaluations of prior & posterior
# for which observation type do we have a parametrized observation error?
# for which observation type do we have a parametrized observation error?
error_is_parametrized
=
[
obscfg
[
"
error_assimilate
"
]
==
False
for
obscfg
in
exp
.
observations
]
#
error_is_parametrized = [obscfg["error_assimilate"] == False for obscfg in exp.observations]
# create directory to run DART in
# create directory to run DART in
archive_time
=
cluster
.
archivedir
+
time
.
strftime
(
"
/%Y-%m-%d_%H:%M/
"
)
archive_time
=
cluster
.
archivedir
+
time
.
strftime
(
"
/%Y-%m-%d_%H:%M/
"
)
...
@@ -556,9 +560,9 @@ def main(time, prior_init_time, prior_valid_time, prior_path_exp):
...
@@ -556,9 +560,9 @@ def main(time, prior_init_time, prior_valid_time, prior_path_exp):
oso
=
get_obsseq_out
(
time
)
oso
=
get_obsseq_out
(
time
)
# is any observation error parametrized?
# is any observation error parametrized?
if
any
(
error_is_parametrized
)
or
do_QC
:
#
if any(error_is_parametrized) or do_QC:
print
(
"
(optional) evaluate prior for all observations (incl rejected)
"
)
#
print(" (optional) evaluate prior for all observations (incl rejected)")
evaluate
(
time
,
output_format
=
"
%Y-%m-%d_%H:%M_obs_seq.final-eval_prior_allobs
"
)
#
evaluate(time, output_format="%Y-%m-%d_%H:%M_obs_seq.final-eval_prior_allobs")
print
(
"
assign observation-errors for assimilation
"
)
print
(
"
assign observation-errors for assimilation
"
)
set_obserr_assimilate_in_obsseqout
(
oso
,
outfile
=
cluster
.
dartrundir
+
"
/obs_seq.out
"
)
set_obserr_assimilate_in_obsseqout
(
oso
,
outfile
=
cluster
.
dartrundir
+
"
/obs_seq.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