Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

Gage distance to outlet #121

Open
jds485 opened this issue Jul 7, 2022 · 6 comments
Open

Gage distance to outlet #121

jds485 opened this issue Jul 7, 2022 · 6 comments
Assignees
Labels
enhancement New feature or request MetricsPaper

Comments

@jds485
Copy link
Member

jds485 commented Jul 7, 2022

Adding an attribute "distance of gage to catchment outlet, as proportion of reach length" could help to account for the error associated with using attributes that are computed for catchment outlets while gages are upstream of the outlet.

@jds485
Copy link
Member Author

jds485 commented Jul 7, 2022

Options from Lauren Koenig:
There is not a helper function that I'm aware of in nhdplusTools to do that. [update] get_flowline_index in nhdplusTools attempts to return a location along the reach (attribute called REACH_meas). The nearest neighbor search under the hood may not allow for the resolution you're looking for as I've sometimes found that attribute to be really coarse, but you could check out the documentation for that function and see if that gets you what you need.

I think the approach I would take is to densify the matched flowline, and then snap the gage site to the nearest densified point/node along the flowline. Then I think I could create a new linestring that is the most downstream one and compute the length of it (or, if the densified points were equally spaced, e.g. 1 m, you could probably just count up the nodes in between). This seems doable, although computing the distance may or may not work readily.

Another option you could consider is to use the igraph package in R (there's a python version to) to coerce the network into a directed graph and compute distances between nodes that represent gage locations and downstream vertices.

Also, I think 'riverdist' is meant for this sort of use case

@jds485
Copy link
Member Author

jds485 commented Jul 8, 2022

@ajsekell see thoughts from Lauren about how the distance from gage to catchment outlet could be done. Interested in your thoughts for this, too.

@ajsekell
Copy link
Collaborator

ajsekell commented Jul 8, 2022

the flow accumulation grids in nhd could also be useful. The most downstream grid cell in a catchment should have the highest fac value. with the gage snapped to the flowline, you now have 2 points along the flow line. you could split the flowline by those points and use rgeos::gLength in R, or gProject if you don't want to split the flowline. I've never used either of those but they look like they should work.

i have not used nhdplusTools much unfortunately.

might be a fun little project...i might do some experimenting later.

@ajsekell
Copy link
Collaborator

just posting that i made a script that does this for 1 gage at a time, would need to be (easily) modified to do it for full list of gages. we can come back to it later.

@cstillwellusgs
Copy link
Collaborator

Compare drainage areas from NWIS (p1_drainage_area in square miles), SB (ACC_BASIN_AREA in square kilometers), and nhdPlus (TotDASqKM in square kilometers). Compare absolute and percent differences (small gages may have high percent difference, see issue #9).

@jds485 jds485 added the enhancement New feature or request label May 8, 2023
@jds485
Copy link
Member Author

jds485 commented May 8, 2023

Charlie: Could be an analysis post-processing evaluation instead of being used as a feature in the prediction model.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request MetricsPaper
Projects
None yet
Development

No branches or pull requests

3 participants