Averaging raster grids with missing values

3945
4
04-09-2012 05:22 AM
JenB
by
New Contributor
I have 10 raster grids and need to generate a summary raster that is the mean of all 10. Unfortunately, there are some missing values (which I guess No Data are actually coded as -9999) in a couple of the rasters, and when I simply use the raster calculator, it only evaluates where data is available in all grids. So there are gaps in the summary "mean" raster. I'd rather that the mean is generated by ignoring where there are NaNs. For instance, if there is a gap in Grid 1, the mean for that gap area is just calculated from Grids 2-10. Any ideas on how to do this?  Maybe some Python code?

OR is there a way to interpolate the rasters with holes? I've only interpolated on point values before so I'm not sure if this is possible.

Thanks!
0 Kudos
4 Replies
SteveLynch
Esri Regular Contributor
Have you thought of using the CellStatistics tool?

Steve
0 Kudos
JenB
by
New Contributor
You mean focal statisitcs? I'm assuming you mean using this to fill in the gaps? I have tried this, and for when the gaps are really small, it works well. However, I'm finding that some of the gaps are quite large, so it would be preferable to find a workaround in that the "NoData" is merely ignored in the raster calculation (but still utuilizes the rasters where data is available). I'm rather surprised this isn't an option, actually. Am I missing something??

I should mention I still have 9.3, if this makes a difference.
0 Kudos
SteveLynch
Esri Regular Contributor
I do mean CellStatistics and a major update was made in ArcGIS 10 to control the handling of NoData, see
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Cell_Statistics/009z0000007q000000/

and in particular the section on ignore_nodata


Steve
0 Kudos
curtvprice
MVP Esteemed Contributor
I should mention I still have 9.3, if this makes a difference.


If you still  are at 9.3, you can't use these (excellent) updates Steve mentions. I can't think of an easy workaround off the top of my head that does what you want.

One approach to fill in holes to consider is the Nibble function. This will fill in NoData errors irregardless of how big they are. A hybrid approach of doing focal statistics, followed by nibble to fill in the remaining holes may be your best approach.
0 Kudos