用Matlab读取GRiB2文件

时间:2013-04-22 23:08:21

标签: matlab grib

是否有任何工具箱可以将GRIB2数据读入Matlab?

一个例子(由NOAA建模的波浪)可以是ftp://polar.ncep.noaa.gov/pub/history/waves提供的GRIB2

1 个答案:

答案 0 :(得分:7)

NCTOOLBOX for Matlab中,您可以像打开本地NetCDF文件或远程OPeNDAP数据集一样打开GRIB2文件:

% download data
! wget ftp://polar.ncep.noaa.gov/pub/history/waves/multi_1.at_4m.dp.200607.grb2

% create ncgeodataset object
nc=ncgeodataset('multi_1.at_4m.dp.200607.grb2');

% list variables
nc.variables

% create geovariable object
dirvar=nc.geovariable('Primary_wave_direction_degree_true_surface');

% get data at 1st time step
dir=dirvar.data(1,:,:);

% get grid at 1st time step
g=dirvar.grid_interop(1,:,:);

% plot
pcolorjw(g.lon,g.lat,dir);
title(datestr(g.time))

enter image description here

相关问题