Splitting raster cells.

311
2
03-03-2013 06:40 PM
TLeed
by
New Contributor
I have a raster with a resolution of .47-meters, it contains one field that defines the presence or absence of forest canopy (1 or 0). 

I need to use a 5-meter fishnet, (or 5-meter raster) to average the coverage within each each cell.   The 5-meter raster obviously doesn't line up perfectly with the .47-meter raster.   How do I get the exact percent coverage of the underlying forest canopy coverage into the 5-meter raster or fishnet.   

Doing a block statistic works, but when I run it with snap raster it changes the values to back to 1 or zero.   I thought there might be a good solution using python.   

I could also convert them to polygon features, but I'm surprised there isn't a good way to do it with 2 rasters.

Thanks in advance for your help!:confused:
Tags (2)
0 Kudos
2 Replies
MathewCoyle
Frequent Contributor
Could you use focal statistics with 5m map units and then just con to your 5m raster?
0 Kudos
curtvprice
MVP Esteemed Contributor
I have a raster with a resolution of .47-meters, it contains one field that defines the presence or absence of forest canopy (1 or 0). 

I need to use a 5-meter fishnet, (or 5-meter raster) to average the coverage within each each cell.   The 5-meter raster obviously doesn't line up perfectly with the .47-meter raster.   How do I get the exact percent coverage of the underlying forest canopy coverage into the 5-meter raster or fishnet.   


The tool you are looking for is Aggregate. You can't get an "exact" aggregation - as .47 does not equally divide into 5 -- but it will be very close if you resample on the fly at a smaller cell size (.2) that equally divides into 5 meters.

from arcpy.sa import *
arcpy.env.cellSize = 0.2
# .2m * 25 = 5m (you could also use other values, say 0.1 and 50)
fiveMeterMean = Aggregate("p47rast",25,"MEAN")
# to get 0-100 percents:
fiveMeterPct = Aggregate("p47rast",5,"MEAN") * 100
0 Kudos