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 
Switch to threaded view of this topic Create a new topic Submit Reply
export to HDF [message #71321] Wed, 16 June 2010 03:26 Go to next message
Hassan is currently offline  Hassan
Messages: 48
Registered: October 2009
Member
I have some data which is supplied in HDF data files compatible to HDF
version 4.1r3. The HDF file contains: Annotations, RCI image and V
Data-Gain settings and V data- Mode information. I opened the data
(the RCI image) in ENVI and chose an ROI and now wonder how I can save
it in HDF format with the same information as original data but new
dimensions. I also want to change one of the variables in HDF format.
I wonder if it's possible to do that in IDL or any other softwares.
you may even know a reference about that which it'd be great if you
send me the link so I can read how I can do that. I know there's
hdf_sd_create in idl but think it's for creating new hdf file with new
information.
Re: export to HDF [message #71398 is a reply to message #71321] Wed, 16 June 2010 15:12 Go to previous message
Hassan is currently offline  Hassan
Messages: 48
Registered: October 2009
Member
Thanks for the information. It seems to me we are crating a new HDF
file and writing new attributes to them that it is different with what
I need which is keeping the attributes from original one and changing
the dimension part or copying the arribute from original file into new
file and adding new dimensions. or I may misunderstood it since Im not
familar with HDF files.
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.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: USERSYM custom symbol help
Next Topic: sort arrays based on names

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

Current Time: Wed Oct 08 11:37:02 PDT 2025

Total time taken to generate the page: 0.00488 seconds