use shapefile to create a mask

742
0
11-03-2011 09:13 PM
SarahBurns
New Contributor
Hi All,
I need to run a process in python on a huge array but I first need to create a mask using a shapefile.
Does anyone know how I could do this or any examples I could follow?

Once I have created the mask this is what I would like to do
temparray=numpyarraycoveringtemperatureofwholestate
shapefile=forestedregions.shp
forestedregionsasarray=convert shapefile to array of 0's and 1's??

newarray=ma.masked_values(temparray,forestregionsasarray)
meantemperatureofforestedregions=MA.mean(newarray)
print meantemperatureofforestedregions


Any ideas of functions I could use, examples I could follow?
Thanks
Tags (2)
0 Kudos
0 Replies