def nansatFigure(nparr, mask, min, max, dir, fn, cmapName='gray'): f = Figure(nparr) f.process(cmin=min, cmax=max, cmapName=cmapName, mask_array=mask, mask_lut={0: [255, 0, 0]}) f.save(os.path.join(dir, fn), transparency=[255, 0, 0])
def nansatFigure(nparr, mask, min, max, dir, fn, cmapName='gray'): f = Figure(nparr) f.process( cmin = min, cmax = max, cmapName = cmapName, mask_array=mask, mask_lut={0:[255,0,0]} ) f.save(os.path.join(dir,fn), transparency=[255,0,0])
def test_add_latlon_grids_auto(self): ''' Should create figure with lon/lat gridlines spaced automatically ''' tmpfilename = os.path.join(ntd.tmp_data_path, 'figure_latlon_grids_auto.png') n = Nansat(self.test_file_gcps) b = n[1] lon, lat = n.get_geolocation_grids() f = Figure(b) f.process(clim='hist', lonGrid=lon, latGrid=lat) f.save(tmpfilename) self.assertEqual(type(f), Figure) self.assertTrue(os.path.exists(tmpfilename))
def test_add_latlon_grids_number(self): ''' Should create figure with lon/lat gridlines given manually ''' tmpfilename = os.path.join(self.tmp_data_path, 'figure_latlon_grids_number.png') n = Nansat(self.test_file_gcps, mapper=self.default_mapper) n.resize(3) b = n[1] lon, lat = n.get_geolocation_grids() f = Figure(b) f.process(cmax=100, lonGrid=lon, latGrid=lat, lonTicks=7, latTicks=7) f.save(tmpfilename) self.assertEqual(type(f), Figure) self.assertTrue(os.path.exists(tmpfilename))
def test_add_latlon_grids_list(self): ''' Should create figure with lon/lat gridlines given manually ''' tmpfilename = os.path.join(self.tmp_data_path, 'figure_latlon_grids_list.png') n = Nansat(self.test_file_gcps, mapper=self.default_mapper) b = n[1] lon, lat = n.get_geolocation_grids() f = Figure(b) f.process(clim='hist', lonGrid=lon, latGrid=lat, lonTicks=[28, 29, 30], latTicks=[70.5, 71, 71.5, 73]) f.save(tmpfilename) self.assertEqual(type(f), Figure) self.assertTrue(os.path.exists(tmpfilename))
This class has fllolowing methods: estimate min/max, apply logarithmic scaling, convert to uint8, append legend, save to a file ''' # Create a Nansat object (n) n = Nansat(iFileName) # get numpy array from the Nansat object array = n[1] # Create a Figure object (fig) fig = Figure(array) # Set minimum and maximum values fig.process(cmin=10, cmax=60) # Save the figure fig.save(oFileName + '01_clim.png') # Create a Figure object (fig) fig = Figure(array) # Compute min and max valuse from ratio clim = fig.clim_from_histogram(ratio=1.0) # Set cmin and cmax values fig.process(cmin=clim[0], cmax=clim[1]) # Save the figure fig.save(oFileName + '02_clim.png') # Create a Figure object (fig) fig = Figure(array) # Make indexed image with legend