I am new to arccpy and I'm trying to write a script to get the raster and check for the minimum cell size value using Get Raster Properties method.
After I run my code I get a message of the minimum value but the raster is not saved. Below are my line of codes:
import arcpy ,os ,sys from arcpy import env from arcpy.sa import * input_raster= arcpy.GetParameterAsText(0) output_folder = arcpy.GetParameterAsText(1) arcpy.CreateFileGDB_management(output_folder,"output.gdb") outputgdb = output_folder +"\\output.gdb"+ os.sep output_con_raster = outputgdb + "cond_raster" inRas1 = arcpy.Raster(input_raster) rasterValue = arcpy.GetRasterProperties_management(inRas1,'MINIMUM') elevation_min= rasterValue.getOutput(0) elevation_min.Save(output_con_raster)
Is there anything wrong with my code as the save method is not working?
You are confusing yourself with the naming convention you are using.
rasterValue is a result object.
Your next line returns the output of the result object which will be a number, the minimum value in your raster.
Knowing this then the final line
elevation_min.Save(output_con_raster) make absolutely no sense as your syntax is suggesting you are trying to save a raster when in fact you have nothing more than a number (float or integer).
You could write this value to a table?