Hello,
I'm using arcpy to reclassify two rasters. The first one is reclassed with 10 consecutive intervals of 1 km. The second one in 3 intervals of asymetric values. The first outputs a raster with char pixel type (but I reclass it with interger number) and the second outputs a 16 bits unsigned pixel type raster.
#first Reclassification
SOMAEU_distEuc_interrup_rec = gdbR + "/SOMAEU_distEuc_interrup_rec" #output
remap_2 = RemapRange([[0,1000,10],[1000.001,2000,9],[2000.001,3000,8],[3000.001,4000,7],[4000.001,5000,6],[5000.001,6000,5],[6000.001,7000,4],[7000.001,8000,3],[8000.001,9000,2],[9000.001,10000,1],[10000.001,maxDistSOMAEU_int,0]]) #remapTable, maxDistSOMAEU_int comes from previous treatment that gets the max from input raster
SOMAEU_distEuc_interrup_rec_r = arcpy.sa.Reclassify(in_raster=SOMAEU_distEuc_interrup, reclass_field="VALUE", remap=remap_2, missing_values="NODATA")
SOMAEU_distEuc_interrup_rec_r.save(SOMAEU_distEuc_interrup_rec) #function
#second Reclassification
rRoutier_distEuc_rec = gdbR + "/rRoutier_distEuc_rec" #output
remap_3 = RemapRange([[0,50,10],[50.001,200,5],[200.001,maxDistrRoutier,1]]) #remapTable, maxDistrRoutier comes from previous treatment that gets the max from input raster
rRoutier_distEuc_rec_r = arcpy.sa.Reclassify(in_raster=rRoutier_distEuc, reclass_field="VALUE", remap=remap_3, missing_values="DATA")
rRoutier_distEuc_rec_r.save(rRoutier_distEuc_rec) #function
I already tried to put float values (10.0, 9.0, etc.) as new values but that yield another error messager which seemed to suggest you can't do that.
example of result properties
Why would I get a char type output for reclassify? How can I force integer or at least number based output?
Thanks!
Solved! Go to Solution.
Well I was misleading. I thought my problem was the raster pixel type, but my real problem was actually coming farther down. After the reclassfications, I had another line of code which was basically multiplying my 2 rasters via a raster calculator. It turns out the expression received in the calculator passed the variables (rasters' name) as text instead of actual raster objects. Hence the error <can't multiply sequence by non-int of type 'unicode'> which triggered my question.
But thank you for your support 🙂
maxDistSOMAEU_int
try putting the actual value in for a test to ensure that that isn't the culprit
RemapRange—ArcGIS Pro | Documentation
Reclassify (Spatial Analyst)—ArcGIS Pro | Documentation
Thanks for your questions.
Could you share the data and the complete code with me? I will then look into it and get back to you as soon as I can.
Data: SOMAEU_distEuc_interrup, rRoutier_distEu
Code: the code you posted and the code that you used to assign variables, maxDistSOMAEU_int and maxDistrRoutier.
Thanks
Well I was misleading. I thought my problem was the raster pixel type, but my real problem was actually coming farther down. After the reclassfications, I had another line of code which was basically multiplying my 2 rasters via a raster calculator. It turns out the expression received in the calculator passed the variables (rasters' name) as text instead of actual raster objects. Hence the error <can't multiply sequence by non-int of type 'unicode'> which triggered my question.
But thank you for your support 🙂