Plot Polar Stereographic Projection and Grid Arctic sea ice concentration. An example file (binary,Arctic,25 km resolution) can be downloaded at: http://nsidc.org/data/NSIDC-0081
import numpy as np
infile='c:\\nt_20150326_f17_nrt_n.bin'
fr=open(infile,'rb')
hdr=fr.read(300)
ice=np.fromfile(fr,dtype=np.uint8)
ice=ice.reshape(448,304)
#Convert to the fractional parameter range of 0.0 to 1.0
ice = ice/250.
#mask all land and missing values
ice=np.ma.masked_greater(ice,1.0)
fr.close()
import matplotlib.pyplot as plt
plt.imshow(ice)
<matplotlib.image.AxesImage at 0x5152ff0>
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
fig=plt.figure(figsize=(3, 3))
ax = plt.axes(projection=ccrs.NorthPolarStereo())
ax.coastlines(resolution='110m',linewidth=0.5)
ax.set_extent([-180,180,50,90],crs=ccrs.PlateCarree())
ax.gridlines()
#set ice extent from Polar Stereographic Projection and Grid document
extent=[-9.97,168.35,30.98,34.35]
ax.imshow(ice,cmap=plt.cm.Blues, vmin=1,vmax=100,
extent=extent,transform=ccrs.PlateCarree())
<matplotlib.image.AxesImage at 0xbef4ef0>