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

Home » Public Forums » archive » Re: Multiple datasets
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
Re: Multiple datasets [message #65527] Tue, 10 March 2009 19:28
Andi Walther is currently offline  Andi Walther
Messages: 5
Registered: March 2009
Junior Member
I would create a function

FUNCTION get_my_data,file, h5_variable_name
file_ID = H5F_open(file)
dataset_ID = h5d_open(file_ID, h5_variable_name)
data_space = h5d_get_space(dataset_ID)
result_space = h5s_create_simple ([100,100,30])
;([x,y,z]) = result_space
vol_data=h5d_read(dataset_ID)
;vol_data=transpose(vol_data)
vol_data = TRANSPOSE(vol_data, [1, 0, 2])
vol_data = REVERSE(vol_data, 2)

h5s_close, result_space
h5s_close, data_space
h5d_close , dataset_ID
h5f_close, file_ID

return,vol_data

end


and then

IDL> dataset_name = 'CAPPI'+STRTRIM(indgen(number_of_datasets),1)
IDL > for i=0,number_of_datasets -1 do dummy = execute
('vol_data'+dataset_name[i] + '= get_my_data('+dataset_name[i]+')' )


In this way you will have your data stored in arrays
"vol_data_CAPPI0" , etc.
Re: Multiple datasets [message #65528 is a reply to message #65527] Tue, 10 March 2009 19:27 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Shawn writes:

> But because, the dataset has to specify its dataset name, can anyone
> suggest to me how to create a loop where i can open the datasets in a
> loop. My datasets are named as CAPPI0, CAPPI1 etc. Thanks.

IDL> for j=0,20 do print, 'Cappi' + String(j, format='(I0)')

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Multiple datasets
Next Topic: Re: using irregularly spaced coordinates with ray-casting in iVolume

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

Current Time: Wed Oct 08 21:41:50 PDT 2025

Total time taken to generate the page: 1.11748 seconds