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

Home » Public Forums » archive » Re: HDF_SD_ADDDATA 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: HDF_SD_ADDDATA problem [message #59923] Tue, 22 April 2008 13:57 Go to previous message
UV_Catastrophe is currently offline  UV_Catastrophe
Messages: 1
Registered: April 2008
Junior Member
On Apr 21, 7:24 pm, adfra...@utas.edu.au wrote:
> Dear Everyone,
>
> I'm having trouble writing to an HDF file using HDF_SD_ADDDATA, but
> let me set the scene quickly first.
>
> I'm using a multispectral satellite imagery dataset in its native L1B
> (HDF-EOS, it's MODIS for those who care!) format. When ordering the
> data, one has the option to channel subset the data to reduce size.
>
> I've written IDL programs to cloud mask the data, which involves
> manipulating an SDS within the HDF. My programs all work fine using
> the full, un-subsetted data, but whenever I try them on the subsetted
> HDFs, they fall over with this error.
>
> ------------------------------------------------------------ -----------
> % HDF_SD_ADDDATA: Unable to write the specified HDF-SD slice.
> % Execution halted at: HDFEDITSDS 28 /array/work/adfraser/
> MODIS
> images/18_4_08 processing of winter2 data/output/HDFeditSDS.pro
> % $MAIN$
> ------------------------------------------------------------ -----------
>
> Here is the code which I've been using to write successfully to the
> unsubsetted data but unsuccessfully to the subsetted data:
>
> ------------------------------------------------------------ ------------
> PRO HDFeditSDS, filename, sdsname, newdata
>
> sdfileid=hdf_sd_start(filename, /rdwr)
>
> ; Find the index of the "Gridded Data" SDS.
> index = HDF_SD_NAMETOINDEX(sdFileID, sdsname)
>
> ; Select the Gridded Data SDS.
> thisSdsID = HDF_SD_SELECT(sdFileID, index)
>
> HDF_SD_AddData, thisSdsID, newdata
>
> hdf_sd_end, sdfileid
>
> END
> ------------------------------------------------------------ -------------
>
> I've checked all the obvously stupid things (file access permissions
> are identical, and the SDS name exists within the HDF). I'm at a loss,
> please help!
>
> Cheers,
> Alex.
>
> Alex Fraser
> Ph.D. candidate
> University of Tasmania
> Antarctic Climate and Ecosystems Cooperative Research Centre
> Sandy Bay Campus
> Tasmania 7001

Hi Alex,

As Mary Jo pointed out, before calling HDF_SD_END, you should insert
the following command: "HDF_SD_ENDACCESS, sdfileid". However, as she
said, that doesn't explain why your code was working for unsubsetted
data.

Could you provide a little more information about the data that you're
working with? Specifically:

- Have you tried running your code with various different data
subsets? (You probably have, but it doesn't hurt to ask.)

- When you channel subset the data, which bands are you keeping?

- Out of curiosity, why aren't you just using the pre-masked data? (I
believe that the website can provide you with data that has already
been cloud masked.)

Ben Ripman
MODIS IOT
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Using make_rt on a Mac
Next Topic: General purpose tooltip routine

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

Current Time: Wed Oct 08 19:12:59 PDT 2025

Total time taken to generate the page: 0.00464 seconds