Hi GISers,
I have an interpolated raster product stored in ESRI GRID format. The interpolation technique left some residual values below zero, but for the product in question (estimated abundance data) those values do not make sense. I want to convert them to zero.
There are a bit fewer than 100 rasters to process, so this needs to be done via ArcPy. I've found some hints on how to achieve this in the GUI, but haven't been able to turn up much on how to do it via scripting.
My sense is that this will be an easy layup for anyone who knows the syntax. If anyone has any thoughts, I'd be much obliged.
Solved! Go to Solution.
Thanks for the info.
For anybody curious, the simplest solution that I came up with was to just use the spatial analyst raster iterator. This was actually trivially simple:
for a,b in Myraster:
if Myraster[a,b]<0:
Myraster[a,b] = 0
Myraster.save()
You probably want to batch the Con tool.
Con (Spatial Analyst)—ArcGIS Pro | Documentation
There are basic examples there. I might suggest putting the output into a folder and rather than an esri grid, specify a *.tif file extension to get tif rasters
Thanks for the info.
For anybody curious, the simplest solution that I came up with was to just use the spatial analyst raster iterator. This was actually trivially simple:
for a,b in Myraster:
if Myraster[a,b]<0:
Myraster[a,b] = 0
Myraster.save()