comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDL HDF Question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL HDF Question [message #25018] Mon, 07 May 2001 13:32
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
David Rapchun wrote:
> Is it possible to create an SD in a HDF file that is "growable" i.e.
> I do not know the dimension ahead of time. This can be a 1D SD, but
> it needs to be growable...

To create a SDS with an unlimited dimension, set the size of the last
dimension to zero in the call to HDF_SD_CREATE, as shown in the
following example:

PRO TEST

;- Get data
file = filepath('ctscan.dat', subdir='examples/data')
openr, lun, file, /get_lun
data = bytarr(256, 256)
readu, lun, data
free_lun, lun

;- Create the file
hdfid = hdf_sd_start('ctscan.hdf', /create)
dims = [256L, 0L] ; NOTE Last dimension is zero
varid = hdf_sd_create(hdfid, 'image', dims, /byte)
hdf_sd_endaccess, varid
hdf_sd_end, hdfid

;- Write the data one row at a time
hdfid = hdf_sd_start('ctscan.hdf', /rdwr)
index = hdf_sd_nametoindex(hdfid, 'image')
varid = hdf_sd_select(hdfid, index)
for row = 0, 255 do begin
hdf_sd_adddata, varid, data[*, row], start=[0, row]
endfor
hdf_sd_endaccess, varid
hdf_sd_end, hdfid

END

To run the example program:

IDL> .compile test
IDL> test

To check the contents of the file, I used ncdump:

% ncdump -h ctscan.hdf
netcdf ctscan {
dimensions:
fakeDim0 = UNLIMITED ; // (256 currently)
fakeDim1 = 256 ;

variables:
byte image(fakeDim0, fakeDim1) ;
}

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley/
[Message index]
 
Read Message
Previous Topic: IDL HDF Question
Next Topic: Urgent: gif files generation via telnet

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 19:23:28 PDT 2025

Total time taken to generate the page: 0.13491 seconds