I have a raster dataset ("RDS_NFlows_3035") with several bands that I would like to reclassify to a single value and save in another raster dataset ("RDS_NFlows_reclass_3035"). When I run the script I get in the main workspace (daycentGDB) and not in the output raster dataset only one raster, called Reclass_RDS_1, correctly reclassified and I get also following error:
RuntimeError: ERROR 000732: Input Raster: Dataset E:\projects\INMAP\ArcGISProject\DAYCENT\DAYCENT.gdb\RDS_NFlows_3035\Reclass_RDS_1 does not exist or is not supported
I have no rasters in my input raster dataset with that name (Reclass_RDS_1), since this is the default name given to the output by the processing tool and I can't understand why the script looks for such a raster and why it saves it outside the output raster dataset.
NFlows_in_rds = os.path.join(daycentGDB, "RDS_NFlows_3035")
NFlows_out_rds = os.path.join(daycentGDB, "RDS_NFlows_reclass_3035")
arcpy.env.workspace = NFlows_in_rds
nflow_rs = arcpy.ListRasters()
outRsSuff = "_reclass"
for rs in nflow_rs:
print("Working on {}".format(rs))
inRaster = Raster(rs)
minVal = arcpy.GetRasterProperties_management(inRaster, "MINIMUM")
maxVal = arcpy.GetRasterProperties_management(inRaster, "MAXIMUM")
print("min: {}, max: {}".format(minVal, maxVal))
remap = RemapRange([[minVal, maxVal, 999]])
outRsName = "{}{}".format(rs, outRsSuff)
print(outRsName)
outRs = Reclassify(inRaster, "VALUE", remap)
outRs.save(os.path.join(NFlows_out_rds, outRsName))
This is the structure of my GDB:
DAYCENT.gdb (File geoDB)
RDS_NFlows_3035 (Raster dataset)
mineralFertilization (Band 1 of raster dataset)
organicFertilization (Band 2 of raster dataset)
N2O (Band 3 of raster dataset)
N2 (Band 4 of raster dataset)
What I expect from script is a GDB like this:
DAYCENT.gdb
RDS_NFlows_3035
mineralFertilization
organicFertilization
N2O
N2
RDS_NFlows_reclass_3035
mineralFertilization_reclass
organicFertilization_reclass
N2O_reclass
N2_reclass
But after the script returns error, the GDB structure is:
DAYCENT.gdb
RDS_NFlows_3035
mineralFertilization
organicFertilization
N2O
N2
Reclass_RDS_1
Band_1