jfgomes

change mask using a loop

Discussion created by jfgomes on May 31, 2012
I am working with raster data on a worldwide level with a resolution of 30 arc seconds.
I need to export the data into a table format to do
Statistical analysis. As the resolution is very good, you can not run the "Sample" (Spatial
Analyst) command for the entire dataset at once. Therefore, I
divided the world into 40 zones and created masks for each zone (with
The Set Null command). I was trying to write a code in
Python, using a loop where each time the mask will become
a different zone, i.e. env.mask = zone 1, then zone 2 and so on.
However, I suppose that within a python session one
cannot keep on changing the mask using a loop. Could
you kindly suggest a way to run the command Sample
for each of the 40 zones without having to write 40
different codes?

Outcomes