Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
NearRealTimeCTDAS
CTDAS
Commits
1f4e2380
Commit
1f4e2380
authored
May 19, 2015
by
Peters, Wouter
Browse files
Changes needed for WRF-STIL, all compatible with base code
parent
feaab268
Changes
3
Hide whitespace changes
Inline
Side-by-side
da/baseclasses/observationoperator.py
View file @
1f4e2380
...
...
@@ -141,6 +141,12 @@ class ObservationOperator(object):
################### End Class ObservationOperator ###################
class
RandomizerObservationOperator
(
ObservationOperator
):
""" This class holds methods and variables that are needed to use a random number generated as substitute
for a true observation operator. It takes observations and returns values for each obs, with a specified
amount of white noise added
"""
if
__name__
==
"__main__"
:
...
...
da/baseclasses/optimizer.py
View file @
1f4e2380
...
...
@@ -91,7 +91,7 @@ class Optimizer(object):
alllocalize
=
[]
# collect all model samples for n=1,..,nlag
allflags
=
[]
# collect all model samples for n=1,..,nlag
allspecies
=
[]
# collect all model samples for n=1,..,nlag
allsimulated
=
None
# collect all members model samples for n=1,..,nlag
allsimulated
=
[]
# collect all members model samples for n=1,..,nlag
for
n
in
range
(
self
.
nlag
):
samples
=
statevector
.
obs_to_assimilate
[
n
]
...
...
@@ -112,11 +112,8 @@ class Optimizer(object):
allids
.
extend
(
samples
.
getvalues
(
'id'
))
simulatedensemble
=
samples
.
getvalues
(
'simulated'
)
if
allsimulated
==
None
:
allsimulated
=
np
.
array
(
simulatedensemble
)
else
:
allsimulated
=
np
.
concatenate
((
allsimulated
,
np
.
array
(
simulatedensemble
)),
axis
=
0
)
for
s
in
range
(
simulatedensemble
.
shape
[
0
]):
allsimulated
.
append
(
simulatedensemble
[
s
])
self
.
obs
[:]
=
np
.
array
(
allobs
)
self
.
obs_ids
[:]
=
np
.
array
(
allids
)
...
...
da/baseclasses/statevector.py
View file @
1f4e2380
...
...
@@ -399,9 +399,11 @@ class StateVector(object):
logging
.
info
(
'Successfully read the State Vector from file (%s) '
%
filename
)
def
write_members_to_file
(
self
,
lag
,
outdir
):
def
write_members_to_file
(
self
,
lag
,
outdir
,
endswith
=
'.nc'
):
"""
:param: lag: Which lag step of the filter to write, must lie in range [1,...,nlag]
:param: outdir: Directory where to write files
:param: endswith: Optional label to add to the filename, default is simply .nc
:rtype: None
Write ensemble member information to a NetCDF file for later use. The standard output filename is
...
...
@@ -424,7 +426,7 @@ class StateVector(object):
members
=
self
.
ensemble_members
[
lag
]
for
mem
in
members
:
filename
=
os
.
path
.
join
(
outdir
,
'parameters.%03d
.nc
'
%
mem
.
membernumber
)
filename
=
os
.
path
.
join
(
outdir
,
'parameters.%03d
%s
'
%
(
mem
.
membernumber
,
endswith
)
)
ncf
=
io
.
CT_CDF
(
filename
,
method
=
'create'
)
dimparams
=
ncf
.
add_params_dim
(
self
.
nparams
)
dimgrid
=
ncf
.
add_latlon_dim
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment