Spatial Analyst (Raster Calculator): 'focalmean' no more?

10722
14
07-16-2010 11:45 AM
MatthewRobinson
New Contributor
Hi,

I have a simple expression that worked great in the 9.x Raster Calculator to interpolate NoData values, but am having all kinds of trouble in 10:

dem1 = con(isnull([dem0]), focalmean([dem0], rectangle, 3, 3, data), ([dem0]))

Part of the problem is that con, isnull, etc. are now case-sensitive (Con, IsNull), but the most recent error message tells me that 'focalmean' is not recognized.

Any help 'modernizing' this expression would be hugely appreciated. Thanks!

-Matt
0 Kudos
14 Replies
EricRice
Esri Regular Contributor
Jamal,

Your expression is using �??wt�?� but your layer name is �??wt1�?�.

Eric
0 Kudos
JamalNUMAN
Legendary Contributor
thank you ERIC. it did work.

now, how to say that it is solved?

appreciated

Jamal



Jamal,

Your expression is using �??wt�?� but your layer name is �??wt1�?�.

Eric
----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos
ElizabethGraham
Esri Contributor
Hi,

I have a suggestion that might help you create a valid map algebra expression.

1) To launch the Python window, click the Python Window button on the Standard toolbar, or from the Geoprocessing drop-down menu, click Python window.

2) Type the following expression, do not copy and paste.  As you are typing you will see that drop down lists appear, auto completion is available, and help* shows up in the other panel to guide you in creating expressions with valid syntax.

>>> from arcpy.sa import *
>>> m2w = Con(IsNull("wt1"),FocalStatistics("wt1", NbrRectangle(3,3),"MEAN"),"wt1")


3) At the end of the expression click �??enter�?? to execute the expression.

For more on using the Python window:
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/What_is_the_Python_window/002100000017...


*Note: If you don�??t see the help right click in the window, select a Help Placement (ie Bottom) and adjust the window panes until you can see the help.
0 Kudos
AdamStencek
New Contributor
Hi Matt,

The FocalMean command you're familiar with is not available in the new raster calculator.  The documentation you pointed to is wrong and I will submit a defect to have it changed.  To accomplish this task you need to use FocalStatistics with the mean statistic type within your Con statement.

It should look like this:
xxx= Con(IsNull("point2ras"),FocalStatistics("point2ras",NbrRectangle(3,3),"MEAN"),"point2ras")

..........


Eric, I was currently solving this problem why it doesnt work for like 2 hours. Thanks alot for helping me!
0 Kudos
curtvprice
MVP Esteemed Contributor
Eric, I was currently solving this problem why it doesnt work for like 2 hours. Thanks alot for helping me!


Elizabeth posted some very good tips above on getting the syntax right in the 10x Raster Calculator tool. If her suggestions don't help, feel free to post more details!
0 Kudos