Skip to content

Resolving barrier_mapper error in s6_barriers.py line 241#183

Open
lstoneburner-sfei wants to merge 1 commit into
linkagescape:mainfrom
lstoneburner-sfei:focalstatsfix
Open

Resolving barrier_mapper error in s6_barriers.py line 241#183
lstoneburner-sfei wants to merge 1 commit into
linkagescape:mainfrom
lstoneburner-sfei:focalstatsfix

Conversation

@lstoneburner-sfei

Copy link
Copy Markdown

Users have been experiencing an error at line 241 of s6_barriers.py, where Focal Statistics parameter was invalid. This update revises in_neighborhood on line 233 by changing capitalization of "Annulus ". The revised script runs to completion in ArcPro 3.3.2.

…Focal Statistics parameter by revising in_neighborhood on line 233; revised script works in ArcPro 3.3.2
@johngallo johngallo added bug Unexpected problem or unintended behavior high priority Requires attention in the immediate future barrier mapper Relating to Barrier Mapper tool labels Jan 6, 2025
@johngallo johngallo linked an issue Jan 6, 2025 that may be closed by this pull request
@johngallo

Copy link
Copy Markdown
Member

Thanks Lauren! I just posted this to the community email list:
"Hello Linkage Mapper Community,
We have a potential fix to a Bug Causing Barrier Mapper to fail on some Arc Pro configurations.
Before we commit it to the main branch of the code repository though, can someone try the new code on an ArcMap configured machine?
Huge thanks to Lauren Stoneburner for solving the bug in her situation, and taking the time to share the solution with all of us via pull request on github. Thanks Lauren!
Here is the pull request (i.e. the proposed code fix), and here is the zip file of the Linkage Mapper toolbox with the fix included, for you to test.  When you test, please post your results as a comment in the pull request thread on github (ideal) or to Lauren and I.
Thank you!
John"

@dkav

dkav commented Jan 6, 2025

Copy link
Copy Markdown
Contributor

Pull request #176 is the more correct way to fix this issue.

@johngallo

Copy link
Copy Markdown
Member

Hi All,

Thanks @dkav ! But something else may be going on, as #176 did not work in ArcPro, while this one does.

All, please note that it is ideal to also test the code from the other pull request: https://github.com/sdy623/linkage-mapper/archive/refs/heads/arcgis_pro_dev.zip Maybe it works on ArcPro after all?

Otherwise, if Lauren's fix works on both ArcMap and ArcPro, and we are not sure about the other one, I think we should implement her's as a temporary fix at least.

All, If anyone can be proactive, see also Darren's comment in that other pull request, namely: "I cannot test but the change looks correct. It is not the only neighborhood class update needed in this file. Defining neighborhood as a string and not as class goes back to ArcGIS 9.3. May be related to this Google Groups post."

Thanks,

John

@dkav

dkav commented Jan 7, 2025

Copy link
Copy Markdown
Contributor

@johngallo you might include the errors reported for the solution in #176. The approach in this PR is not documented in either ArcGIS Desktop or ArcGIS Pro help.

@megan-e-obrien

Copy link
Copy Markdown

Unfortunately, the above fix did not work when running the Barrier Mapper tool in ArcPro 3.4.0. Has anyone else experienced this issue with a slightly newer version of Pro? I've attached the log file here.
2025_02_13_2237_Barrier mapper.txt

@dkav

dkav commented Feb 14, 2025

Copy link
Copy Markdown
Contributor

@megan-e-obrien have you tried the solution in #176?

@megan-e-obrien

Copy link
Copy Markdown

@dkav I have, but unfortunately that did not solve the issue. I received the same error as before.

@dkav

dkav commented Feb 14, 2025

Copy link
Copy Markdown
Contributor

@megan-e-obrien what does the following log when you replace lines 233-234 with:

gprint("inner_radius")
gprint(str(type(inner_radius)))
gprint(str(inner_radius))
gprint("")
gprint("outer_radius")
gprint(str(type(outer_radius)))
gprint(str(outer_radius))

in_neighborhood = arcpy.sa.NbrAnnulus(inner_radius, outer_radius, "MAP")

@CGuilfoyle

Copy link
Copy Markdown

Hi all - any further solutions to this issue? Have tried all from above thread but same error - using ArcGIS Pro 3.4.0. Thanks

@xy625

xy625 commented Jun 11, 2025

Copy link
Copy Markdown

I have tried all the above methods, but the same error still occurs.
GISpro3.4.3, Linkage3.1.0, circuitscape4.0.7. and Build network and pinchpoint have been run successfully.

Best regards,

@johngallo

Copy link
Copy Markdown
Member

We are looking into the alternatives for raising funds to support code maintenance and development. I am accepting resumes of interested applicants that we will refer to before deciding if we will advertise the position (if we are successful).

Regarding the Barrier Mapper bug, it only arises in certain conditions. It could be that certain parameter configurations trigger the bug. You may want to try some different parameters, and if they do or not work, then to document them in a spreadsheet, and then share that here.

Tip: I suspect that the shortest radius searched for should be greater than the diagonal of cell. Probably double that to be on the safe side. And best to have the longest radius be a multiple of the shortest.

@miistakis

Copy link
Copy Markdown

Any movement on this issue? I have tried everything I could find in these threads, including increasing the radius size, but barrier mapper still will not work.

@johngallo

Copy link
Copy Markdown
Member

Hi @miistakis , We applied for a grant to fund further dev and to make the software more robust, including fixing this bug that occurs for some people and not others. It was approved with bells on by one org judging the grant but the other company did not approve, and it needed unanimity. So close! More on that soon I hope. In the meantime, barrier mapper is working in most applications. The good news is that I have a potential contract to do some barrier mapper work and I'll bet the client would approve me spending some of the time fixing this bug, regardless of it arises for their landscape or not. this would endure the analysis could be updated more easily in the future. More soon I hope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

barrier mapper Relating to Barrier Mapper tool bug Unexpected problem or unintended behavior high priority Requires attention in the immediate future

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Barrier Mapper ANNULUS capitalization issue

7 participants