[GRASS-user] AVIRIS data in GRASS

Michael Perdue michael_perdue at yahoo.ca
Mon Jul 6 16:15:04 EDT 2009


On 5-Jul-09, at 9:29 PM, Hamish wrote:

>
> Michael Perdue wrote:
>> I don't think you can use r.in.bin
>> because there is no option to specify the number of bands
>> and how those bands are interleaved. In the past I've used
>> Multispec and Matlab to read the data but you might be able
>> to manipulate GDAL to read it.
>
> if you have a small m-file to load it and save in a format
> ready for GRASS's r.in.mat it could be useful to post. Users
> without Matlab could always use GNU Octave to do the job.
>
> also I suspect Python can do binary reads in a clean way, which
> may help if the expected format was known.

Unfortunately, my computer and all my backup drives were stolen in a  
home invasion about 6 months ago so if I had made a m-file, it's gone.  
However, it's fairly straight forward in matlab/octave.
I just did;

fid = fopen ('f960705t01p02_r05_sc01.c.img','r');
AVIRIS = int16(fread(fid, 'int16', 'ieee-be'));
fclose(fid)
AVIRIS2 = reshape (AVIRIS, 224,614,512);
AVIRIS3 = permute (AVIRIS2,[3 2 1]);

This created the correct output on my system. Of course this assumes  
that the original file has 224 bands, 614 columns and 512 lines. That  
should be true for all except the last tile in every flight line which  
will be less that 512 lines. I'd put more effort into writing an m- 
file for these files but I don't think it's of a lot of value unless  
you also read in the *.nav files and geometrically correct the files  
at the same time. As I've mentioned, the distortions due to aircraft  
dynamics can be rather extreme. Unfortunately, that is a lot less  
trivial. Attached is an example from one of the sample datasets.

Cheers,

Mike




-------------- next part --------------
Skipped content of type multipart/related


More information about the grass-user mailing list