Routines (alphabetical) > Routines: H > HDF Routines > HDF_VD_WRITE

# HDF_VD_WRITE

The HDF_VD_WRITE procedure stores data in a VData in an HDF 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)

; Create a 10 integer vector:

Data = INDGEN(10)

; Data converted to FLOAT before write:

HDF_VD_WRITE, Vdat, 'PX', Data

It is possible to write less data than exists in the Data argument 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

### Known Issues

HDF vdatas can only be appended or overwritten if they are defined at creation with a file interlacing mode of FULL_INTERLACE. Records in a fully interlaced vdata are written record-by-record which allows them to be appended or overwritten. For further information, consult the “Writing to Multi-Field Vdatas” section in the HDF User's Guide published by the National Center for Supercomputing (available at

http://www.hdfgroup.org/training/HDFtraining/UsersGuide/Vdatas.fm4.html).

### Restrictions

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.

## Syntax

HDF_VD_WRITE, VData, Fields, Data [, /FULL_INTERLACE | , /NO_INTERLACE] [, NRECORDS=records]

## Arguments

### VData

The VData handle returned by a previous call to HDF_VD_ATTACH.

### Fields

A string containing a comma-separated list of the fields to be written.

### Data

The data to be written to the specified VData.

## Keywords

### FULL_INTERLACE

Set this keyword to use full interlace when writing (the default).

### NO_INTERLACE

Set this keyword to use no interlace when writing.

### NRECORDS

The number of records to written. By default, HDF_VD_WRITE writes all records from a VData.

## Version History

4.0 | Introduced