Re: HDF_SD_ADDDATA problem [message #59978 is a reply to message #59951] |
Thu, 24 April 2008 06:00   |
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'm responsible for the code which creates the original L1B files, and
also for the code which performs the channel subsetting. Therefore I'm
very interested in resolving this problem.
> 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)
What's the actual value of sdsname in the cases where this fails?
The native MODIS L1B files are in HDFEOS Swath format, not Grid
format. They contain no SDSs that are named as, or can accurately be
described as, "Gridded Data". Did you select reprojection as a post-
processing option when you ordered the data? That would created
gridded data. I'm not responsible for the code which performs the
reprojection, but I know the guy who is.
The problem might depend upon some post-processing option you selected
which you haven't mentioned yet. If you don't know your order number,
please identify precisely all of the post-processing options you
selected when you ordered this data. The problem might depend one of
those other options. If you do know your order number, we can find out
precisely what options you selected, we don't have to rely upon you
remembering it.
> ; 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!
Well, the obvious question is, what is the type and and what are the
dimensions of newdata? How do they compare with the type and
dimensions of the SDS you're trying to add it to? Channel subsetting
will reduce the size (and change the meaning of) the band dimension of
any SDS which has a band dimension containing the bands which you
didn't select.
|
|
|