使用Matlab读取GRiB2文件 [英] Reading GRiB2 files with Matlab

查看:1158
本文介绍了使用Matlab读取GRiB2文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有工具箱可以将GRIB2数据读入Matlab?

Are there any toolboxes, which allow reading GRIB2 data into Matlab?

一个示例(由NOAA建模的波浪)可以是GRIB2,可从 ftp://polar获得.ncep.noaa.gov/pub/history/waves

An example (waves modeled by NOAA) could be GRIB2 available from ftp://polar.ncep.noaa.gov/pub/history/waves

推荐答案

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

In NCTOOLBOX for Matlab, you can open a GRIB2 file just like a local NetCDF file or a remote OPeNDAP dataset:

% 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))

这篇关于使用Matlab读取GRiB2文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆