Circuitscape / Circuitscape.jl

Algorithms from circuit theory to predict connectivity in heterogeneous landscapes
https://circuitscape.org
MIT License
128 stars 35 forks source link

Focal nodes outside habitat map - but not in GIS #380

Open SamLS84 opened 1 year ago

SamLS84 commented 1 year ago

I'm trying to run Julia and after several attempts to get my data to import I keep getting an error message telling me that focal nodes fall outside the habitat map (error text below). However, this is not the case as the habitat map has been built around the focal nodes and in GIS all of the focal nodes are within the habitat map.

[ Info: 2023-05-08 15:09:45 : Precision used: Double [ Info: 2023-05-08 15:09:46 : Reading maps [ Info: 2023-05-08 15:09:47 : Resistance/Conductance map has 150943 nodes ERROR: "At least one focal node location falls outside of habitat map" Stacktrace: [1] read_point_map(V::Type, file::String, habitatmeta::Circuitscape.RasterMeta) @ Circuitscape C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\io.jl:230 [2] load_raster_data(T::Type, V::Type, cfg::Dict{String, String}) @ Circuitscape C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\io.jl:448 [3] raster_pairwise(T::Type, V::Type, cfg::Dict{String, String}) @ Circuitscape C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\raster\pairwise.jl:18 [4] _compute(T::Type, V::Type, cfg::Dict{String, String}) @ Circuitscape C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\run.jl:43 [5] macro expansion @ .\timing.jl:382 [inlined] [6] compute(dict::Dict{String, String}) @ Circuitscape C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\run.jl:74 [7] step10(name::String, path::String) @ Circuitscape.INIBuilder C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\INIBuilder\run.jl:139 [8] step9(name::String) @ Circuitscape.INIBuilder C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\INIBuilder\run.jl:131 [9] step8() @ Circuitscape.INIBuilder C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\INIBuilder\run.jl:120 [10] step7() @ Circuitscape.INIBuilder C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\INIBuilder\run.jl:110 [11] step6() @ Circuitscape.INIBuilder C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\INIBuilder\run.jl:97 [12] step5() @ Circuitscape.INIBuilder C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\INIBuilder\run.jl:87 [13] step4() @ Circuitscape.INIBuilder C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\INIBuilder\run.jl:76 [14] step3() @ Circuitscape.INIBuilder C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\INIBuilder\run.jl:47 [15] step2() @ Circuitscape.INIBuilder C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\INIBuilder\run.jl:30 [16] step1() @ Circuitscape.INIBuilder C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\INIBuilder\run.jl:14 [17] start() @ Circuitscape.INIBuilder C:\Users\ecowi.julia\packages\Circuitscape\XpftG\src\INIBuilder\run.jl:188 [18] top-level scope @ REPL[2]:1


I don't know if it is something I am doing as I am not familiar with either circuitscape or julia
and the above means nothing to me.
I imported the habitat layer as a .tif.ovr file and the focal nodes as a .txt file as these were the only 
ones that seemed to work.  I've been through lots of other errors messages about that.

I would greatly appreciate any help, preferably with suggestions in as plain English as possible as I do struggle 
with the technical coding language.

Thanks in advance!
SamLS84 commented 1 year ago

Another call for help on this as I've tried everything I can think of including recreating all of the rasters and other exported files. In GIS all of the nodes are within the raster areas and all of the output co-ordinate systems have been set the same.

@tanmaykm @ranjanan @ViralBShah any suggestions would be greatly appreciated.

ranjanan commented 1 year ago

@SamLS84 can you put your raster in a google drive or dropbox link and either attach here or mail me separately? I'll have to reproduce on my machine to be able to diagnose.

nataliemyers12 commented 1 year ago

Hi, I am also having this issue. Have there been any updates?

SamLS84 commented 1 year ago

Hi Natalie, I ended up doing a bit of a work around in ArcGIS. Is that the mapping software that your data is in before importing into circuitscape?

If so, what I ended up doing was creating a raster of the resistance layer and a raster for the focal nodes layers, both with the same cell size (as small as you are able, for me cell size 25 worked). The I used the ASCII converter in the geoprocessing pane to convert each the resistance file to a .asc file and the focal nodes to a .txt file (you change the file type manually in the output file name) making sure each one is set set to the resistance layer extent.

If it is Arc that you're using let me know if you need any more of a breakdown in the steps, it took me so long to figure it out so if I can save someone else from that I will.

Then you use circuitscape as per the instructions. This brought over about 90% of all my samples so some info was lost but it was the only way I could get it to work.

There's probably another way to resize the focal nodes layer so the extent matches the resistance layer but I couldn't find one that would work so this was a bit of a work around.

nataliemyers12 commented 1 year ago

Hi Sam,

Thank you so much! Im using QGIS, but this general method seems to be working to fix that error.

SamLS84 commented 1 year ago

No worries, glad it's helped.