I am developing a Python tool (my first one). The tool has 3 input parameters:
- a raster
- z min
- z max
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
*.tbx
) or from a tool in a Python Toolbox (*.pyt
)?