Re: Need help with HDF_VD_WRITE!!! [message #32513 is a reply to message #32505] |
Thu, 10 October 2002 08:35  |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
> Brian Huether wrote:
>
> This is quite maddening. I am using IDL 5.2 and am working with HDF
> files. Consider an array with 2 columns, where each col is a field and
> each row a record. In the language of HDF, that would be a VDATA. In
> theory, then the following commands should work:
>
> fid=HDF_OPEN('test.hdf',/CREATE)
> Vdat2 = HDF_VD_ATTACH(fid, -1, /WRITE)
Before you can write any records, you first need to call HDF_VD_DEFINE
to define each field in the vdata:
IDL> HDF_VD_FDEFINE, Vdat2, 'F1', /FLOAT
IDL> HDF_VD_FDEFINE, Vdat2, 'F2', /FLOAT
> HDF_VD_WRITE, Vdat2, 'F1,F2', fltarr(2,10)
I'm not entirely sure what the field list argument is for in
HDF_VD_WRITE. The corresponding raw HDF function can only write an
entire record, and can only be called for a vdata that has already had
it's fields defined. I tried the following:
IDL> HDF_VD_WRITE, Vdat2, 'F1', 1.0
% HDF_VD_WRITE: Insufficient data in item (<FLOAT ( 1.00000)>)
to
write even 1 record.
However, the following was accepted:
HDF_VD_WRITE, Vdat2, 'F1', [1.0,2.0]
And vshow gave me the following results after I closed the file:
FILE: test.hdf
No vgroups in this file
Lone vdatas:
L vs:2 <1962/2> nv=11 i=0 fld [F1,F2] vsize=8 (NoName {})
0: fld [F1], type=5, order=1
1: fld [F2], type=5, order=1
0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
0.000000
0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
0.000000
0.000000 0.000000 0.000000 0.000000 1.000000 2.000000
0 attributes.
Which looks to me like it wrote [1.0,2.0] exactly as if I'd indicated
"F1,F2", rather than simply "F1". So I'm confused.
--
James Kuyper
MODIS Level 1 Lead
Science Data Support Team
(301) 352-2150
|
|
|