I am developing a python script tool (my first one). The tool has 3 input parameters:
I am trying to get automatically z min and z max after the user specify the raster using the validation script but I got this error: TypeError: expected a raster or layer
This is my code (commented lines are other attempts I tried without results):
def updateParameters(self😞
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
if self.params[0].altered:
if self.params[0].value:
#rst_ds = self.params[0]
rst_ds = self.params[0].value
self.params[1].value = arcpy.Raster(rst_ds).minimum
#self.params[2].value = arcpy.Raster(rst_ds.replace('\\','/')).maximum
#arcpy.MakeRasterLayer_management(rst_ds, "rst_lyr")
#self.params[1].value = arcpy.Raster("rst_lyr").minimum
return
Solved! Go to Solution.
This question is a cross forum post and has been answered here:
Code formatting ... the Community Version - GeoNet, The Esri Community
def updateParameters(self):
Use python for the language... It will make your def happy again
def updateParameters(self):
The parameter type would be "any" and you have to deal with either a raster or a number being added
This question is a cross forum post and has been answered here: