Commit c252516f authored by brunner's avatar brunner
Browse files

ok

parent fa8726cd
...@@ -109,29 +109,10 @@ class Optimizer(object): ...@@ -109,29 +109,10 @@ class Optimizer(object):
for n in range(self.nlag): for n in range(self.nlag):
samples = statevector.obs_to_assimilate[n] samples = statevector.obs_to_assimilate[n]
members = statevector.ensemble_members[n] members = statevector.ensemble_members[n]
# params_2d = members[0].param_values[:-1].reshape(9,22)
# params = np.zeros(shape=(9,20))
# for r in range(0,9):
# params[r,:] = np.delete(np.delete(params_2d[r,:],21),10)
# params = np.hstack((params.flatten(),members[0].param_values[-1])) # put back BG
# self.x[n * self.nparams:(n + 1) * self.nparams] = params
self.x[n * self.nparams:(n + 1) * self.nparams] = members[0].param_values self.x[n * self.nparams:(n + 1) * self.nparams] = members[0].param_values
# params = np.zeros(shape=(self.nmembers,181))
# params_3d = np.zeros(shape=(self.nmembers,9,20))
# for m,mm in enumerate(members):
# params_temp = mm.param_values[:-1].reshape(9,22)
# params_bg = mm.param_values[-1]
# for r in range(0,9):
# params_3d[m,r,:] = np.delete(np.delete(params_temp[r,:],21),10)
# params[m,:] = np.hstack((params_3d[m,:,:].flatten(),params_bg))
# params = params_3d.reshape(self.nmembers,181)
# self.X_prime[n * self.nparams:(n + 1) * self.nparams, :] = np.transpose(np.array([params[m,:] for m,mm in enumerate(members)]))
self.X_prime[n * self.nparams:(n + 1) * self.nparams, :] = np.transpose(np.array([m.param_values for m in members])) self.X_prime[n * self.nparams:(n + 1) * self.nparams, :] = np.transpose(np.array([m.param_values for m in members]))
#self.X_prime[n * self.nparams:(n + 1) * self.nparams, :] = np.transpose(np.array([np.delete(np.delete(m.param_values,21),10) for m in members]))
if samples != None: if samples != None:
self.rejection_threshold = samples.rejection_threshold self.rejection_threshold = samples.rejection_threshold
...@@ -174,16 +155,6 @@ class Optimizer(object): ...@@ -174,16 +155,6 @@ class Optimizer(object):
members = statevector.ensemble_members[n] members = statevector.ensemble_members[n]
for m, mem in enumerate(members): for m, mem in enumerate(members):
members[m].param_values[:] = self.X_prime[n * self.nparams:(n + 1) * self.nparams, m] + self.x[n * self.nparams:(n + 1) * self.nparams] members[m].param_values[:] = self.X_prime[n * self.nparams:(n + 1) * self.nparams, m] + self.x[n * self.nparams:(n + 1) * self.nparams]
# params = (self.X_prime[n * self.nparams:(n + 1) * self.nparams, m] + self.x[n * self.nparams:(n + 1) * self.nparams]) # 181
# params_bg = params[-1] # BG
# params = params[:-1] # remove BG for now
# params = params.reshape(9,20)
# params_holder = np.zeros((9,22))
# for r in range(0,8):
# params_holder[r,:] = np.insert(np.insert(params[r,:],20,0),10,0)
# members[m].param_values[:] = np.hstack((params_holder.flatten(),params_bg))
#members[m].param_values[:] = np.insert(np.insert(self.X_prime[n * self.nparams:(n + 1) * self.nparams, m] + self.x[n * self.nparams:(n + 1) * self.nparams],10,0),21,0)
logging.debug('Returning optimized data to the StateVector, setting "StateVector.isOptimized = True" ') logging.debug('Returning optimized data to the StateVector, setting "StateVector.isOptimized = True" ')
......
...@@ -178,7 +178,7 @@ class StateVector(object): ...@@ -178,7 +178,7 @@ class StateVector(object):
# Create a dictionary for state <-> gridded map conversions # Create a dictionary for state <-> gridded map conversions
nparams = self.nparameters self.nparams = self.nparameters
self.griddict = {} self.griddict = {}
for pft in range(1,18): for pft in range(1,18):
for r in range(1, 11): for r in range(1, 11):
......
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