Re: [gdal-dev] comparing two rasters

2012-02-23 Thread jdmorgan
Hi Chaitanya, This works great. Thanks so much. GDAL/Python is a really powerful combination. Cheers, Derek On 2/23/2012 9:31 AM, Chaitanya kumar CH wrote: Derek, You can assign a color table. Ex: (0,0,0) for 0, (255,255,255) for 1. You can assign a color table to a raster band using the m

Re: [gdal-dev] comparing two rasters

2012-02-23 Thread Chaitanya kumar CH
Derek, You can assign a color table. Ex: (0,0,0) for 0, (255,255,255) for 1. You can assign a color table to a raster band using the method SetRasterColorTable(). You can find some sample python code in GDAL's test suite[1][2]. [1]: http://trac.osgeo.org/gdal/browser/trunk/autotest/gcore/colortab

Re: [gdal-dev] comparing two rasters

2012-02-23 Thread jdmorgan
ThanksChaitanya, Actually this seems to be working, which is pretty cool.I think where I am getting confused is that I am attempting to verify the results by loading the resulting raster data into a GIS e.g. ArcGIS or QGIS and doing spot checking.However, as I haven’t done any actual color cod

Re: [gdal-dev] comparing two rasters

2012-02-22 Thread Chaitanya kumar CH
Try this Derek, for r in range(rows1): data1 = ds1.GetRasterBand(1).ReadAsArray(0, r, cols1, 1) print "data1: " + str(data1) data2 = ds2.GetRasterBand(1).ReadAsArray(0, r, cols2, 1) print "data2: " + str(data2) result_bools = np.logical_and((data1 > 0), (data2 > 0)) result_

Re: [gdal-dev] comparing two rasters

2012-02-22 Thread jdmorgan
Hi Chaitanya, I am using data1[data1>0]=1 to convert any of the values in the row of data that is greater than 0 to a one. I am doing this because the values are varied, but I am only interested in the fact that there is a value at all. My end goal is to compare the two input rasters for pla

Re: [gdal-dev] comparing two rasters

2012-02-21 Thread Chaitanya kumar CH
Derek, Can you explain the following lines towards the bottom of the script? data1[data1>0]=1 ... data2[data2>0]=1 On Wed, Feb 22, 2012 at 8:46 AM, jdmorgan wrote: > Hello GDAL guru’s, > > I am working on a python script where I read in two rasters of similar > extent and resolution. Then I

[gdal-dev] comparing two rasters

2012-02-21 Thread jdmorgan
Hello GDAL guru's, I am working on a python script where I read in two rasters of similar extent and resolution.Then I re-assign any values that are greater that zero to a 1.Next, I compare to the rasters and attempt to create a third resulting raster which has 1's everywhere that the two inpu