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
613f458b
Commit
613f458b
authored
2 years ago
by
lkugler
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
c5d70e82
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dartwrf/dart_nml.py
+26
-26
26 additions, 26 deletions
dartwrf/dart_nml.py
with
26 additions
and
26 deletions
dartwrf/dart_nml.py
+
26
−
26
View file @
613f458b
import
warnings
from
dartwrf.utils
import
append_file
from
dartwrf.exp_config
import
exp
from
dartwrf.server_config
import
cluster
...
...
@@ -191,36 +191,36 @@ def _get_list_of_localizations():
loc_horiz_rad
=
to_radian_horizontal
(
loc_horiz_km
)
l_loc_horiz_rad
.
append
(
loc_horiz_rad
)
# compute vertical localization
# do we have vertical localization?
if
not
hasattr
(
obscfg
,
"
loc_vert_km
"
)
and
not
hasattr
(
obscfg
,
"
loc_vert_scaleheight
"
):
l_loc_vert_km
.
append
(
-
1
)
l_loc_vert_scaleheight
.
append
(
-
1
)
# if not add dummy value
# choose either localization by height or by scale height
if
hasattr
(
obscfg
,
"
loc_vert_km
"
)
and
hasattr
(
obscfg
,
"
loc_vert_scaleheight
"
):
raise
ValueError
(
"
Observation config contains both loc_vert_km and loc_vert_scaleheight. Please choose one.
"
)
elif
hasattr
(
obscfg
,
"
loc_vert_km
"
):
# localization by height
try
:
# localization by height
loc_vert_km
=
obscfg
[
"
loc_vert_km
"
]
vert_norm_hgt
=
to_vertical_normalization
(
loc_vert_km
,
loc_horiz_km
)
l_loc_vert_km
.
append
(
vert_norm_hgt
)
elif
hasattr
(
obscfg
,
"
loc_vert_scaleheight
"
):
# localization by scale height
loc_vert_scaleheight
=
obscfg
[
"
loc_vert_scaleheight
"
]
# set the other (unused) list to a dummy value
l_loc_vert_scaleheight
=
[
-
1
,]
except
AttributeError
:
# localization by scale height
try
:
loc_vert_scaleheight
=
obscfg
[
"
loc_vert_scaleheight
"
]
# no conversion necessary, take the values as defined in obscfg
l_loc_vert_scaleheight
.
append
(
loc_vert_scaleheight
)
# no conversion necessary, take the values as defined in obscfg
l_loc_vert_scaleheight
.
append
(
loc_vert_scaleheight
)
# set the other (unused) list to a dummy value
if
len
(
l_loc_vert_km
)
>
0
:
l_loc_vert_scaleheight
=
[
-
1
,]
else
:
l_loc_vert_km
=
[
-
1
,]
# set the other (unused) list to a dummy value
l_loc_vert_km
=
[
-
1
,]
except
AttributeError
:
# do we have vertical localization?
# check parameter horiz_dist_only == true
if
exp
.
dart_nml
[
'
&location_nml
'
][
'
horiz_dist_only
'
][
0
]
==
'
.true.
'
:
# no vertical localization
l_loc_vert_km
.
append
(
-
1
)
l_loc_vert_scaleheight
.
append
(
-
1
)
else
:
raise
ValueError
(
'
Neither `loc_vert_km` nor `loc_vert_scaleheight` defined in obscfg.
'
)
return
l_obstypes
,
l_loc_horiz_rad
,
l_loc_vert_km
,
l_loc_vert_scaleheight
...
...
@@ -330,8 +330,8 @@ def write_namelist(just_prior_values=False):
# fail if horiz_dist_only == false but observations contain a satellite channel
if
nml
[
'
&location_nml
'
][
'
horiz_dist_only
'
][
0
]
==
'
.false.
'
:
for
obscfg
in
exp
.
observations
:
if
hasattr
(
obscfg
,
"
sat_channel
"
)
:
raise
ValueError
(
"
Selected vertical localization, but observations contain satellite obs ->
Not possible
.
"
)
if
'
sat_channel
'
in
obscfg
:
warnings
.
warn
(
"
Selected vertical localization, but observations contain satellite obs ->
Bug in DART
.
"
)
# write to file
write_namelist_from_dict
(
nml
,
cluster
.
dart_rundir
+
"
/input.nml
"
)
...
...
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