WRF / WPS > Jupyter Notebook > OI SST(NetCDFファイル)を読込みMatplotlibで画像表示
動作環境
Xeon E5-2620 v4 (8コア) x 2
32GB RAM
CentOS Linux release 7.7.1908 (Core)
Python 3.6.8 (default, Aug 7 2019, 17:28:10)
IPython 7.9.0 -- An enhanced Interactive Python. Type '?' for help.
関連
実装
OI SSTファイル(NetCDF形式)を読込んで画像表示する。
ReadNetCDF_200116.ipynb
import netCDF4
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
INFILE = '20200111120000-NCEI-L4_GHRSST-SSTblend-AVHRR_OI-GLOB-v02.0-fv02.0.nc'
nc = netCDF4.Dataset(INFILE, 'r')
nlat = len(nc.dimensions['lat'])
nlon = len(nc.dimensions['lon'])
lons = nc.variables['lon'][:]
lats = nc.variables['lat'][:]
ssts = nc.variables['analysed_sst'][:]
print(nlat, nlon)
#print(lons)
#print(lats)
#print(ssts)
nc.close()
grid = ssts.reshape((nlat, nlon))
plt.imshow(grid, interpolation='nearest', cmap=cm.gist_rainbow)
plt.colorbar()
結果
上下反対になったが、実際にはlat, lon情報をもとに後続の処理で使う予定。
lats, lonsは0.25刻みのデータであった。
参考
情報感謝です。
Author And Source
この問題について(WRF / WPS > Jupyter Notebook > OI SST(NetCDFファイル)を読込みMatplotlibで画像表示), 我々は、より多くの情報をここで見つけました https://qiita.com/7of9/items/11c622291ff7f562b687著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .