Mrjones
Mrjones

Reputation: 21

Downloading GRIB files directly into Matlab

I want to read in data from the GFS weather forecasting model. The NOAA has some URL links from which the data can be downloaded, e.g.:

https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25_1hr.pl?file=gfs.t06z.pgrb2.0p25.f005&lev_surface=on&var_CAPE=on&leftlon=0&rightlon=360&toplat=90&bottomlat=-90&dir=%2Fgfs.2019053006

In the internet browser, this link automatically downloads a file (but which format?). In Matlab I do the following:

fullURL = ['https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25_1hr.pl?file=gfs.t06z.pgrb2.0p25.f011&lev_surface=on&var_CAPE=on&leftlon=0&rightlon=360&toplat=90&bottomlat=-90&dir=%2Fgfs.2019053006'];

filename = 'cape_test.anl';

urlwrite(fullURL,filename);

These files open well in GIS software such as QGIS or ArcGIS. But how can I now read in these files automatically in MatLab so I can display them with the imagesc() command? Trying NCToolbox didn't work.

Upvotes: 1

Views: 312

Answers (1)

Jay
Jay

Reputation: 185

Why don't you download the file first. Then build a script to look up directories inside a folder.

Could even source from the browser download folder.

% Directory

directory = 'C:\Datasets\NOAA\myfile';

%Do stuff

Upvotes: 1

Related Questions