use shapefile to create a mask?

Hi All,
Is there a way to select only the values within a particular shapefile to analyse.
I would like to do something like:

array=numpyarraycoveringtemperatureofwholestate

shapefile=forestedregions.shp

newarray=ma.masked_values(array, shapefile)
meantemperatureofforestedregions=MA.mean(newarray)
print meantemperatureofforestedregions

Any ideas of functions I could use, examples I could follow?
thanks

To the best of my knowledge, this beyond the scope of matplotlib.
Scipy or Shapely *might* have something for you, but you best bet is
to look into the raster clipping functionality of GDAL/OGR.

Hope that helps,
-paul

···

On Thu, Nov 3, 2011 at 3:40 PM, questions anon <questions.anon@...287...> wrote:

Hi All,
Is there a way to select only the values within a particular shapefile to
analyse.
I would like to do something like:

array=numpyarraycoveringtemperatureofwholestate
shapefile=forestedregions.shp

newarray=ma.masked_values(array, shapefile)
meantemperatureofforestedregions=MA.mean(newarray)
print meantemperatureofforestedregions

Any ideas of functions I could use, examples I could follow?
thanks
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I’ve used Pyshapelib and Polygon to do this type of analysis in the past. Thuban may get ya what you need.

···

On Thu, Nov 3, 2011 at 3:40 PM, questions anon <questions.anon@…1003…7…> wrote:

Hi All,
Is there a way to select only the values within a particular shapefile to analyse.
I would like to do something like:

array=numpyarraycoveringtemperatureofwholestate
shapefile=forestedregions.shp

newarray=ma.masked_values(array, shapefile)
meantemperatureofforestedregions=MA.mean(newarray)
print meantemperatureofforestedregions

Any ideas of functions I could use, examples I could follow?
thanks


RSA® Conference 2012

Save $700 by Nov 18

Register now

http://p.sf.net/sfu/rsa-sfdev2dev1


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

thanks, will look at these options.

···

On Fri, Nov 4, 2011 at 10:21 AM, Matt S. <sleepingbull@…287…> wrote:

I’ve used Pyshapelib and Polygon to do this type of analysis in the past. Thuban may get ya what you need.

On Thu, Nov 3, 2011 at 3:40 PM, questions anon <questions.anon@…287…> wrote:

Hi All,
Is there a way to select only the values within a particular shapefile to analyse.
I would like to do something like:

array=numpyarraycoveringtemperatureofwholestate
shapefile=forestedregions.shp

newarray=ma.masked_values(array, shapefile)
meantemperatureofforestedregions=MA.mean(newarray)
print meantemperatureofforestedregions

Any ideas of functions I could use, examples I could follow?
thanks


RSA® Conference 2012

Save $700 by Nov 18

Register now

http://p.sf.net/sfu/rsa-sfdev2dev1


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users