Commit 7d613798 authored by Remco Kok's avatar Remco Kok
Browse files

Change all instance of .flat to .flatten(), which caused a problem in forward runs.

parent 425a34a2
......@@ -54,7 +54,7 @@ def state_to_grid(values, regionmap, reverse=False, avg=False, mapname=None):
# dictionary for region <-> map conversions
regs = {}
for r in np.arange(1, nregions + 1):
sel = (regionmap.flat == r).nonzero()
sel = (regionmap.flatten() == r).nonzero()
if len(sel[0]) > 0:
regs[r] = sel
......@@ -96,7 +96,7 @@ def globarea(im=360, jm=180, silent=True):
dxy = dxx * (np.sin(lat + dyy) - np.sin(lat)) * radius ** 2
area = np.resize(np.repeat(dxy, im, axis=0) , [jm, im])
if not silent:
print('total area of field = ', np.sum(area.flat))
print('total area of field = ', np.sum(area.flatten()))
print('total earth area = ', 4 * np.pi * radius ** 2)
return area
......@@ -309,7 +309,7 @@ def cov2corr(A):
regs = {}
nregions = map.max()
for r in arange(1, nregions + 1):
sel = (map.flat == r).nonzero()
sel = (map.flatten() == r).nonzero()
if len(sel[0]) > 0:
regs[r] = sel
regionselect = regs
......
......@@ -90,7 +90,7 @@ class CO2StateVector(StateVector):
nparams = self.gridmap.max()
self.griddict = {}
for r in range(1, int(nparams) + 1):
sel = (self.gridmap.flat == r).nonzero()
sel = (self.gridmap.flatten() == r).nonzero()
if len(sel[0]) > 0:
self.griddict[r] = sel
......
......@@ -32,7 +32,7 @@ def state_to_grid(values, regionmap, reverse=False, avg=False, mapname=None):
# dictionary for region <-> map conversions
regs = {}
for r in np.arange(1, nregions + 1):
sel = (regionmap.flat == r).nonzero()
sel = (regionmap.flatten() == r).nonzero()
if len(sel[0]) > 0:
regs[r] = sel
......
......@@ -32,7 +32,7 @@ def state_to_grid(values, regionmap, reverse=False, avg=False, mapname=None):
# dictionary for region <-> map conversions
regs = {}
for r in np.arange(1, nregions + 1):
sel = (regionmap.flat == r).nonzero()
sel = (regionmap.flatten() == r).nonzero()
if len(sel[0]) > 0:
regs[r] = sel
......
......@@ -87,7 +87,7 @@ class MethaneStateVector(StateVector):
nparams = self.gridmap.max()
self.griddict = {}
for r in range(1, int(nparams) + 1):
sel = (self.gridmap.flat == r).nonzero()
sel = (self.gridmap.flatten() == r).nonzero()
if len(sel[0]) > 0:
self.griddict[r] = sel
......@@ -98,7 +98,7 @@ class MethaneStateVector(StateVector):
self.tcmatrix = np.zeros((self.nparams, int(self.tcmap.max())), 'float')
for r in range(1, self.nparams + 1):
sel = (self.gridmap.flat == r).nonzero()
sel = (self.gridmap.flatten() == r).nonzero()
if len(sel[0]) < 1:
continue
else:
......
......@@ -103,7 +103,7 @@ class SF6StateVector(StateVector):
nparams = self.gridmap.max()
self.griddict = {}
for r in range(1, int(nparams) + 1):
sel = (self.gridmap.flat == r).nonzero()
sel = (self.gridmap.flatten() == r).nonzero()
if len(sel[0]) > 0:
self.griddict[r] = sel
......
......@@ -180,7 +180,7 @@ class StateVector(object):
nparams = self.gridmap.max()
self.griddict = {}
for r in range(1, int(nparams) + 1):
sel = np.nonzero(self.gridmap.flat == r)
sel = np.nonzero(self.gridmap.flatten() == r)
if len(sel[0]) > 0:
self.griddict[r] = sel
......@@ -191,7 +191,7 @@ class StateVector(object):
self.tcmatrix = np.zeros((self.nparams, 23), 'float')
for r in range(1, self.nparams + 1):
sel = np.nonzero(self.gridmap.flat == r)
sel = np.nonzero(self.gridmap.flatten() == r)
if len(sel[0]) < 1:
continue
else:
......
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