|
On Tuesday, June 19, 2012 11:40:08 AM UTC+12, Eric Bryant wrote:
> Hi -
>
> I have been trying to read National Stage IV QPE (WMO GRIB1, i believe) dada using read_grib.m, which I downloaded from http://www.renci.org/~bblanton/files/ReadGrib/read_grib.html.
>
> I have been confused by the following output
>
> >> grib_struct=read_grib('/home/ecb27/Test/hello',-1)
> Searching for first GRIB marker...
> GRiB Record marker "GRIB" found at chars 1-4
> GRiB header =
> GRIB
> Error using get_gds (line 143)
> DRT 5 not yet coded.
>
> Error in extract_grib (line 22)
> gds_struct=get_gds(fid,lengds);
>
> Error in read_grib (line 318)
> [pds_struct,gds_struct,bms_struct,bds_struct,dataarray]=...
>
> Could someone clue me in? Appreciated if possible,
>
> Eric
>
>
> *************************************
> This is the data product:
>
> http://www.emc.ncep.noaa.gov/mmb/ylin/pcpanl/stage4/
>
> When I run wgrib (from the command line), this is what I get:
>
> $ wgrib -V ~/Test/ST4.2007010101.01h.grb
> rec 1:0:date 2007010100 APCP kpds5=61 kpds6=1 kpds7=0 levels=(0,0) grid=255 sfc 0-1hr acc: bitmap: 324979 undef
> APCP=Total precipitation [kg/m^2]
> timerange 4 P1 0 P2 1 TimeU 1 nx 1121 ny 881 GDS grid 5 num_in_ave 0 missing 0
> center 7 subcenter 4 process 182 Table 2 scan: WE:SN winds(grid)
> polar stereo: Lat1 23.117000 Long1 -119.023000 Orient -105.000000
> north pole (1121 x 881) Dx 4763 Dy 4763 scan 64 mode 8
> min/max data 0 322.13 num bits 15 BDS_Ref 0 DecScale 2 BinScale 0
>
> In contrast, this wgrib output for a file that I got working with read_grib.m:
>
> $ wgrib -V ~/Test/NARR.200701010.grb
> rec 53:6237000:date 2007010100 ULWRF kpds5=212 kpds6=1 kpds7=0 levels=(0,0) grid=221 sfc 3hr fcst: bitmap: 1648 undef
> ULWRF=Upward long wave radiation flux [W/m^2]
> timerange 0 P1 3 P2 0 TimeU 1 nx 349 ny 277 GDS grid 3 num_in_ave 0 missing 0
> center 7 subcenter 15 process 140 Table 131 scan: WE:SN winds(N/S)
> Lambert Conf: Lat1 1.000000 Lon1 -145.500000 Lov -107.000000
> Latin1 50.000000 Latin2 50.000000 LatSP 0.000000 LonSP 0.000000
> North Pole (349 x 277) Dx 32.463000 Dy 32.463000 scan 64 mode 0
> min/max data 147.562 497.812 num bits 13 BDS_Ref 147.562 DecScale 0 BinScale -4
In the old days, I used to use read_grib for accessing .grb files, but now I've found I can read them using netCDF routines (they have a Java backend).
If you have a modern Matlab, the netCDF routines are built-in.
If you have an old version as I have (R2006a), you'd need to install snctools and mexcdf.
e.g., here's how to read in significant wave height for all the time data for a particular location from an MWW3 grib file using snctools:
Hs=nc_varget(grbfile,...
'Significant_height_of_combined_wind_waves_and_swell',...
[ilon ilat 0],[1 1 nt]);
|