Пример #1
0
 def outdata(self):
     mask = ma.mask_or(self.colmask, self.resmask)
     clean = ma.masked_array(data=self.data, mask = mask, fill_value = "NA")
     ldata = clean.filled(np.nan).tolist()
     
     for i, row in enumerate(ldata):
         for j, col in enumerate(row):
             if np.isnan(ldata[i][j]): ldata[i][j] = "NA"
             
     fulldata = vstack((hstack((array(self.indname),self.colnames)), 
         hstack((transpose(np.atleast_2d(self.ind)), ldata))))
     return fulldata
Пример #2
0
tlon = N.concatenate((tlon,tlon+360),1)
tlat = N.concatenate((tlat,tlat),1)
temp = MA.concatenate((temp,temp),1)
tlon = tlon-360.

pl.figure(figsize=(8.5,11))
pl.subplot(2,1,1)
# subplot 1 just shows POP grid cells.
map = Basemap(projection='merc', lat_ts=20, llcrnrlon=-180, \
      urcrnrlon=180, llcrnrlat=-84, urcrnrlat=84, resolution='c')

map.drawcoastlines()
map.fillcontinents(color='white')

x, y = map(tlon,tlat)
im = map.pcolor(x,y,MA.masked_array(N.zeros(temp.shape,'f'), temp.mask),\
                shading='faceted',cmap=pl.cm.cool,vmin=0,vmax=0)
# disclaimer:  these are not really the grid cells because of the
# way pcolor interprets the x and y args.
pl.title('(A) CCSM POP Grid Cells')

# subplot 2 is a contour plot of surface temperature from the
# CCSM ocean model.
pl.subplot(2,1,2)
map.drawcoastlines()
map.fillcontinents(color='white')

CS1 = map.contourf(x,y,temp,15)
CS2 = map.contour(x,y,temp,15,colors='black',linewidths=0.5)
pl.title('(B) Surface Temp contours on POP Grid')
Пример #3
0
tlon = N.concatenate((tlon, tlon + 360), 1)
tlat = N.concatenate((tlat, tlat), 1)
temp = MA.concatenate((temp, temp), 1)
tlon = tlon - 360.

pl.figure(figsize=(8.5, 11))
pl.subplot(2, 1, 1)
# subplot 1 just shows POP grid cells.
map = Basemap(projection='merc', lat_ts=20, llcrnrlon=-180, \
      urcrnrlon=180, llcrnrlat=-84, urcrnrlat=84, resolution='c')

map.drawcoastlines()
map.fillcontinents(color='white')

x, y = map(tlon, tlat)
im = map.pcolor(x,y,MA.masked_array(N.zeros(temp.shape,'f'), temp.mask),\
                shading='faceted',cmap=pl.cm.cool,vmin=0,vmax=0)
# disclaimer:  these are not really the grid cells because of the
# way pcolor interprets the x and y args.
pl.title('(A) CCSM POP Grid Cells')

# subplot 2 is a contour plot of surface temperature from the
# CCSM ocean model.
pl.subplot(2, 1, 2)
map.drawcoastlines()
map.fillcontinents(color='white')

CS1 = map.contourf(x, y, temp, 15)
CS2 = map.contour(x, y, temp, 15, colors='black', linewidths=0.5)
pl.title('(B) Surface Temp contours on POP Grid')