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 #55212 is a reply to message #55144] Tue, 07 August 2007 10:43 Go to previous messageGo to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
None wrote:
>>> HDF_SD_GETDATA, sdsIDsm, rr, start=[0,0], count=[x[j],y[j]],
>>> stride=[0,0]
>>
>> HDF_SD_GetInfo, sdsIDsm, NAME=name, HDF_TYPE=htype, TYPE=itype
>> PRINT, im[j], name, htype, itype, min(rr), max(rr)
>>
>>> HDF_SD_GETDATA, sdsIDsm2, r2
>>
>> HDF_SD_GetInfo, sdsIDsm2, NAME=name, HDF_TYPE=htype, TYPE=itype
>> PRINT, bd[j], name, htype, itype, min(r2), max(r2)
>>
>> PRINT, min(rowp), max(rowp)
>>
>
> Hi. I did the corrections which you had mentioned, but still I am
> getting the same results. I also changed the !PI and !DTOR.

Those were debugging printouts, not corrections. They're not intended
to solve the problem, they're intended to help figure out what the
problem is.

> I have changed it to read from the variable directly instead writing
> to the text file and again reading from it. these are the information
> which I got.
>
> sdsIDsm= 9 ImageData DFNT_UINT8 BYTE 40 249
> sdsIDsm2= 10 RadiometricCorrTable DFNT_FLOAT32 FLOAT
> -3.57843 2.47200
>
> Max(rowp) & Min(rowp) = 0.506396 0.000000

I see a very serious problem right here, and it's a problem at the
design level, not at the level of coding. You're attempting to write
floating point values that range from 0.0 to 0.5 to an output array
whose type is an 8-bit unsigned integer. The best you can hope for is
automatic conversion from the floating point value to the 8-bit
unsigned integer; that would result in the output array being filled
with 0s.

IDL> filename = 'test.hdf'
IDL> sd_name = 'Bytes'
IDL> file = HDF_SD_Start(filename, /CREATE)
% Loaded DLM: HDF.
IDL> Dims = [30,40]
IDL> sds = HDF_SD_Create(file, sd_name, dims, /DFNT_UINT8)
IDL> data = BYTE(40+randomu(Seed, dims)*209)
IDL> print,min(data),max(data)
40 248
IDL> HDF_SD_AddData, sds, data
IDL> HDF_SD_EndAccess, sds
IDL> HDF_SD_End,file

IDL> file = HDF_SD_Start(filename, /RDWR)
IDL> idx = HDF_SD_NameToIndex(file, sd_name)
IDL> sds = HDF_SD_Select(file, idx)
IDL> fdata = 0.506396*randomu(Seed, dims)
IDL> HDF_SD_AddData, sds, fdata
IDL> HDF_SD_EndAccess, sds
IDL> HDF_SD_End, file

IDL> idx = HDF_SD_NameToIndex(file, sd_name)
IDL> sds = HDF_SD_Select(file, idx)
IDL> HDF_SD_GetData,sds, data
IDL> print, min(data), max(data)
0 0
IDL> HDF_SD_EndAccess, sds
IDL> HDF_SD_End, file

> 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 have such values.
[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 20:09:25 PDT 2025

Total time taken to generate the page: 0.87991 seconds