2320 Rate this article:
No rating

Determining a library version

Mark Alonzo
(I've been out for a week, so today's post is short. I'll return shortly to the sunspot number data from last week's post.) What's the version number of the GRIB library in the current IDL release? I should probably know this off the top of my head, but I don't. Ray Sterner (JHU/APL) suggested it would be nice if there was a way to quickly get library information without searching through the docs. Most of the external libraries included in IDL are dynamically linked; we call them DLMs (and everything I know about them I learned from Ronn Kling's book). Jim Pendleton used this fact to write a program to parse the output of
IDL> help, /dlm
into a data structure using built-in IDL string processing routines. Here's a modified version of Jim's program:
function dlmversions
   compile_opt idl2
   on_error, 2

   help, /dlm, output=out

   h = hash()

   for i=0, n_elements(out)-1, 3 do begin
      module = (strsplit(out[i], ' ', /extract))[1]
      pos_colon = strpos(out[i+1], ':')
      pos_comma = strpos(out[i+1], ',')
      version = strmid(out[i+1], pos_colon+1, pos_comma-(pos_colon+1))
      h[module] = strtrim(version, 2)

   return, h.tostruct()
So, what is the version of the GRIB library included in the current IDL release?
IDL> .compile dlmversions
IDL> v = dlmversions()
IDL> print, v.grib
Now I know! I'd like to include a routine like this in the IDL distribution. Would you use it?

Please login or register to post comments.