I am attempting to use this method to interpolate currently null values in a raster: How To: Remove and replace no data values within a raster using statistical information from the surrounding data values…
This code is not working in raster calculator for Desktop 10.5. Is there a syntax update that I am missing?
Con(IsNull("raster"), FocalStatistics("raster", NbrRectangle(5,5, "CELL"), "MEAN"), "raster")
I would convert the raster to points and then interpolate.
If you use an exact interpolator set the cell size and extent equal to the raster you want to fill.
With an inexact interpolator you'll have to use CON to replace the NoData.
-Steve
I guess I disagree, the syntax looks correct to me. I would double check to make sure these layer names are absolutely correctly specified -- by erasing the expression and rebuilding it using the Raster Calculator expression builder buttons. (Note, I reformatted your code to make it easier to read.)
Nibble only works on integer data, just so you know. With float data, multiple runs of Focal Statistics may be the best way to roll it. I think Esri should write us a hole-filling tool!
Con<SPAN class="punctuation token">(</SPAN>IsNull<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"m1sm_degnull"</SPAN><SPAN class="punctuation token">,</SPAN> FocalStatistics<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"m1sm_degnull"</SPAN><SPAN class="punctuation token">,</SPAN> NbrCircle<SPAN class="punctuation token">(</SPAN><SPAN class="number token">15</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">15</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"CELL"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"MEAN"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"m1sm_degnull"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
you had a bracket in the wrong place and just to be sure I put the extra "" parameter in FocalStatistics
My raster is called "m1sm_degnull". This is the code I tried in raster calculator:
Con<SPAN class="punctuation token">(</SPAN>IsNull<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"m1sm_degnull"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> FocalStatistics<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"m1sm_degnull"</SPAN><SPAN class="punctuation token">,</SPAN> NbrCircle<SPAN class="punctuation token">(</SPAN><SPAN class="number token">15</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">15</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"CELL"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"MEAN"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"m1sm_degnull"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
This is the error I recieved:
ERROR 000539: Error running expression: rcexec() Traceback (most recent call last): File "<expression>", line 1, in <module> File "<string>", line 5, in rcexecTypeError: __init__() takes at most 3 arguments (4 given)
Failed to execute (RasterCalculator).
Hmm, I'll look into Nibble. That may be just what I'm looking for (as I do have a large gap). Thanks a bunch!
is your raster called 'raster'?
and if the gap is too big, it won't fill in in any event, you have to use Nibble (same in ArcMap and in Pro)
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.