Creating a multi-record GRIB file
I'm a little embarrassed about this, but last week I
learned (or maybe "recalled" is more accurate) that you can
create multi-record GRIB files using only the
command. For example, with files
b.grb, I can make a new file
$ cat a.grb b.grb > c.grb
To perform the equivalent action solely within IDL, read the
files as a bytestream, concatenate the data, then write the data back
as a bytestream; e.g.:
IDL> a = read_binary('a.grb')
IDL> b = read_binary('b.grb')
IDL> c = [a, b]
IDL> openw, u, 'c.grb', /get_lun
IDL> writeu, u, c
IDL> free_lun, u
That's it. What do you think?
Actually, while writing this, I thought of a pair of feature requests.
- To complement the other FILE_* routines
etc.), should IDL have a FILE_CAT routine? This would allow
Windows users to have a UNIX "cat" equivalent in IDL.
- As a complement
should we have a WRITE_BINARY? It would bring the three lines
of code used above down to one.