I'm getting error 010531: sum of % influence weights must be equal to 100, and I really don't know why, I have tried multiple ways to make it worked but nothing, to my eyes it seems correct, but it's not working.
this is the code, please take a look and let me know what do you see.
try:
myWOTable = WOTable([[ras4, 12, "LANDUSE", "('Brush/transitional' 5; 'Water' 'Restricted'; 'Barren land' 10; 'Built up' 3; 'Agriculture' 9; 'Forest' 4; 'Wetlands' 'Restricted'; 'NODATA' 'NODATA')"],
[reclass_slope_1, 13, "VALUE", "(1 'Restricted'; 2 'Restricted'; 3 'Restricted'; 4 4; 5 5; 6 6; 7 7; 8 8; 9 9; 10 10; 'NODATA' 'NODATA')"],
[reclass_eucD_rec_sites, 50, "VALUE", "(1 1; 2 2; 3 3; 4 4; 5 5; 6 6; 7 7; 8 8; 9 9; 10 10; 'NODATA' 'NODATA')"],
[reclass_eucD_schools, 25, "VALUE", "(1 1; 2 2; 3 3; 4 4; 5 5; 6 6; 7 7; 8 8; 9 9; 10 10; 'NODATA' 'NODATA')"]],
[eva_scl])
out_WeightedOverlay = WeightedOverlay(myWOTable)
out_WeightedOverlay.save(weighted_suitable_areas)
except:
print(arcpy.GetMessages())
Error msn:
Start Time: Sat Dec 22 23:46:33 2018
Failed to execute. Parameters are not valid.
ERROR 010531: The sum of % Influence Weights must equal 100.
Failed to execute (WeightedOverlay).
Failed at Sat Dec 22 23:46:34 2018 (Elapsed Time: 0.27 seconds)
Python Developer Communities GIS Developers Geo Developers
Hi Gustavo Colmenares ,
If you look at the help: WOTable—Spatial Analyst module | ArcGIS Desktop you will see at the bottom an example. In this example there are 3 rasters being used:
snow (weight 50%)
land (weight 20%)
soil (weight 30%)
As you can see the sum of the weights is 100% (this is required and what the error is referring to). Although when I sum up your weights I also get 100%, the notation is completely different from the example provided in the help.
Your sample:
myWOTable = WOTable([[ras4, 12, "LANDUSE", "('Brush/transitional' 5; 'Water' 'Restricted'; 'Barren land' 10; 'Built up' 3; 'Agriculture' 9; 'Forest' 4; 'Wetlands' 'Restricted'; 'NODATA' 'NODATA')"],
[reclass_slope_1, 13, "VALUE", "(1 'Restricted'; 2 'Restricted'; 3 'Restricted'; 4 4; 5 5; 6 6; 7 7; 8 8; 9 9; 10 10; 'NODATA' 'NODATA')"],
[reclass_eucD_rec_sites, 50, "VALUE", "(1 1; 2 2; 3 3; 4 4; 5 5; 6 6; 7 7; 8 8; 9 9; 10 10; 'NODATA' 'NODATA')"],
[reclass_eucD_schools, 25, "VALUE", "(1 1; 2 2; 3 3; 4 4; 5 5; 6 6; 7 7; 8 8; 9 9; 10 10; 'NODATA' 'NODATA')"]],
[eva_scl])
Sample for the help:
myWOTable = WOTable([["snow", 50, "VALUE", RemapValue([[0, 1], [1, 1], [5, 5],
[6, 6], [7, 7], [8, 8], [9, 9], ["NODATA", "NODATA"]])],
["land", 20, "VALUE", RemapValue([[0, 1], [1, 1], [5, 5],
[6, 6],[7, 7], [8, 8], [9, 9], ["NODATA", "NODATA"]])],
["soil", 30, "VALUE", RemapValue([[0, 1], [1, 1], [2, 2],
[3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9],
["NODATA", "NODATA"]])]], [1, 9, 1])
The best thing you can do in this situation is run the tool manually once and copy the Python Snippet to get the correct syntax and start working from there.
I have used many weighted overlays in the past, but I prefer not using the Weighted Overlay tool and do the calculations myself, since this gives me more control over the process and does not require to have a sum of weights that equals 100%.