I have a workspace with NDVI rasters and another workspace with greyscale rasters. The rasters have the same name.

I want to reclassify the NDVI raster while also using the greyscale values in a function. Depending on the greyscale value, another reclass function should be used. So for every pixel, the correct function has to be found.

I need to use an if statement: if the greyscale raster cell value is high, another statement should be used but the code results in an error:

> Invalid use of raster with Boolean operator or function. Check the use of parentheses where applicable.

    arcpy.env.workspace = ndviws
    ndvirasterlist = arcpy.ListRasters()

    for rimage in ndvirasterlist:
        ndvi_raster = arcpy.sa.Raster(rimage)
        grey_raster = arcpy.sa.Raster(os.path.join(greyvaluews,rimage))
        if grey_raster <= 28523:
            output_raster = Con(ndvi_raster < -0.0000006 * grey_raster +  0.3448,2,1)
        if grey_raster >28523:
            output_raster = Con(ndvi_raster < -0.000009 * grey_raster + 0.437673,2,1)
        output_raster.save(os.path.join(outputws,rimage))