[gdal-dev] GDAL and numpy, masking arrays

Armin Burger armin.burger at gmx.net
Wed Nov 12 14:48:50 EST 2008


Hi everybody

maybe someone on this list has some experience using numpy in 
combination with GDAL/Python and could give me some advice.

I wanted to try to use GDAL/Python/numpy to caculate the difference 
between 2 images. The images are vegetation indexes for different dates. 
The direct difference can be easily calculated after reading both images 
into an array and substract one from the other.

The problem is that both images can contain clouds or snow that have 
predefined pixel values (252,253). And I of course would like to exclude 
these parts in both images from the calculation because they would cause 
wrong results. So I wanted to mask the non wanted areas.

Does anybody know if this is possible and how to perform it? Looking 
through the numpy docs I was not able to identify required methods or 
functions for this. There is something like 'masked arrays' but I have 
not understood if this could be used for my purpose.

Thanks in advance for any help.

Best regards, Armin


More information about the gdal-dev mailing list