record pixel value with Python script

2014-01-11 Thread DPod

A scripting newbie question...

I'd like to write a Python script for ArcGIS 10.x (ArcPy or Python 2.6.5) that 
would record the pixel value for all pixels in a raster. Furthermore, I'd like 
to only record a given value once in the results. For example, if there are 23 
values of 180 overall, only record one instance of that value.

The raster in question is 4-band (6017 x 7715 pixels) so the results would have 
to include values for all pixels in each band, recorded separately by band. 
Ideally I'd like to write to an Excel file or at least a .csv file.

Any help and examples would be greatly appreciated.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: record pixel value with Python script

2014-01-11 Thread DPod
On Saturday, January 11, 2014 3:35:13 PM UTC-8, [email protected] wrote:
> On Saturday, January 11, 2014 5:53:00 PM UTC-5, DPod wrote:
> 
> 
> 
> > 
> 
> > I'd like to write a Python script for ArcGIS 10.x (ArcPy or Python 2.6.5) 
> > >that would record the pixel value for all pixels in a raster. Furthermore, 
> > I'd >like to only record a given value once in the results. For example, if 
> > there >are 23 values of 180 overall, only record one instance of that value.
> 
> > 
> 
> > The raster in question is 4-band (6017 x 7715 pixels) so the results would 
> > >have to include values for all pixels in each band, recorded separately by 
> > >band. Ideally I'd like to write to an Excel file or at least a .csv file.
> 
> > 
> 
> 
> 
> Can you install libraries?
> 
> 
> 
> Fetching the pixel values of an individual band is straightforward in PIL 
> (and the fork Pillow), something like this:
> 
> 
> 
> from PIL import Image
> 
> im=Image.open("blah.jpg")
> 
> red=im.getdata(0)
> 
> 
> 
> If you can't install things you would need to figure out if ArcGIS has an API 
> for fetching a band.
> 
> 
> 
> The filtering step is easy, you just want the set of values:
> 
> 
> 
> set(red)
> 
> 
> 
> 
> 
> Max

No, installing libraries doesn't seem to be an option
-- 
https://mail.python.org/mailman/listinfo/python-list