Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- precipfile = "/Users/bolvin/oc.197901.sg"
- num_lon = 144
- num_lat = 72
- fileobj = open(precipfile, mode='rb')
- data = np.fromfile (fileobj, dtype ='f')
- data.byteswap(True)
- datat = np.reshape(data, (num_lon, num_lat), order = 'FORTRAN')
- datamasked = np.ma.masked_where(datat < 0.0, datat)
- my_cmap = matplotlib.colors.LinearSegmentedColormap('my_colormap',uneven_rgb)
- my_cmap.set_bad('k', 0.8)
- plt.figure(figsize = (20,10))
- mapproj = Basemap(projection = 'cyl', llcrnrlat=-90.0, llcrnrlon=0.0, urcrnrlat=90.0, urcrnrlon=360.0)
- mapproj.drawcoastlines()
- mapproj.drawcountries()
- mapproj.drawparallels(np.array([-90.0,-60.0,-30.0, 0.0, 30.0, 60.0, 90.0]), labels=[0,0,0,0])
- mapproj.drawmeridians(np.array([0.0, 90.0, 180.0, 270.0, 360.0]), labels=[0,0,0,0])
- myplot = plt.imshow(datamasked.T, interpolation = 'nearest', cmap = my_cmap,
- norm = matplotlib.colors.Normalize(vmin = 0.0, vmax = 20.0, clip = False),
- extent = (0.0, 360.0, -90.0, 90.0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement