[Omniscape] Convergence error while trying to run it on almost any raster

Hello, I am trying to run the Omniscape example given on its documentation page: Examples · Omniscape.jl

When I get to the line where I actually start the Omniscape algorithm, it errors out with the message: “CG solver did not converge: relative residual exceeds tolerance 1e-4”

Previously I’ve had success with running Omniscape in Julia 1.11 on my own rasters.

But after reinstalling Julia 1.11 on a new system, almost every raster I try gives me the “solver did not converge” error.
The error occurs even on previously tried-out rasters that gave me good connectivity outputs… I tried changing the solver and numerous other settings, to no avail.

Is it possible that there are some new compatibility issues with packages that Omniscape depends on?

Hi, welcome to the forum!
Could you provide a complete example of the code you’re trying to run? This looks more like a numerical issue than a compatibility conflict to me

This is the code that gives the convergence error, taken straight from their tutorial on the page I linked in the original post, without the raster visualization lines. It crashes after calling the run_omniscape function.

using Pkg; Pkg.add(["Omniscape", "Rasters", "Plots"])
using Omniscape, Rasters, Plots

url_base = "https://raw.githubusercontent.com/Circuitscape/datasets/main/"
# Download the NLCD tile used to create the resistance surface and load it
download(string(url_base, "data/nlcd_2016_frederick_md.tif"),
         "nlcd_2016_frederick_md.tif")


land_cover, wkt, transform = Omniscape.read_raster("nlcd_2016_frederick_md.tif", Float64)

# Create the reclassification table used to translate land cover into resistance
reclass_table = [
    11.	100; # Water
    21	500; # Developed, open space
    22	1000; # Developed, low intensity
    23	missing; # Developed, medium intensity
    24	missing; # Developed, high intensity
    31	100; # Barren land
    41	1; # Deciduous forest
    42	1; # Evergreen forest
    43	1; # Mixed forest
    52	20; # Shrub/scrub
    71	30; # Grassland/herbaceous
    81	200; # Pasture/hay
    82	300; # Cultivated crops
    90	20; # Woody wetlands
    95	30; # Emergent herbaceous wetlands
]

# Specify the configuration options
config = Dict{String, String}(
    "radius" => "100",
    "block_size" => "21",
    "project_name" => "md_nlcd_omniscape_output",
    "source_from_resistance" => "true",
    "r_cutoff" => "1", # Only forest pixels should be sources
    "reclassify_resistance" => "true",
    "calc_normalized_current" => "true",
    "calc_flow_potential" => "true"
)


currmap, flow_pot, norm_current = run_omniscape(config,
                                                land_cover,
                                                reclass_table = reclass_table,
                                                wkt = wkt,
                                                geotransform = transform,
                                                write_outputs = true)

The code I’ve used on my own rasters is like this tutorial but without the mapping of categories, as I supply the continuous resistance raster directly, not a categorical raster. But this example is more convenient to share, as the raster used in it can be downloaded by you.

My key concerns here are that I get the convergence crash even on their example, and that I could previously run these connectivity analyses with the same Julia version on my old workstation, but now running it on the same resistance rasters with the same config gives these errors.

What happens if you freeze the Manifest on your old workstation and try to instantiate it on your new one?