Exemple #1
0
This class has methods as: filled contour plot, line contour plot,
pseudo-color plot, quiver plot and save.

'''

# Create a Nansat object (n)
n = Nansat(iFileName)
# Get data from 1st, 2nd and 3rd bands as numpy array (u,v and w)
u = n[1]; v = n[2]; w = n[3]

# Create Nansatmap object from nansat (domain) object
nMap = Nansatmap(n)
# draw filled contour plot
nMap.contourf(w, v=range(4, 22, 2))
# draw black smooth contour plot with labels
nMap.contour(w, smooth=True, fontsize=8, colors='k')
# add colorbar
nMap.add_colorbar(fontsize=10)
# add geocoordinates
nMap.drawgrid()
# save to a file
nMap.save(oFileName + '01_contourf_contour.png', landmask=False)

# Create Nansatmap object from nansat (domain) object
nMap = Nansatmap(n, resolution='l')
# pseudo-color plot over the map
nMap.pcolormesh(w)
# quiver plot
nMap.quiver(v, u, quivectors=20)
# save to a file
nMap.save(oFileName + '02_pcolormesh_quiver.png')
Exemple #2
0
iFileName = os.path.join(iPath, 'map.tif')
print 'Input file: ', iFileName
oFileName = os.path.join(iPath, 'tmpdata', 'outputmap_')
print 'Output file prefix: ', oFileName

# Create a Nansat object (n)
n = Nansat(iFileName)
# Get data from 1st, 2nd and 3rd bands as numpy array (u,v and w)
u = n[1]; v = n[2]; w = n[3]


nMap = Nansatmap(n)
# draw filled contour plot
nMap.contourf(w)
# draw black smooth contour plot with labels
nMap.contour(w, smooth=True, fontsize=8, colors='k')
# add colorbar
nMap.add_colorbar(fontsize=10)
# add geocoordinates
nMap.drawgrid()
# save to a file
nMap.save(oFileName+'contourf_contour.png', landmask=False)


nMap = Nansatmap(n, resolution='h')
# pseudo-color plot over the map
nMap.pcolormesh(w)
# quiver plot
nMap.quiver(u, v, quivectors=20)
nMap.save(oFileName+'pcolormesh_quiver.png')