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

Home » Public Forums » archive » Re: HDF_SD_GETACCESS: No content in variable, error
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_SD_GETACCESS: No content in variable, error [message #71782] Wed, 21 July 2010 23:54 Go to previous message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Jul 21, 9:38 am, David Fanning <n...@dfanning.com> wrote:
> aa8533 writes:
>> Hi - I'm trying to make a program which automatically runs through
>> 100s of images (MODIS Fire data) and extracts data at a particular
>> point. The program works fine where there is data to extract (in the
>> case below, when there is data in FP_Sample) but halts for an image
>> where there is none with message "Array dimensions must be greater
>> than 0".
>
>> Extract of code is:
>
>>  sd=hdf_sd_start(fileName)
>>  index=hdf_sd_nametoindex(sd,'FP_sample')
>>  sds=hdf_sd_select(sd,index)
>>  hdf_sd_getdata,sds,sample     <------------------ Halts with message
>> here
>
>> Is there a way to test the size of the variable (in this case Sample)
>> and if, say it's -1  (no data) then skip the last line of this code?
>
> I opened each of the two files you sent me up in my
> NCDF_Browser program and I could immediately see that
> FP_sample in the file that causes the problem has
> a dimension of 0. Obviously, nothing is there, even
> though the variable has been defined in the file!
>
> To look for this possibility (I have modified my own
> code in ncdf_data__define.pro and it will be on my
> web page shortly) you will have to check for a zero
> length dimension:
>
>   sd=hdf_sd_start(fileName)
>   index=hdf_sd_nametoindex(sd,'FP_sample')
>   sds=hdf_sd_select(sd,index)
>   HDF_SD_GetInfo, sds, DIMS=dims
>   IF dims[0] NE 0 THEN BEGIN
>      hdf_sd_getdata,sds,sample    
>   ENDIF
>
> I notice that every variable in that particular data file
> has a dimension of 0. That is one very sick puppy! :-)
>
> 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.")

That is a wise solution. You are the man David!
Cheers
Dave
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: out of memory using idldoc 3.2.0
Next Topic: Re: Add a Vertical Line to a Plot

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

Current Time: Wed Oct 08 16:16:31 PDT 2025

Total time taken to generate the page: 0.00234 seconds