-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR: LoadError: BoundsError: attempt to access 1×1 Matrix{Union{Missing, Number}} at index [1:201, 1:201] #109
Comments
Hi @amywaananen, thanks for posting this issue! Could you post the code that caused the issue here? I suspect that there is an issue with the raster for your first condition. It looks like it is a 1 by 1 array when it should be the same size as your resistance surface. |
Yes, code below. Let me know if I should send you the files. Thanks! using Pkg; Pkg.add(["Omniscape","GeoData", "Plots"])
using Omniscape, GeoData, Plots
# Read in the resistance layers and assign info to variables for omniscape settings
resistance, wkt, transform = Omniscape.read_raster("01_Data\\wca_conductance.tif", Float64)
# Specify the configuration settings for the omniscape run
config = Dict{String, String}(
"radius" => "100", # radius of the moving window in *pixels*
"block_size" => "21",
"project_name" => "md_nlcd_omniscape_output", # name of the folder to create for output
"source_from_resistance" => "true", # Source matrix comes from the resistance matrix
"r_cutoff" => "20", # Only grassland pixels should be sources
"resistance_is_conductance" => "false",
"reclassify_resistance" => "false", # use the reclass_table for the resistnace matrix
"calc_normalized_current" => "true", # calculate the normalized current
"calc_flow_potential" => "true", # calculate the "flow potential" - the flow if resistance was 1 at all pixels
"conditional" => "true",
"comparison1" => "within",
"compare_to_future" => "1",
"condition1_future_file" => "01_Data\\wca_conductance_future.tif"
)
currmap, flow_pot, norm_current = run_omniscape(config,
resistance,
wkt = wkt,
geotransform = transform,
write_outputs = true)
|
Ah, so the issue here is that for this omniscape method (as opposed to the INI method) all rasters need to be provided as in-memory objects (like what you did with the resistance surface). For this method you can't provide file paths. See here in the docs for all of the things that need to be passed as arguments as opposed to items in the configuration dictionary. |
Ah, I see! Makes sense. I tried providing the future raster as an in-memory object earlier, but hadn't realized that I needed to include the raster as an argument for both condition1 and condition1_future in run_omniscape(). It's working now. Thanks! |
Excellent!! I'm glad it worked out. Don't hesitate to open new issues as any other roadblocks come up! |
Is there a nice user-friendly error message that can be thrown if this is a standard error? |
For now I think the docs do a good enough job describing it, but if it comes up again I'll prioritize creating an error |
Good morning!
I am getting the following error when I attempt to run Omniscape with conditional connectivity options. Do you have any suggestions about what might be going on?
Thank you,
Amy
The text was updated successfully, but these errors were encountered: