Commit b591c3de authored by Peters, Wouter's avatar Peters, Wouter
Browse files

Observations to assimilate are now part of StateVector, not of members anymore

parent 9712720a
......@@ -100,42 +100,43 @@ 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
allmemsamples=None # collect all members model samples for n=1,..,nlag
allsimulated=None # collect all members model samples for n=1,..,nlag
for n in range(self.nlag):
Samples = StateVector.ObsToAssimmilate[n]
members = StateVector.EnsembleMembers[n]
self.x[n*self.nparams:(n+1)*self.nparams] = members[0].ParameterValues
self.X_prime[n*self.nparams:(n+1)*self.nparams,:] = np.transpose(np.array([m.ParameterValues for m in members]))
if members[0].ModelSample != None:
if Samples != None:
self.rejection_threshold = members[0].ModelSample.rejection_threshold
self.rejection_threshold = Samples.rejection_threshold
allreject.extend( members[0].ModelSample.Data.getvalues('may_reject') )
alllocalize.extend( members[0].ModelSample.Data.getvalues('may_localize') )
allflags.extend( members[0].ModelSample.Data.getvalues('flag') )
allspecies.extend( members[0].ModelSample.Data.getvalues('species') )
allobs.extend( members[0].ModelSample.Data.getvalues('obs') )
allsamples.extend( members[0].ModelSample.Data.getvalues('simulated') )
allmdm.extend( members[0].ModelSample.Data.getvalues('mdm') )
allids.extend( members[0].ModelSample.Data.getvalues('id') )
allreject.extend( Samples.Data.getvalues('may_reject') )
alllocalize.extend( Samples.Data.getvalues('may_localize') )
allflags.extend( Samples.Data.getvalues('flag') )
allspecies.extend( Samples.Data.getvalues('species') )
allobs.extend( Samples.Data.getvalues('obs') )
allmdm.extend( Samples.Data.getvalues('mdm') )
allids.extend( Samples.Data.getvalues('id') )
memsamples=[]
for mem in members:
memsamples.append( mem.ModelSample.Data.getvalues('simulated') )
simulatedensemble = Samples.Data.getvalues('simulated')
if allmemsamples == None :
allmemsamples = np.array(memsamples)
if allsimulated == None :
allsimulated = np.array(simulatedensemble)
else:
allmemsamples = np.concatenate((allmemsamples,np.array(memsamples)),axis=1)
allsimulated = np.concatenate((allsimulated,np.array(simulatedensemble)),axis=0)
self.HX_prime[:,:] = np.transpose(allmemsamples)
self.obs[:] = np.array(allobs)
self.obs_ids[:] = np.array(allids)
self.Hx[:] = np.array(allsamples)
self.HX_prime[:,:] = np.array(allsimulated)
self.Hx[:] = self.HX_prime[:,0]
self.may_reject[:] = np.array(allreject)
self.may_localize[:] = np.array(alllocalize)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment