[GIS] Setting raster values to NoData when raster does not have valid statistics

arcgis-10.2arcgis-desktoparcpynodataraster

I have a floating point raster with some values of 99999 that I want to set to NoData in Arc 10.2.2. I've tried using the SetNull dialogue box, the SetNull arcpy function, and the Raster Calculator dialogue box as described in Reclassify raster values of 9999 to NoData, leaving all other values alone, in ArcGIS Desktop?, but all of these fail with same error message:

ERROR 010423: myraster.FLOAT.TIFF does not have valid statistics as required by the operation.

I've tried using the Calculate Statistics tool as part of the Raster Properties toolbox, as suggested by the Help when I click on the error message, but this doesn't seem to change anything.

Any suggestions on how to make it work or alternatives for fixing the error?

Best Answer

As suggested by Michael Stimson in comments, one alternative is the Set Raster Properties tool:

Sets the data type, statistics, and NoData values on a raster or mosaic dataset.

import arcpy
arcpy.env.workspace = "C:/Workspace"

arcpy.SetRasterProperties_management("test.tif", nodata=[[1,99999]])

Remove the layer and re-add it, so ArcMap can recognize the changes.

It was also suggested to set NoData values directly from ArcCatalog (right click on the dataset, go to 'properties', and edit from there).

Related Question