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

Home » Public Forums » archive » Question regarding HDF file
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: Question regarding HDF file [message #55194 is a reply to message #55144] Tue, 07 August 2007 14:55 Go to previous messageGo to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
None wrote:
>>> But if i open the hdf file, I am getting values like -3.5123 -1.5232
>>> -3.5138 .............
>>
>> How exactly are you reading the file? If you use the same methods
>> shown in this code, you should be reading in the ImageData SDS as a
>> BYTE array, which should be incapable of representing either negative
>> or fractional values.
>
> Hi. The dataset I am using is a kind of remote sensing dataset
> (ASTER). Sorry to let you know lately that I was opening the hdf file
> in ENVI 4.1 software. ...

Without being familiar with ASTER data, it sounds like ENVI is
handling it the same way it handles MODIS L1B data when you choose the
File/Open External File/EOS/MODIS option. A floating point scale
factor and offset for each band is stored as an SDS attribute for each
image SDS in a MODIS L1B file. ENVI knows how to apply those scale
factors and offsets to calculate correct values.

If you want to take an existing ASTER image, transform it in some
fashion, and then write it back to the file, you're going to have to
find out how the corresponding scale and offset values are stored in
the ASTER data. This should be documented in their file
specifications. You'll have to apply that scale and offset before
applying your transformation. After performing your transformation,
you'll have to apply the scale and offset in reverse. Depending upon
your transformaiton, the new values should also be within the range
from 0 to 255, just like the original values, so they'll still fit in
8-bit unsigned integers. Those are the values you'll want to write
back to the file.

> ... Yes, if I read it using HDF_SD_GETDATA, I will
> get all zeros. I understood your point,
> This result is consistent with my expectation that HDF_SD_AddData
> performs automatic conversion from the IDL data type to the HDF data
> type.
>
> But is there a way to avoid this?

You can't do what you wanted to do; not this way. You need to choose
from a wide variety of alternatives which are NOT what you originally
wanted to do.

You can't change the data type of an HDF SDS once it has been created.
If you want to store actual floating point values in an SDS, you'll
have to create a new SDS for that purpose, with the appropriate HDF
data type, either in the same file or a new one. Of course, this loses
whatever advantage you hoped to gain by re-writing the data in-place.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Thinning algorithm without for loops
Next Topic: Re: Another simple one

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

Current Time: Fri Oct 10 04:16:24 PDT 2025

Total time taken to generate the page: 0.87856 seconds