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

Home » Public Forums » archive » export to HDF
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: export to HDF [message #71403 is a reply to message #71321] Wed, 16 June 2010 12:19 Go to previous message
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
Hassan,

The solution you will end up with will look a lot like creating a new
HDF file, even if you populate it mostly with information from the
parent file. If the file has many SDS, this can be rather tedious, but
assuming you have a bunch of files to process, it's the way to go.

This is the call sequence for creating and populating an HDF. NOTE:
This does NOT use HDF_OPEN() or HDF_CLOSE. It needs a better
programmer than I to explain why, but this is complete sequence, the
result of trial and error:

SDinterface_id = HDF_SD_START(<<outfile>>, /CREATE)
title=<<"TITLE OF NEW HDF FILE">>
HDF_SD_ATTRSET, SDinterface_id, 'TITLE',title
; create SDS in HDF file
for isds=0,nsds-1 do begin
SDdataset_id =
HDF_SD_CREATE(SDinterface_id,<<SDS_NAME>>,<<SDS_DIMS>>,hdf_type= <<datatypes_idl2hdf[SDS_TYPE]>>)
HDF_SD_ADDDATA,SDdataset_id,<<SDS_DATA>>
HDF_SD_ENDACCESS, SDdataset_id
endfor
;; shut it down
HDF_SD_END, SDinterface_id

You will need, for each SDS:
SDS_NAME
SDS_DIMS = SIZE(SDS,/DIM)
SDS_TYPE = DATATYPES_IDL2HDF[SIZE(SDS,/TYPE)]; see NOTE
SDS_DATA

NOTE: This array converts between the output of SIZE and the data type
codes used by the HDF interface. See the help for more details:

DATATYPES_IDL2HDF=[-1,21,22,24,5,6,-1,-1,-1,-1,-1,-1,23,25,2 6,27]

Hope this helps,

--Edward H.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: USERSYM custom symbol help
Next Topic: sort arrays based on names

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

Current Time: Sun Oct 12 00:08:15 PDT 2025

Total time taken to generate the page: 0.08528 seconds