The HDF_VD_WRITE procedure stores data in a VData in a Hierarchical Data Format file.
There are many restrictions on writing data to a VData . When writing multiple fields of varying types, only limited error checking is possible. When writing a series of fields all with the same type, data is converted to that type before writing. For example:
Vdat = HDF_VD_ATTACH(Fid, -1, /WRITE)
Data = INDGEN(10) ; Create a 10 integer vector.
HDF_VD_WRITE, Vdat, 'PX', Data ; Data converted to FLOAT before write.
It is possible to write less data than exists in Data by using the NRECORDS keyword. For example, the following command writes 5 records, instead of the 10 implied by the size of the data (VEL is assumed to be of type FLOAT, order=3):
HDF_VD_WRITE, Vdat, 'VEL', FINDGEN(3,10),NREC=5
VEL now contains [ [ 0.0, 1.0, 2.0 ], ..., [ 12.0, 13.0, 14.0] ]
HDF_VD_WRITE will not allow a user to specify more records than exist. For example, the following command fails:
HDF_VD_WRITE, Vdat, 'VEL', [1,2,3], NREC=1000
Data can not be appended. Attempts to append data may make future attempts to read data fail. Data can not be overwritten.
It is not possible to write IDL structures directly to a VData (because of possible internal padding depending upon fields/machine architecture, etc.). The user must put the data into a byte array before using HDF_VD_WRITE.
When writing a series of fields all with the same type, the low order dimension of Data must match the sum of the orders of the fields. For example:
HDF_VD_WRITE, Vdat, 'PX,PY', FLTARR(3,10)
fails. PX and PY are both order 1 (total 2) and the array's low order dimension is 3.