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

Home » Public Forums » archive » 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 #60044 is a reply to message #59951] Fri, 25 April 2008 09:15 Go to previous messageGo to previous message
jameskuyper is currently offline  jameskuyper
Messages: 79
Registered: October 2007
Member
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!

SInce you were talking about Gridded data, I presume that you ordered
the data with reprojection. I placed an order for MOD021KM for
2008-04-23 08:40, with channel subsetting for bands 5, 6, and 7, and
with reprojection to a grid at 1km resolution in an azimulhal equal-
area projection centered at 40E 35N. I used

filename = $
'MOD021KM.A2008114.0840.005.2008114172926.bsrpcs_00050029480 8.EV_500_Aggr1km_RefSB_1_1.hdf'
sdsname = 'EV_500_Aggr1km_RefSB_0'

I use exactly the code you provided above, except that I added the
required call to HDF_SD_EndAccess. I filled in newdata by executing
the following commands:

HDF_SD_GetData, thisSdsID, olddata
newdata = olddata+500

Everything worked perfectly. Therefore, whatever problem you're
running into depends upon some of the details you haven't given us.
Could you provide some more details about how you triggered this
problem?
[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
Previous Topic: Re: IDL plotting query - how can I get rid of unwanted colour for a particular data value???
Next Topic: Multiple draw widget events

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

Current Time: Fri Oct 10 13:17:11 PDT 2025

Total time taken to generate the page: 0.40117 seconds