I have written a tool that operates on raster data. When the tool finishes it outputs a raster into a gdb, but the output does not have a NoData value listed under properties (input does, output does not). I've tried myriad tricks to get a NoData value to export, no luck.

ESRI recommends exporting to a tiff to set a NoData value if a raster does not have one, but I would have to do that hundreds of times. I'd like an arcpy command that will get the tool to output a raster with a NoData value.

I need to output a raster with a NoData value listed in the properties.

Can anybody help me?

Here is the end of my .pyt file.

output_raster = arcpy.NumPyArrayToRaster(tempras0, \ 

arcpy.Point(desc_ras.extent.XMin,desc_ras.extent.YMin), \ 

outSetNull=SetNull(output_raster, output_raster, "VALUE < -10000") 



arcpy.SetRasterProperties_management(parameters[2].valueAsText, nodata="1 -10.5") 

  • Have you tried the ”nodata” parameter of the Set Raster Properties tool? desktop.arcgis.com/en/arcmap/latest/tools/… – Jae Nov 27 '17 at 22:24
  • Yes I have, but it does not set the NoData value of the output, I think I have the syntax right because it works just fine in the python console. It does not seem to work inside the toolbox. Original question edited to include the ending lines of the code. – Chris Castillo Nov 28 '17 at 15:37
  • I'm guessing the set raster properties tool is not working as "1 - 10.5" would not be a valid nodata value. I would set it to something like -9999. – Hornbydd Nov 28 '17 at 16:07
  • Are there some NoData values that are not permissible? The original nodata value in the input data was a huge floating point number, I put in -10.5 because I was concerned that the exponential was throwing off the command. I am able to set other rasters NoData value to anything I want, including -10.5, just can't do it within the python tooolbox. – Chris Castillo Nov 28 '17 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.