MATLAB可以借助NCTOOLBOX工具箱讀取grib2數據(.nc, .grb2等等也可以的哦)
首先在http://nctoolbox.github.io/nctoolbox/下載nctoolbox
解壓後在matlab command window中輸入
addpath((C:/xx/xxx/xxxx/nctoolbox))
savepath
setup_nctoolbox
現在人家就有了nctoolbox了^_^
-------grb2-------
nc=ncgeodataset('xxx.grb2');讀文件
nc.variables瀏覽數據類型
a1=nc.geovariable('height');取得數據類型為height的數據
b1=a1.data(1,:,:);第一個點時間的數據
c1=a1.grib_intercop(1,:,:);第一個點時間的地理位置
pcolorjw(c1.lon,c1.lat,b1);畫圖
title(datestr(c1.time))加上標題
-------grib2-------
nc=ncgeodataset('xxx.grib2');讀文件
nc.variables瀏覽數據類型,如height
nc.attritube('height','units');取得height的單位
nc.extent('height');取得height的經緯度範圍
a1=nc.geovariable('height');以ncgeovariable類型取得數據
a01=nc.varialbe('height');以variable類型取得數據
a001=nc.data('height');以普通數組類型取得數據
a1.axes看有甚麼數據,如time,lon,lat
a2=a1.data(:,:,:)以普通數組類型取得數據