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
Tsurata, Aki
CTDAS
Commits
44b13701
Commit
44b13701
authored
Jun 12, 2013
by
Peters, Wouter
Browse files
changed initialize to setup
parent
845f7c35
Changes
9
Hide whitespace changes
Inline
Side-by-side
gridded/da/baseclasses/obs.py
View file @
44b13701
...
...
@@ -9,7 +9,7 @@ Revision History:
File created on 28 Jul 2010.
.. autoclass:: da.baseclasses.obs.Observations
:members:
initialize
, Validate, add_observations, add_simulations, add_model_data_mismatch, write_sample_coords
:members:
setup
, Validate, add_observations, add_simulations, add_model_data_mismatch, write_sample_coords
.. autoclass:: da.baseclasses.obs.ObservationList
:members: __init__
...
...
@@ -61,7 +61,7 @@ class Observations(object):
def
getlength
(
self
):
return
len
(
self
.
datalist
)
def
initialize
(
self
,
cycleparams
):
def
setup
(
self
,
cycleparams
):
""" Perform all steps needed to start working with observational data, this can include moving data, concatenating files,
selecting datasets, etc.
"""
...
...
gridded/da/baseclasses/observationoperator.py
View file @
44b13701
...
...
@@ -52,7 +52,7 @@ class ObservationOperator(object):
def
get_initial_data
(
self
):
""" This method places all initial data needed by an ObservationOperator in the proper folder for the model """
def
initialize
(
self
):
def
setup
(
self
):
""" Perform all steps necessary to start the observation operator through a simple Run() call """
def
validate_input
(
self
):
...
...
gridded/da/baseclasses/optimizer.py
View file @
44b13701
...
...
@@ -34,7 +34,7 @@ class Optimizer(object):
logging
.
info
(
'Optimizer object initialized: %s'
%
self
.
ID
)
def
initialize
(
self
,
dims
):
def
setup
(
self
,
dims
):
self
.
nlag
=
dims
[
0
]
self
.
nmembers
=
dims
[
1
]
self
.
nparams
=
dims
[
2
]
...
...
gridded/da/baseclasses/statevector.py
View file @
44b13701
...
...
@@ -80,7 +80,7 @@ class StateVector(object):
modified to be used in other parts of the pipeline:
* nobs
These values are set as soon as the :meth:`~da.baseclasses.statevector.StateVector.
initialize
` is called from the :ref:`pipeline`.
These values are set as soon as the :meth:`~da.baseclasses.statevector.StateVector.
setup
` is called from the :ref:`pipeline`.
Additionally, the value of attribute `isOptimized` is set to `False` indicating that the StateVector holds a-priori values
and has not been modified by the :ref:`optimizer`.
...
...
@@ -98,7 +98,7 @@ class StateVector(object):
The methods are described below:
.. automethod:: da.baseclasses.statevector.StateVector.
initialize
.. automethod:: da.baseclasses.statevector.StateVector.
setup
.. automethod:: da.baseclasses.statevector.StateVector.read_from_file
.. automethod:: da.baseclasses.statevector.StateVector.write_to_file
.. automethod:: da.baseclasses.statevector.StateVector.make_new_ensemble
...
...
@@ -123,9 +123,9 @@ class StateVector(object):
logging
.
info
(
'Statevector object initialized: %s'
%
self
.
ID
)
def
initialize
(
self
,
dacycle
):
def
setup
(
self
,
dacycle
):
"""
initialize
the object by specifying the dimensions.
setup
the object by specifying the dimensions.
There are two major requirements for each statvector that you want to build:
(1) is that the statevector can map itself onto a regular grid
...
...
gridded/da/carbondioxide/obs.py
View file @
44b13701
...
...
@@ -31,7 +31,7 @@ import da.tools.rc as rc
class
CO2Observations
(
Observations
):
""" an object that holds data + methods and attributes needed to manipulate mixing ratio values """
def
initialize
(
self
,
dacycle
):
def
setup
(
self
,
dacycle
):
self
.
startdate
=
dacycle
[
'time.sample.start'
]
self
.
enddate
=
dacycle
[
'time.sample.end'
]
...
...
gridded/da/carbondioxide/obspack.py
View file @
44b13701
...
...
@@ -33,7 +33,7 @@ version = '0.0'
class
ObsPackObservations
(
Observations
):
""" an object that holds data + methods and attributes needed to manipulate mixing ratio values """
def
initialize
(
self
,
dacycle
):
def
setup
(
self
,
dacycle
):
self
.
startdate
=
dacycle
[
'time.sample.start'
]
self
.
enddate
=
dacycle
[
'time.sample.end'
]
...
...
gridded/da/tm5/observationoperator.py
View file @
44b13701
...
...
@@ -58,7 +58,7 @@ class TM5ObservationOperator(ObservationOperator):
[]> tm.WriteRunRc()
[]> tm.run()
To use this class inside a data assimilation cycle, a stand-alone method "
initialize
()" is included which modifies the TM5
To use this class inside a data assimilation cycle, a stand-alone method "
setup
()" is included which modifies the TM5
settings according to an external dictionary of values to overwrite, and then runs the TM5 model.
...
...
@@ -78,7 +78,7 @@ class TM5ObservationOperator(ObservationOperator):
logging
.
info
(
'Observation Operator initialized: %s (%s)'
%
(
self
.
ID
,
self
.
version
))
def
initialize
(
self
,
dacycle
):
def
setup
(
self
,
dacycle
):
"""
Execute all steps needed to prepare the ObsOperator for use inside CTDAS, only done at the very first cycle normally
...
...
gridded/da/tools/initexit.py
View file @
44b13701
...
...
@@ -40,7 +40,7 @@ like this:::
The most important method of the CycleControl object are listed below:
.. autoclass:: da.tools.initexit.CycleControl
:members:
initialize
, finalize, collect_restart_data, move_restart_data,
:members:
setup
, finalize, collect_restart_data, move_restart_data,
submit_next_cycle, setup_file_structure, recover_run, random_seed
Two important attributes of the CycleControl object are:
...
...
@@ -263,7 +263,7 @@ class CycleControl(dict):
logging
.
info
(
"Retrieved the random seed generator values of last cycle from file"
)
def
initialize
(
self
):
def
setup
(
self
):
"""
This method determines how to proceed with the cycle. Three options are implemented:
...
...
gridded/da/tools/pipeline.py
View file @
44b13701
...
...
@@ -120,12 +120,12 @@ def start_job(dacycle, dasystem, platform, statevector, samples, obsoperator):
dasystem
.
validate
()
dacycle
.
dasystem
=
dasystem
dacycle
.
daplatform
=
platform
dacycle
.
initialize
()
dacycle
.
setup
()
#statevector.dacycle = dacycle # also embed object in statevector so it can access cycle information for I/O etc
#samples.dacycle = dacycle # also embed object in samples object so it can access cycle information for I/O etc
#obsoperator.dacycle = dacycle # also embed object in obsoperator object so it can access cycle information for I/O etc
obsoperator
.
initialize
(
dacycle
)
# Setup Observation Operator
statevector
.
initialize
(
dacycle
)
obsoperator
.
setup
(
dacycle
)
# Setup Observation Operator
statevector
.
setup
(
dacycle
)
def
prepare_state
(
dacycle
,
statevector
):
""" Set up the input data for the forward model: obs and parameters/fluxes"""
...
...
@@ -214,7 +214,7 @@ def sample_step(dacycle, samples, statevector, obsoperator, lag, advance=False):
statevector
.
write_members_to_file
(
lag
,
dacycle
[
'dir.input'
])
samples
.
initialize
(
dacycle
)
samples
.
setup
(
dacycle
)
samples
.
add_observations
()
# Add model-data mismatch to all samples, this *might* use output from the ensemble in the future??
...
...
@@ -280,7 +280,7 @@ def invert(dacycle, statevector, optimizer):
logging
.
info
(
"Using the bulk minimum least squares algorithm to solve ENKF equations"
)
optimizer
.
set_algorithm
(
'Bulk'
)
optimizer
.
initialize
(
dims
)
optimizer
.
setup
(
dims
)
optimizer
.
state_to_matrix
(
statevector
)
diagnostics_file
=
os
.
path
.
join
(
dacycle
[
'dir.output'
],
'optimizer.%s.nc'
%
dacycle
[
'time.start'
].
strftime
(
'%Y%m%d'
))
...
...
Write
Preview
Markdown
is supported
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