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

Home » Public Forums » archive » Re: a strange loop problem
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: a strange loop problem [message #60941] Tue, 24 June 2008 06:36 Go to previous message
bulrushmower is currently offline  bulrushmower
Messages: 19
Registered: February 2008
Junior Member
On Jun 24, 2:33 am, Anthony <anthonysmit...@gmail.com> wrote:
> On Jun 24, 3:53 am, bulrushmo...@gmail.com wrote:
>
>
>
>
>
>>   What is wrong with the loop for the following:
>> i=0
>> Print, 'SDS_NAME'+STRTRIM(string(i+1),2), prints  SDS_NAME01
>> But, Band = hdf_sd_nametoindex(file, 'SDS_NAME'+STRTRIM(string(i+1),
>> 2)) is not the same with
>>        Band = hdf_sd_nametoindex(file, SDS_NAME01 )
>> ==========================================
>>   SDS_NAME01 = "SREFL_CH1"
>>   SDS_NAME02 = "SREFL_CH2"
>>   SDS_NAME03 = "BT_CH3"
>>   SDS_NAME04 = "BT_CH4"
>>   SDS_NAME05 = "BT_CH5"
>>   SDS_NAME06 = "SREFL_CH3"
>>   SDS_NAME07 = "SZEN"
>>   SDS_NAME08 = "VZEN"
>>   SDS_NAME09 = "RELAZ"
>>   SDS_NAME10 = "QA"
>
>> file = hdf_sd_start(fPath_data
>> +"AVH09C1.A1998180.N14.002.2007273131632.hdf")
>
>>   for i=0, 9 do begin
>>     Band = hdf_sd_nametoindex(file, 'SDS_NAME'+STRTRIM(string(i+1),2))
>>     data = hdf_sd_select(file, Band)
>>     hdf_sd_getdata, data, getdata
>>     hdf_sd_endaccess, data
>
>>   endfor
>
>    Band = ...(file, 'SDS_NAME01')
> is not the same as
>    Band = ...(file, SDS_NAME01)
> Maybe that's the problem?
>
> You could use execute(), e.g.:
>    Void = execute('Band = ...(file,' + string(...) + ')')
>
> Or why not put the SDS_NAMEs into an array?
>
> SDS_NAMES = ["SREFL_CH1", "SREFL_CH2", ...]
> ...
> for i = 0, 9 do begin
>   Band = hdf_sd_nametoindex(file, SDS_NAMES[i])
>   ...
> endfor
>
> Hope that helps!
>
> Cheers,
> Anthony- Hide quoted text -
>
> - Show quoted text -

Thanks for all the help. I tried all, but does not work. But I solved
the problem using other method.
--get bariable names by Gumley's HDF file reader
--then loop the variable namses as a string

It works.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Extracting subregions from a data cube
Next Topic: workbench eclipse 3.3.2 patch

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

Current Time: Thu Oct 09 07:54:15 PDT 2025

Total time taken to generate the page: 0.08247 seconds