Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Determine if generated row and column numbers exist in RasterToNumPyArray object

$
0
0
I'm using RasterToNumPyArray to convert rasters to numpy arrays, and then iterating using:

for [i, j], theVal in numpy.ndenumerate(my_raster):

I want to be able to check that additions to either i or j will equate to a 'valid' cell. I can currently do this by checking that generated 'new' row and column numbers don't exceed the raster's row/column count (and that they don't go < 0 if subtracting), but I'm sure there must be a generic Python/numpy 'contains' function that will for the array, I just can't seem to find the right option or syntax. A short example would be greatly appreciated.

Thanks

Rob

Viewing all articles
Browse latest Browse all 2485

Trending Articles