In Google Earth Engine's Java API, I have the following code that works and am trying to use this in Google Colab with Python.
How do you reclassify the pixels in a raster image in Python?
var FinalResult= datasetA.where(sdA.gt(sdAthreshold),56).where(sdA.lte(sdAthreshold).and(mA.gte(All_A)),102).where(sdA.lte(sdAthreshold).and(mA.lt(ALL_A)),76).rename('Result');
I have tried the following after reading NumPy reclassification documentation to no avail. This did not work.
import numpy as np
FinalResult= np.select.datasetA([sdA > sdAthreshold, (sdA <= sdAthreshold) & (mA >= AllA), (sdA <= sdAthreshold) & (mA < AllA)],[56,102,76])
And neither did this.
datasetA[np.where(sdA > sdAthreshold)] = 1
datasetA[np.where((sdA <= sdAthreshold) & (mA >= AllA))] = 2
datasetA[np.where((sdA <= sdAthreshold) & (mA < AllA))] = 3