4934 Rate this article:
No rating

Updates to the GRIB helper routines

Anonym
I’ve received feedback from several people that my GRIB_GET_RECORD routine was causing a nasty hard crash of IDL on 64-bit Linux and Mac OS X. Corinne James of Oregon State University emailed me recently with the problem both identified and solved (thank you, Corinne!): on 64-bit systems, the handle returned from GRIB_NEW_FROM_FILE is a 64-bit signed integer. I had incorrectly assumed a 32-bit integer. To see this, get a handle for the first record of the NCEP HiResWindow GRIB2 file I used in the previous GRIB helper routines post on a 32-bit system:
IDL> print, !version
{ x86 linux unix linux 8.2 Apr 10 2012      32      64}
IDL> f = '/home/mpiper/data/grib/HiResWindow/ak.t18z.pgrb.mean.f06.grib2'
IDL> fid = grib_open(f)
IDL> h = grib_new_from_file(fid)
IDL> help, h
H               LONG      =    149085464
and then do the same on a 64-bit system:
IDL> print, !version
{ x86_64 linux unix linux 8.2 Apr 10 2012      64      64}
IDL> f = '/home/mpiper/data/grib/HiResWindow/ak.t18z.pgrb.mean.f06.grib2'
IDL> fid = grib_open(f)
IDL> h = grib_new_from_file(fid)
IDL> help, h
H               LONG64    =        140301847196112
Note the handle is of type LONG64 on the 64-bit system. Unfortunately, this isn’t documented in the IDL Help. I now have both 32- and 64-bit Linux machines for development and testing, so hopefully I won’t make this mistake again. Please get the latest version of the GRIB helper routines from the Extensions Library, and, as before, let me know if you find GRIB files on which they fail.

SIGN UP AND STAY INFORMED

Sign up to receive the latest news, events, technologies and special offers.

SIGN ME UP