Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DART-WRF-delete_byApril
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DataAssimilation
DART-WRF-delete_byApril
Commits
35c45f5e
Commit
35c45f5e
authored
3 years ago
by
lkugler
Browse files
Options
Downloads
Patches
Plain Diff
posterior
parent
fae50795
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
dartwrf/obsseq.py
+16
-6
16 additions, 6 deletions
dartwrf/obsseq.py
with
16 additions
and
6 deletions
dartwrf/obsseq.py
+
16
−
6
View file @
35c45f5e
...
...
@@ -226,20 +226,29 @@ class ObsSeq(object):
list_of_obsdict
=
obs_list_to_dict
(
obs_list
)
return
list_of_obsdict
def
get_prior_Hx_matrix
(
self
):
"""
Return prior Hx array (n_obs, n_ens)
"""
def
_get_model_Hx
(
self
,
what
):
if
what
not
in
[
'
prior
'
,
'
posterior
'
]:
raise
ValueError
# which columns do we need?
keys
=
self
.
df
.
columns
keys_bool
=
np
.
array
([
'
prior
ensemble member
'
in
a
for
a
in
keys
])
keys_bool
=
np
.
array
([
what
+
'
ensemble member
'
in
a
for
a
in
keys
])
# select columns in DataFrame
prior_
Hx
=
self
.
df
.
iloc
[:,
keys_bool
]
Hx
=
self
.
df
.
iloc
[:,
keys_bool
]
# consistency check: compute mean over ens - compare with value from file
assert
np
.
allclose
(
prior_Hx
.
mean
(
axis
=
1
),
self
.
df
[
'
prior ensemble mean
'
])
assert
np
.
allclose
(
Hx
.
mean
(
axis
=
1
),
self
.
df
[
what
+
'
ensemble mean
'
])
return
Hx
.
values
return
prior_Hx
.
values
def
get_prior_Hx
(
self
):
"""
Return prior Hx array (n_obs, n_ens)
"""
return
self
.
_get_model_Hx
(
'
prior
'
)
def
get_posterior_Hx
(
self
):
"""
Return posterior Hx array (n_obs, n_ens)
"""
return
self
.
_get_model_Hx
(
'
posterior
'
)
def
get_truth_Hx
(
self
):
return
self
.
df
[
'
truth
'
].
values
...
...
@@ -416,6 +425,7 @@ class ObsSeq(object):
def
write_obs
(
i
,
obs
,
next_i_obs
=
None
,
prev_i_obs
=
None
):
"""
Write the observation section of a obs_seq.out file
Args:
i (int): index of observation
obs (dict): observation data
...
...
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