linkagescape / linkage-mapper

ArcGIS tools to automate mapping and prioritization of wildlife habitat corridors
https://circuitscape.org/linkagemapper/
GNU General Public License v3.0
39 stars 12 forks source link

Error in LP in calculating Core Area Value when some centrality values are 0 (CF_Centrality) #78

Open johngallo opened 5 years ago

johngallo commented 5 years ago

This bug can occur when there are no errors, but it is very rare/extreme. It occurs when the centrality value of a core is 0. The below was caused in part by an island, seperted from the mainland by "infinite" resistance (user error), but also by some small slivers on the mainland, but on the periphery. I believe. Whoever tackles this bug shold first look at the 0 valued CF_Cental cores on the vm10 data to be sure hey are on the periphery.

At the very beginning of a linkage Priority run (v190403_vm10), I get the following error:

Retreiving outputs from Linkage Pathways model run Calculating permeability for each LCP line Calculating relative closeness for each LCP line Calculating Core Area Value (CAV) and its components for each core unsupported operand type(s) for +: 'float' and 'NoneType' Traceback (most recent call last): File "E:\Gallo\GIS\Projects\NPLCD_2018_john_gallo\NPLCD\Tasks\Connectivity_LM\Tools\Models\Linkage_Mapper\toolbox\scripts\lp_main.py", line 845, in main run_analysis() File "E:\Gallo\GIS\Projects\NPLCD_2018_john_gallo\NPLCD\Tasks\Connectivity_LM\Tools\Models\Linkage_Mapper\toolbox\scripts\lp_main.py", line 780, in run_analysis calc_cav(core_lyr) File "E:\Gallo\GIS\Projects\NPLCD_2018_john_gallo\NPLCD\Tasks\Connectivity_LM\Tools\Models\Linkage_Mapper\toolbox\scripts\lp_main.py", line 659, in calc_cav True) File "E:\Gallo\GIS\Projects\NPLCD_2018_john_gallo\NPLCD\Tasks\Connectivity_LM\Tools\Models\Linkage_Mapper\toolbox\scripts\lp_main.py", line 260, in normalize_field in_field + "!) / " + str(max_val), "PYTHON_9.3")

Completed script LinkagePriority2... Failed to execute (Linkage Priority (2)). Failed at Sat Apr 6 17:29:43 2019 (Elapsed Time: 35.34 seconds) Failed to execute (a30 Linkage PriorityNPLCD). Failed at Sat Apr 6 17:29:43 2019 (Elapsed Time: 36.62 seconds)

Meanwhile a run on another machine (v190405_vm6), it passed through this part of the code no problem. One of the differnces is that on this local machine (vm10, the core fields are more, and some of the CF_Centrality values are 0. On the other one, ther are no )s. (Whether or not that is an error is my next line of inquiry.) Regardless, the LM code shuodl be fixed to allow for CF_Central = 0, right?

Note, the LP settings are such that all the CAV fields except for centrality are = 0. THose parameter values are available upon request.

Full error message: Document0403vm10_firsterrormessage.zip

core_centrality_v190405_vm6.gdb.zip core_centrality_v190403_vm10.gdb.zip