# raster calculation problems

271
2
03-21-2012 08:36 PM
New Contributor
--------------------------------------------------------------------------------

0

Raster Calculator issues
I have tried every suggestion I've come across to use Raster Calculator to fill my 'NoData' holes in mosaic-ed Raster DEM.

I'm using ArcMap 10 and the equation I've been told to use is:

Filled_DEM = Con(isnull(["mosaic"]),FocalMean(["mosaic"], rectangle,4,4),["mosaic"])

ive tried changing around the capitalization, spacing, and even read somewhere that in ArcMap 10 focal stats. no longer works so I used :

Filled_DEM = Con(IsNull(["mosaic"]),FocalStatistics(["mosaic"], NbrRectangle(3,3),"MEAN"),["mosaic"])

and STILL nothing. can someone please help me - I've sat for hours trying to figure this out and I feel as though I've run out of options!!! Thanks!!!

Stephanie
Tags (3)
2 Replies
MVP Legendary Contributor
If you are indeed using version 10, get rid of the square brackets ( [ ] ), grid names are enclosed in double quotes as shown in the help files
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z000000m8000000.htm
Also you want FocalStatistics in order to calculate the focal mean
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z000000qs000000.htm
Also all methods are case sensitive as in the case of IsNull
Regular Contributor III
So if I am not mistaken, you have a DEM with some small holes in it... Maybe LiDAR data from some fly-by-night vendor? And you want to fill each hole with "reasonable" elevation values.

I think what you actually might want to do is for each little nodata hole, get the minimum elevation value (maybe the MEAN?) of a 1 cell buffer zone around each hole... each hole probably has a different elevation values surounding it, so you want to be sure to use the RegionGroup tool as well.

This expresion seemed to work for me... Just replace "my_grid" with the name of your DEM. It will produce a "no hole" DEM where each hole has the minimum elevation value of 1 pixel buffer surounding the hole.

`noHolesGrd = Con(IsNull("my_grid"), ZonalStatistics(FocalStatistics(RegionGroup(Con(IsNull("my_grid"), 1)), NbrRectangle(3, 3, "CELL"),"MINIMUM", "DATA"), "VALUE", "my_grid", "MINIMUM", "DATA"), "my_grid")`

Be aware that this expresion will also "fill in" no data areas on the periphery of your dataset as well, and that might not be desirable... The code to exclude these periphery areas would be more complicated... Otherwise you could also manually create a mask layer specifically showing the areas you intend to fill (edit the mask polygon so as to delete the periphery nodata areas).