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

covariate_river run time #6

Open
tanharri opened this issue Dec 14, 2023 · 1 comment
Open

covariate_river run time #6

tanharri opened this issue Dec 14, 2023 · 1 comment

Comments

@tanharri
Copy link

Hi,

I am trying to use the function covariate_river to attach the values of a covariate to a river network. The runtime of this function seems to be exceptionally long. I was wondering if this would be expected given the size and structure of the river network, and whether there is a faster solution.

For example, given the way the covariates are attached in the edith vignette https://cran.r-project.org/web/packages/eDITH/vignettes/eDITH.html

Could I extract an average along the aggregated vertices and attach them similarly to how elev is incorporated? And in that sense, is SC equivalent to AG, given that the river object must be aggregated to run covariate_river?

Cheers

rivnet::covariate_river(my_covar, river, categorical = categorical)

my_covar
class : SpatRaster
dimensions : 1074, 1345, 1 (nrow, ncol, nlyr)
resolution : 100.2776, 100.2776 (x, y)
extent : 277070.7, 411944.2, 753964.1, 861662.3 (xmin, xmax, ymin, ymax)
coord. ref. : OSGB36 / British National Grid
source(s) : memory
name : landcover
min value : 111
max value : 523

river
Class : river
Type : Real river
No. FD nodes : 1224671
Dimensions : 2685 x 1113
Cell size : 41.65
Has elevation : TRUE
Aggregated : TRUE
Threshold area : 4249300.54
Max reach length: Inf
No. RN nodes : 14893
No. AG nodes : 265
Has paths : FALSE
River geometry : TRUE

@lucarraro
Copy link
Owner

Hi,

I haven't tested covariate_river for very large river networks, so I cannot say much about its runtime in such cases.
If you don't mind, I could have a look at your script and see whether there's a way to improve the function's speed. You can find my e-mail in the package description.

As for your further questions, I'm not quite sure I fully understood them. Probably, some more context on what your goal is would help. Anyways, you can indeed attach objects to an existing river object. SC is equivalent to AG in the sense that there's a 1:1 correspondence between the two levels (for each reach there's a respective subcatchment).

Cheers,
Luca

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

No branches or pull requests

2 participants