GRIB_PUTDATA

This procedure adds a new record to an existing GRIB file. If the file does not exists, IDL will create a file in the specified location.

Examples

In this example, we locate a GRIB file on disk, create a copy in the current directory

file = FILEPATH('atl.grb2', $

   SUBDIRECTORY=['examples','data'])

FILE_COPY,file,'atl.grb2'

GRIB_LIST,'atl.grb2'

IDL displays:

1

crain

DOUBLEARRAY[141151]

2

usct

DOUBLEARRAY[141151]

3

vsct

DOUBLEARRAY[141151]

4

tsec

DOUBLEARRAY[141151]

Now we create a GRIB record and add it to the file:

record = ORDEREDHASH()

record['values'] = dblarr(1024)

GRIB_PUTDATA, file, record

Now we check to see if the record has been added:

GRIB_LIST, file

IDL displays:

1

crain

DOUBLEARRAY[141151]

2

usct

DOUBLEARRAY[141151]

3

vsct

DOUBLEARRAY[141151]

4

tsec

DOUBLEARRAY[141151]

5

t

DOUBLEARRAY[1024]

Syntax

GRIB_PUTDATA, filename, record

Arguments

FILENAME

A string denoting the name of the GRIB file for which IDL will append to/create.

RECORD

An ORDEREDHASH of the record IDL will add to the file. IDL does not check the validity of the record. The user is expected to know which keys they can insert into the record. If a new file is being created, the record is expected to have the GRIBEditionNumber key specifying the type of GRIB file.

Note: GRIBEditionNumber can have a value of 1 or 2, signifying GRIB edition 1 or GRIB edition 2 respectively.

Version History

8.3

Introduced

See Also

GRIB_GETDATA, GRIB_LIST, HASH, ORDEREDHASH