Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CTDAS
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
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NearRealTimeCTDAS
CTDAS
Commits
78370143
Commit
78370143
authored
12 years ago
by
Peters, Wouter
Browse files
Options
Downloads
Patches
Plain Diff
new routine to read old savestate files from ct07-ct11 runs
parent
bc2d93b3
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
da/ct/statevector.py
+46
-0
46 additions, 0 deletions
da/ct/statevector.py
with
46 additions
and
0 deletions
da/ct/statevector.py
+
46
−
0
View file @
78370143
...
...
@@ -91,6 +91,52 @@ class CtStateVector(StateVector):
return
fullcov
def
ReadFromLegacyFile
(
self
,
filename
,
qual
=
'
opt
'
):
"""
:param filename: the full filename for the input NetCDF file
:param qual: a string indicating whether to read the
'
prior
'
or
'
opt
'
(imized) StateVector from file
:rtype: None
Read the StateVector information from a NetCDF file and put in a StateVector object
In principle the input file will have only one four datasets inside
called:
* `meanstate_prior`, dimensions [nlag, nparamaters]
* `ensemblestate_prior`, dimensions [nlag,nmembers, nparameters]
* `meanstate_opt`, dimensions [nlag, nparamaters]
* `ensemblestate_opt`, dimensions [nlag,nmembers, nparameters]
This NetCDF information can be written to file using
:meth:`~da.baseclasses.statevector.StateVector.WriteToFile`
"""
import
da.tools.io4
as
io
from
da.baseclasses.statevector
import
EnsembleMember
f
=
io
.
CT_Read
(
filename
,
'
read
'
)
for
n
in
range
(
self
.
nlag
):
if
qual
==
'
opt
'
:
MeanState
=
f
.
GetVariable
(
'
xac_%02d
'
%
(
n
+
1
))
EnsembleMembers
=
f
.
GetVariable
(
'
adX_%02d
'
%
(
n
+
1
))
elif
qual
==
'
prior
'
:
MeanState
=
f
.
GetVariable
(
'
xpc_%02d
'
%
(
n
+
1
))
EnsembleMembers
=
f
.
GetVariable
(
'
pdX_%02d
'
%
(
n
+
1
))
if
not
self
.
EnsembleMembers
[
n
]
==
[]:
self
.
EnsembleMembers
[
n
]
=
[]
logging
.
warning
(
'
Existing ensemble for lag=%d was removed to make place for newly read data
'
%
(
n
+
1
))
for
m
in
range
(
self
.
nmembers
):
NewMember
=
EnsembleMember
(
m
)
NewMember
.
ParameterValues
=
EnsembleMembers
[
m
,
:].
flatten
()
+
MeanState
# add the mean to the deviations to hold the full parameter values
self
.
EnsembleMembers
[
n
].
append
(
NewMember
)
f
.
close
()
logging
.
info
(
'
Successfully read the State Vector from file (%s)
'
%
filename
)
################### End Class CtStateVector ###################
...
...
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