# How to calculate cumulative sum conditionally across raster?

I don't know if this is possible without coding, but I need to:

• Create a raster file that, for each value in the input raster, sums all pixel values across the entire extent that are less than or equal to the input pixel. That value then needs to be written to the corresponding cell in the new raster.

• Scale the output between 1 and 100, but that is the easier part of
this.

The only spatial analyst tool I can find that looks remotely useful is BlockStatistics (I was thinking I could conditionally run BlockSum) but that tool seems to require that the raster be split into multiple blocks.

Is there a way to sort of hack BlockStatistics to only use one block/zone that corresponds to the extent of the entire raster? Or would I need to come up with a python script for this?

Unfortunately, I don't think my coding skills are up for that.

Thanks in advance for the help!

here is how I would do it in ArcGIS without coding:

build the raster attribute table of your raster (you may need to multiply by some number (e.g.1000) and round it into integers) : this will give you the count of each pixel.

in this table, multiply each value by its count and compute the cum sum, that you scale between 1 and 100.

reclassify your raster with the cumsum table as look up table.

• Thanks! That solves part of my problem, if I understand it correctly. I'm still not sure how to conditionally get cumulative sums across the entire raster. Commented May 14, 2014 at 18:50
• +1 It's unclear what your comment means, Vergentorix: this answer addresses the entire raster at once. Commented May 14, 2014 at 18:53