1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| def fy4disk(rawfile,dim): sz = np.fromfile(rawfile, dtype=float, count=dim*dim*2) latlon = np.reshape(sz,(dim,dim,2))
lat = latlon[:,:,0] lon = latlon[:,:,1]
lat[lat > 100] = -9999. lon[lon < 0 ] = lon[lon < 0 ] + 360. lon[lon > 361] = -9999.
return lon, lat
def fy4disk(rawfile,dim): sz = np.fromfile(rawfile, dtype=float, count=dim*dim*2) latlon = np.reshape(sz,(dim,dim,2))
lat = latlon[:,:,0] lon = latlon[:,:,1]
lat[lat > 100] = np.nan lon[lon < 0 ] = lon[lon < 0 ] + 360. lon[lon > 361] = np.nan
return lon, lat
rawfile = r'H:\gOOLE\FullMask_Grid_4000\FullMask_Grid_4000.raw'
dim = 2748
lon, lat = fy4disk(rawfile,dim)
SST=np.array(SST) SST=np.ma.masked_where(SST<=-5,SST) SST=np.ma.masked_where(SST>=45,SST) fig = plt.figure(figsize=(16, 16)) plt.axis('off') proj = ccrs.PlateCarree() ax = plt.axes(projection=proj) extent = [70, 140, 0, 60] ax.set_extent(extent, proj) cs = ax.contourf(lon, lat, SST, transform=proj, cmap='rainbow') ax.background_patch.set_visible(False) ax.outline_patch.set_visible(False) plt.savefig(os.path.splitext(f1)[0],dpi=300, facecolor='w', edgecolor='w', orientation='portrait',transparent=True)
|