Skip to content
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

Update get_pfafstetter_basins.R #81

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Update get_pfafstetter_basins.R #81

wants to merge 2 commits into from

Conversation

domisch
Copy link
Member

@domisch domisch commented Dec 10, 2024

Added a pre-selection of the 100 longest streams from which the most contributing (main) stream will be identified based on the area

Added a pre-selection of the 100 longest streams from which the most contributing (main) stream will be identified based on the area
@merretbuurman
Copy link
Collaborator

Hi! Thanks for the contribution!
Unfortunately I could not get the example to run. This is what happens:

> pfafstetter <- get_pfafstetter_basins(g = g_subset, subc_raster = subc_raster,  out_dir = my_directory, file_name = "pfafstetter_raster.tif",  data_table = FALSE,  n_cores = 4)
Setting up parallel backend...
Using 4 CPUs... 
Preparing the graph...
Calculating the area of single sub-catchments...
Finding the most contributing stream... 
Error in setnames(x, value) : 
  Can't assign 1 names to a 0-column data.table
> 

Some hint:
During testing, I found out that after the line cat("Finding the most contributing stream..."), the object headwater is an object of type character with a length of hundred, but it has no names - length(names(headwater)) is zero, so maybe that is what causes it to fail? names(headwater) is used repeatedly in the lines after that. But I didn't debug any further yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants