私は、NSIDC から極格子状の海氷濃度のいくつかのプロットを作成しようとしています。データは、極平射図法とグリッドで配信されます。サンプル ファイル (バイナリ、北極、解像度 25 km) は、http: //nsidc.org/data/NSIDC-0081からダウンロードできます。
numpy を使用してデータを読み取り、matplotlib の imshow 関数を使用してプロットすると、機能します。
import numpy as np
import matplotlib.pyplot as plt
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()
#Show ice concentration
plt.imshow(ice)
Cartopy を使用してプロットしようとすると、エラーなしで実行されますが、空の海岸線しか返されません。
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())
何か間違っていますか?氷の濃度データを表示するにはどうすればよいですか?
私の Cartopy のバージョンは 0.12.0rc1 です。
以下は、ドキュメントの北極極平射グリッドです。
北半球のグリッド座標
X (km) Y (km) Latitude (deg) Longitude (deg)
-3850 5850 30.98 168.35 corner
3750 5850 31.37 102.34 corner
3750 -5350 34.35 350.03 corner
-3850 -5350 33.92 279.26 corner
IPythonノートブックは次のとおりです。