Skip to content
Snippets Groups Projects
Commit ad46c6a8 authored by Peters, Wouter's avatar Peters, Wouter
Browse files

replaced PrepareState with direct calls to class

parent 9ae301fa
No related branches found
No related tags found
No related merge requests found
......@@ -42,9 +42,42 @@ def JobStart(opts,args):
def JobInput():
""" Set up the input data for the forward model: obs and parameters/fluxes"""
from da.tools.general import PrepareState
from da.ct.statevector import CtStateVector
StateVector = PrepareState(CycleInfo )
dims = ( int(CycleInfo.da_settings['time.nlag']),
int(CycleInfo.da_settings['forecast.nmembers']),
int(CycleInfo.DaSystem.da_settings['nparameters']),
)
StateVector = CtStateVector(dims)
nlag = dims[0]
# We now have an empty CtStateVector object that we need to populate with data. If this is a continuation from a previous cycle, we can read
# the previous StateVector values from a NetCDF file in the save/ directory. If this is the first cycle, we need to populate the CtStateVector
# with new values for each week. After we have constructed the StateVector, it will be propagated by one cycle length so it is ready to be used
# in the current cycle
if not CycleInfo.da_settings['time.restart']:
# Fill each week from n=1 to n=nlag with a new ensemble
for n in range(0,nlag):
cov = StateVector.GetCovariance(CycleInfo.DaSystem)
dummy = StateVector.MakeNewEnsemble(n+1,cov)
else:
# Read the StateVector data from file
savedir = CycleInfo.da_settings['dir.save']
filtertime = CycleInfo.da_settings['time.start'].strftime('%Y%m%d')
filename = os.path.join(savedir,'savestate.nc')
StateVector.ReadFromFile(filename)
# Now propagate the ensemble by one cycle to prepare for the current cycle
dummy = StateVector.Propagate()
return StateVector
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment