| Re: MOD43B3 Col.4 Processing. unexpected error message. why? [message #54820 is a reply to message #54721] |
Wed, 11 July 2007 11:59   |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
devin.white@gmail.com wrote:
> This is just an initial stab at what might be the problem, but I
> noticed that you're defining your albedo arrays as floating point:
>
> albedo_black = fltarr(1200, 1200)
> albedo_white = fltarr(1200, 1200)
>
> MOD43B3 albedo is stored as integer, which is half the size.
As a result, we have:
IDL> HELP,albedo
ALBEDO INT = Array[2, 10, 1200, 1200]
IDL> help,albedo_black
ALBEDO_BLACK FLOAT = Array[1200, 1200]
However, an automatic conversion between INT and FLOAT occurs on the
following line:
albedo_black[*, *]=albedo[0, 9, *, *]
> Your
> data are most likely getting written into the file, but ENVI is
> expecting them to take up more room.
The INT array 'albedo' is never passed to ENVI. Only the albedo_black
and albedo_white arrays are passed to ENVI_WRITE_ENVI_FILE, and those
are both float arrays. In any event, ENVI_WRITE_ENVI_FILE is supposed
to convert it's input array into whichever data type is specified by
the OUT_DT parameter. In this case, that parameter is set to 4, so no
conversion is needed.
Whatever the problem is, that can't be the cause..
...
> retrieve). You don't get floating point output unless you take the
> four-dimensional albedo array and apply the necessary scale and offset
> factors stored in the SD. Just a thought.
The scale_factor and add_offset do need to be applied to calculate the
correct albedo, as indicated by the filespec:
> Data conversions:
> file date =(Albedo / scale_factor) + add_offset
> Albedo =(file data - add_offset) * scale_factor
These values may be read from the file using code like the following:
idx_scale = HDF_SD_AttrFind(sdsID_albedo,'scale_factor')
HDF_SD_AttrInfo, sdsID_albedo, idx_scale, DATA=scale_factor
idx_offset = HDF_SD_AttrFind(sdsID_albedo, 'add_offset')
HDF_SD_AttrInfo, sdsID_albedo, idx_offset, DATA=add_offset
However, the problems he's been having don't seem to be related to the
values stored in his variables. The message said that the problem was
that something had a dimension of 0. Whether or not he applied the
scale factor and offset shouldn't have any affect on that problem.
|
|
|
|