Commit 5dac45bf authored by Peters, Wouter's avatar Peters, Wouter
Browse files

now propagating obs_nums into the optimizer.nc file. Note: requires obspack.py!

parent f5101793
......@@ -64,6 +64,8 @@ class Optimizer(object):
self.HX_prime = np.zeros( (self.nobs,self.nmembers), float)
# observations
self.obs = np.zeros( (self.nobs,), float)
# observation ids
self.obs_ids = np.zeros( (self.nobs,), float)
# covariance of observations
self.R = np.zeros( (self.nobs,self.nobs,), float)
# localization of obs
......@@ -93,6 +95,7 @@ class Optimizer(object):
allobs=[] # collect all obs for n=1,..,nlag
allmdm=[] # collect all mdm for n=1,..,nlag
allsamples=[] # collect all model samples for n=1,..,nlag
allids=[] # collect all model samples for n=1,..,nlag
allreject=[] # collect all model samples for n=1,..,nlag
alllocalize=[] # collect all model samples for n=1,..,nlag
allflags=[] # collect all model samples for n=1,..,nlag
......@@ -116,6 +119,7 @@ class Optimizer(object):
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') )
memsamples=[]
for mem in members:
......@@ -130,6 +134,7 @@ class Optimizer(object):
self.HX_prime[:,:] = np.transpose(allmemsamples)
self.obs[:] = np.array(allobs)
self.obs_ids[:] = np.array(allids)
self.Hx[:] = np.array(allsamples)
self.may_reject[:] = np.array(allreject)
......@@ -260,6 +265,18 @@ class Optimizer(object):
savedict['comment'] = 'Observations used in optimization'
dummy = f.AddData(savedict)
data = self.obs_ids
savedict = io.std_savedict.copy()
savedict['name'] = "obspack_num"
savedict['dtype'] = "int64"
savedict['long_name'] = "Unique_ObsPack_observation_number"
savedict['units'] = ""
savedict['dims'] = dimobs
savedict['values'] = data.tolist()
savedict['comment'] = 'Unique observation number across the entire ObsPack distribution'
dummy = f.AddData(savedict)
data = self.R
......
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