I have a nested con statement that I'd like to put into a script, as it's hard to follow in its current form. The raster it produces is incorrect, so it'd be easier to debug in a script.
The current set of statements looks like this:
EWR_2015 = Con("ministerial_wetlands">0," ministerial_wetlands ",
(Con("non_ministerial_wetlands ">0,("WTE_using_2001_min"-0.25),
(Con(("nat_veg_raster" >0) & ("dtgw_2001_min" <= 3) ,
("WTE_using_2001_min"-0.75),
(Con(("nat_veg_raster ">0) & (("dtgw_2001_min ")>3 & ("dtgw_2001_min " <= 6)) , ("WTE_using_2001_min"-1.0),
(Con(("nat_veg_raster ">0) & (("dtgw_2001_min " > 6) & ("dtgw_2001_min "<= 10)),(" WTE_using_2001_min "-1.25)
)))))))))
I would like to use a series of if/ elif statements in Python to do a similar thing.
I tried this for the first statement:
ministerial_wetlands = Raster("ministerial_wetlands")
if ministerial_wetlands>0:
outRaster = Raster(ministerial_wetlands)
This gives the following error message: ValueError: The truth value of a raster is ambiguous. Invalid use of raster with Boolean operator or function. Check the use of parentheses where applicable.
Not sure where to go from here.