This content has been marked as final.
Show 6 replies

Re: Finding sum of values in floating point raster
markandersen May 10, 2010 12:56 PM (in response to markandersen)I should also mention that I need to do this with over 2,000 grids, so I'm hoping for something that's easy to batch either in Model Builder or simply by using the batch functionality of ArcToolbox. 
Re: Finding sum of values in floating point raster
Dan_Patterson May 10, 2010 1:15 PM (in response to markandersen)presuming that the mean in Get Raster Properties is determined from the sum divideded by the number of cells (avg = sum/N), then perhaps you could exploit COLUMNCOUNT * ROWCOUNT to determine N. This would not of course work if there are nodata cells in the raster, and I would suggest that you explore this since there is no indication in the help whether nodata values are accounted for when calculating the statistical properties 
Re: Finding sum of values in floating point raster
markandersen May 10, 2010 1:28 PM (in response to markandersen)DanI thought of that. The problem is that the mean that is given by the "Get Raster Properties" is rounded to 6 decimal places. My grids contain very small values, and over 400,000,000 cells, so any rounding error at all means that such a multiplication would produce erroneous results. 
Re: Finding sum of values in floating point raster
Dan_Patterson May 10, 2010 1:45 PM (in response to markandersen)Ok, large grid...presuming that the output is a table, perhaps, the display is just set to 6 decimal points. If you had any capabilities to get the raster out to a numpy array, then the summation is simple (raster shown as a list of lists)>>> import numpy >>> a = numpy.array([[1,1],[2,2]]) >>> a.sum() 6
and all your conversion could be done to arrays using Python as your programming platform 
Re: Finding sum of values in floating point raster
markandersen May 11, 2010 6:44 AM (in response to markandersen)Bill,
The number of significant digits far exceeds the number of decimal places being shown. For example, a value of 0.000000045821 is a valid value (a probability density function, where the probability for all cells across the study area sum to 1), but would be rounded to 0.000000 as it's being displayed when I use the Get Raster Properties. When I sum the grid values, if there is this much rounding in the calculations, they will sum to much less than 1. That's what I mean by erroneous.
I do most of my scripting with VBA. Is this something that might be better done with Python? I haven't done much scripting with rasters, so I'm not sure how to access the values for individual cells. Any samples you have handy for something like this?
Thanks! 
Re: Finding sum of values in floating point raster
markandersen May 11, 2010 2:06 PM (in response to markandersen)Bill,
Is there any reason to expect that the zonal statistics function (using a "zone" raster mask where all zone values are the same) will use single precision? When I do it that way (use a raster layer that simply has values of "1" for all cells overlaying my original raster), the "sum" I get seems reasonable.