def test_imshow_random(self): ''' Should use Nansatmap.imshow ''' n = Nansat(self.test_file_stere, logLevel=40) b1 = n[1] nmap = Nansatmap(n) nmap.imshow(b1/5, cmap='random') nmap.add_colorbar() tmpfilename = os.path.join(ntd.tmp_data_path, 'nansatmap_imshow_random.png') nmap.save(tmpfilename) self.assertTrue(os.path.exists(tmpfilename))
def test_imshow_random(self): ''' Should use Nansatmap.imshow ''' n = Nansat(self.test_file_stere, logLevel=40) b1 = n[1] nmap = Nansatmap(n) nmap.imshow(b1 / 5, cmap='random') nmap.add_colorbar() tmpfilename = os.path.join(ntd.tmp_data_path, 'nansatmap_imshow_random.png') nmap.save(tmpfilename) self.assertTrue(os.path.exists(tmpfilename))
''' # 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') # use Nansatmap for converting lon/lat into x/y
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')