partRads=chan31[:max_rows,:max_cols] partMask=maskout[:max_rows,:max_cols] partLand=landout[:max_rows,:max_cols] partChan1rad=chan1[:max_rows,:max_cols] partChan1ref=chan1ref[:max_rows,:max_cols] numlatbins=800 numlonbins=600 bin_lats=fastbin(south,north,numlatbins,-999,-888) bin_lons=fastbin(west,east,numlonbins,-999,-888) lon_centers=bin_lons.get_centers() lat_centers=bin_lats.get_centers() new_hist=fh.pyhist(partLats,partLons,bin_lats,bin_lons) chan31_grid=new_hist.get_mean(partRads) mask_grid=new_hist.get_mean(partMask) land_grid=new_hist.get_mean(partLand) chan1rad_grid=new_hist.get_mean(partChan1rad) chan1ref_grid=new_hist.get_mean(partChan1ref) fig1=plt.figure(1) fig1.clf() axis1=fig1.add_subplot(111) im=axis1.pcolormesh(lon_centers,lat_centers,chan31_grid,cmap=cmap,\ norm=the_norm) cb=plt.colorbar(im,extend='both') the_label=cb.ax.set_ylabel('radiances ($W\,m^{-2}\,{\mu m}^{-1}\,sr^{-1}$)',rotation=270) axis1.set_title('MODIS channel 31 radiances (lat/lon binned)')
north = lat_grid[0,0] south = lat_grid[2399,0] east = lon_grid[2399,2399] west = lon_grid[0,0] #lat/lon bins bin_lats=fastbin(south,north,numlatbins,-999,-888) bin_lons=fastbin(west,east,numlonbins,-999,-888) #lat/lon centers lon_centers=bin_lons.get_centers() lat_centers=bin_lats.get_centers() lon_centers_lst.append(lon_centers) lat_centers_lst.append(lat_centers) new_hist=fh.pyhist(lat_grid,lon_grid,bin_lats,bin_lons) lat_lon_counts=new_hist.get_hist2d() dirname='plots' make_dir(dirname) granule_info='count' #Figure 1: Lat/lon bin count fig1 = plt.figure(figcount) fig1.clf() cmap=cm.RdBu_r cmap.set_over('y') cmap.set_under('k') vmin= 0 vmax= 20 the_norm=Normalize(vmin=vmin,vmax=vmax,clip=False)
# lon_hit = np.logical_and(lon_centers > -120, lon_centers < -115) lon_indices = np.where(lon_hit)[0] lat_hit = np.logical_and(lat_centers > 20, lat_centers < 25) lat_indices = np.where(lat_hit)[0] sub_lons = lon_centers[lon_indices] sub_lats = lat_centers[lat_indices] sub_chan1ref = chan1ref_grid[lat_indices[0] : lat_indices[-1], lon_indices[0] : lon_indices[-1]] sub_chan31 = chan31_grid[lat_indices[0] : lat_indices[-1], lon_indices[0] : lon_indices[-1]] bin_chan1ref = fastbin(0.05, 0.6, 50.0, -999, -888) bin_chan31 = fastbin(2.0, 18.0, 50.0, -999, -888) chan1_centers = bin_chan1ref.get_centers() chan31_centers = bin_chan31.get_centers() the_hist = fh.pyhist(sub_chan31, sub_chan1ref, bin_chan31, bin_chan1ref) counts = the_hist.get_hist2d() cmap = cm.RdBu_r cmap.set_over("y") cmap.set_under("k") vmin = 10.0 vmax = 400.0 the_norm = Normalize(vmin=vmin, vmax=vmax, clip=False) counts = counts.astype(np.float32) ## hit= (counts == 0) ## counts[hit] = 1.e-3 ## log_counts=np.log10(counts) fig1 = plt.figure(1)
import numpy as np import fasthist as fh the_length = 15 test = np.ones([the_length], dtype=np.float32) new_hist = fh.pyhist(test) print new_hist.get_data() print new_hist.indata
depolMPL = crosspolvals/copolvals depolvals = depolMPL/(depolMPL+1) copol_mean = np.mean(copolvals) copol_std = np.std(copolvals) copol_min = copol_mean-copol_std copol_max = copol_mean+copol_std bin_copol=fastbin(0.,0.002,100.,-999,-888) bin_depol=fastbin(0.,2.0,100.,-999,-888) copol_centers=bin_copol.get_centers() depol_centers=bin_depol.get_centers() the_hist=fh.pyhist(depolvals,copolvals,bin_depol,bin_copol) counts=the_hist.get_hist2d() cmap=cm.RdBu_r cmap.set_over('y') cmap.set_under('k') counts=counts.astype(np.float32) vmin= 0. vmax= 4 the_norm=Normalize(vmin=vmin,vmax=vmax,clip=False) hit= (counts <= 0) counts[hit] = 1.e-3 log_counts=np.log10(counts) olddir = os.getcwd()