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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DataAssimilation
DART-WRF-delete_byApril
Commits
fd80bc89
Commit
fd80bc89
authored
2 years ago
by
lkugler
Browse files
Options
Downloads
Patches
Plain Diff
improved layer calculation
parent
d6d77dbd
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/obsseq.py
+24
-7
24 additions, 7 deletions
dartwrf/obsseq.py
with
24 additions
and
7 deletions
dartwrf/obsseq.py
+
24
−
7
View file @
fd80bc89
...
@@ -136,6 +136,27 @@ class ObsRecord(pd.DataFrame):
...
@@ -136,6 +136,27 @@ class ObsRecord(pd.DataFrame):
# find indices of observations within pandas.DataFrame
# find indices of observations within pandas.DataFrame
return
self
.
iloc
[
self
.
i_obs_grid
[
i
,
j
,
k
].
ravel
()]
return
self
.
iloc
[
self
.
i_obs_grid
[
i
,
j
,
k
].
ravel
()]
def
determine_nlayers
(
self
):
nlayers
=
1
# first guess
if
len
(
exp
.
observations
)
==
1
:
# obscfg = exp.observations[0]
# if 'heights' in obscfg:
# nlayers = len(obscfg['heights'])
heights
=
[
loc_xyz
[
2
]
for
loc_xyz
in
self
[
'
loc3d
'
]]
heights
=
sorted
(
heights
)
h0
=
heights
[
0
]
for
i
,
h
in
enumerate
(
heights
):
if
h
!=
h0
:
break
obs_per_layer
=
i
# if it fails at 1, there is 1 obs per layer
nlayers
=
int
(
len
(
self
)
/
obs_per_layer
)
else
:
warnings
.
warn
(
'
I can only guess the number of layers from this file.
'
)
return
nlayers
def
superob
(
self
,
window_km
):
def
superob
(
self
,
window_km
):
"""
Select subset, average, overwrite existing obs with average
"""
Select subset, average, overwrite existing obs with average
...
@@ -191,14 +212,10 @@ class ObsRecord(pd.DataFrame):
...
@@ -191,14 +212,10 @@ class ObsRecord(pd.DataFrame):
print
(
"
window (#obs in x/y)=
"
,
win_obs
)
print
(
"
window (#obs in x/y)=
"
,
win_obs
)
# superob in case of multiple layers, only implemented for single obstype
# superob in case of multiple layers, only implemented for single obstype
nlayers
=
1
nlayers
=
self
.
determine_nlayers
()
if
len
(
exp
.
observations
)
==
1
:
obscfg
=
exp
.
observations
[
0
]
if
'
heights
'
in
obscfg
:
nlayers
=
len
(
obscfg
[
'
heights
'
])
self
.
nlayers
=
nlayers
i_obs_grid
=
self
.
index
.
values
# indices of observations (starting from 0)
# indices of observations (starting from 0)
i_obs_grid
=
self
.
index
.
values
# get the observation indices from obs_seq (list)
# get the observation indices from obs_seq (list)
# onto a cartesian grid (ix, iy, iz)
# onto a cartesian grid (ix, iy, iz)
...
...
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