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

Home » Public Forums » archive » Re: HDF Data sets containg strings?
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: HDF Data sets containg strings? [message #13317 is a reply to message #13302] Sun, 01 November 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Richard Penrose (rpenrose@uk.ibm.com) writes:

> I would very much like to be able to append an array of three character
> strings to an HDF file using the 'HDF_SD_ADDDATA' command. I have tried
> to do this without any luck, and can find no documentation to help me
> with this.
>
> In the end I have had to resort to appending a 3*n dimensional array,
> i.e. 3 characters * however many dimensions are required.
>
> Does anyone have a solution to this problem, I would be most grateful!

I'm no HDF expert by any means, but a quick look at the
HDF chapter in my IDL Programming Techniques book suggests that
the HDF_SD_ADDDATA command is for adding a "slab" of data.
I understand "slab" to mean a two or three dimensional
array which has been assigned an SDS identifier with the
HDF_SD_Create command. For character data, I guess I would
use a byte array. Probably something like this:

strArray = StrArr(4)
strArray[0] = 'ABC'
strArray[1] = 'DEF'
strArray[2] = 'GHI'
strArray[3] = 'JKL'
hdfFileID = HDF_SD_START('newfile.hdf')
sdsID = HDF_SD_CREATE(hdfFileID, 'Comment Array', [3,4], /Byte)
HDF_SD_ADDDATA, sdsID, Byte(strArray)

Another alternative is to add each string to the file as a file
attribute with the HDF_SD_AttrSet command.

Cheers,

David
----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/

Note: A copy of this article was e-mailed to the original poster.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Differences between ' and ", syntax error (bug?)
Next Topic: Re: Object Surface Shaded by Elevation (LONG)

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

Current Time: Sun Oct 12 00:28:04 PDT 2025

Total time taken to generate the page: 0.72371 seconds