Ejemplo n.º 1
0
    def OnWhiz(self, evt):
        self.x += numerix.pi / 15
        self.y += numerix.pi / 20
        z = numerix.sin(self.x) + numerix.cos(self.y)
        self.im.set_array(z)

        zmax = numerix.max(numerix.max(z)) - ERR_TOL
        ymax_i, xmax_i = numerix.nonzero(numerix.greater_equal(z, zmax))
        if self.im.origin == 'upper':
            ymax_i = z.shape[0] - ymax_i
        self.lines[0].set_data(xmax_i, ymax_i)

        self.canvas.draw()
Ejemplo n.º 2
0
    def OnWhiz(self,evt):
        self.x += numerix.pi/15
        self.y += numerix.pi/20
        z = numerix.sin(self.x) + numerix.cos(self.y)
        self.im.set_array(z)

        zmax = mlab.max(mlab.max(z))-ERR_TOL
        ymax_i, xmax_i = numerix.nonzero(
            numerix.greater_equal(z, zmax))
        if self.im.origin == 'upper':
            ymax_i = z.shape[0]-ymax_i
        self.lines[0].set_data(xmax_i,ymax_i)

        self.canvas.draw()
Ejemplo n.º 3
0
    def init_plot_data(self):
        a = self.fig.add_subplot(111)
        
        x = numerix.arange(120.0)*2*numerix.pi/60.0
        y = numerix.arange(100.0)*2*numerix.pi/50.0
        self.x, self.y = meshgrid(x, y)
        z = numerix.sin(self.x) + numerix.cos(self.y)
        self.im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest')
        
        zmax = numerix.max(numerix.max(z))-ERR_TOL
        ymax_i, xmax_i = numerix.nonzero(
            numerix.greater_equal(z, zmax))
        if self.im.origin == 'upper':
            ymax_i = z.shape[0]-ymax_i
        self.lines = a.plot(xmax_i,ymax_i,'ko')

        self.toolbar.update() # Not sure why this is needed - ADS
Ejemplo n.º 4
0
    raise ImportError('this example requires numpy')
import matplotlib.numerix.ma as MA
import matplotlib.numerix as N
from matplotlib.toolkits.basemap import Basemap

# read in data from netCDF file.
infile    = 'ccsm_popgrid.nc'
fpin      = NetCDFFile(infile)
tlat      = fpin.variables['TLAT'][:]
tlon      = fpin.variables['TLONG'][:]
temp      = fpin.variables['TEMP'][:]
fillvalue = fpin.variables['TEMP'].attributes['_FillValue']
fpin.close()

# make longitudes monotonically increasing.
tlon = N.where(N.greater_equal(tlon,min(tlon[:,0])),tlon-360,tlon)

# create a masked array with temperature data (continents masked).
temp = MA.masked_values(temp,fillvalue)

# stack grids side-by-side (in longitiudinal direction), so
# any range of longitudes may be plotted on a world map.
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, \
Ejemplo n.º 5
0
    raise ImportError('this example requires numpy')
import matplotlib.numerix.ma as MA
import matplotlib.numerix as N
from matplotlib.toolkits.basemap import Basemap

# read in data from netCDF file.
infile = 'ccsm_popgrid.nc'
fpin = NetCDFFile(infile)
tlat = fpin.variables['TLAT'][:]
tlon = fpin.variables['TLONG'][:]
temp = fpin.variables['TEMP'][:]
fillvalue = fpin.variables['TEMP'].attributes['_FillValue']
fpin.close()

# make longitudes monotonically increasing.
tlon = N.where(N.greater_equal(tlon, min(tlon[:, 0])), tlon - 360, tlon)

# create a masked array with temperature data (continents masked).
temp = MA.masked_values(temp, fillvalue)

# stack grids side-by-side (in longitiudinal direction), so
# any range of longitudes may be plotted on a world map.
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, \