DOI-USGS / nhdplusTools

See official repository at: https://code.usgs.gov/water/nhdplusTools
https://doi-usgs.github.io/nhdplusTools/
Creative Commons Zero v1.0 Universal
85 stars 33 forks source link

get_raindrop_trace returns internal server 500 error #392

Closed mkoohafkan closed 3 months ago

mkoohafkan commented 3 months ago

I am unable to use the get_raindrop_trace() function. I am trying to get the nearest flowline to USGS gages that do not fall on a flowline, due to location discrepancies between the USGS site metadata and the NHDplus flowlines.

reprex:

point = list(featureSource = "nwissite", featureID = "USGS-15484000") |>
  get_nldi_feature()

get_raindrop_trace(point)

## Request failed [500]. Retrying in 1.8 seconds...
## Request failed [500]. Retrying in 1 seconds...
## Error calling processing service. 
##  Original error:
## Error in doTryCatch(return(expr), name, parentenv, handler): Internal Server Error

The end goal is to snap the gage location to the nearest flowline, and then use get_split_catchment() to get the drainage area associated with the gage. I actually need to do this for a large number of gages (potentially thousands), so let me know if there is a better way accomplish this.

dblodgett-usgs commented 3 months ago

Hi @mkoohafkan -- unfortunately, if your nwissite doesn't fall within the NHDPlusV2 domain, this functionality won't work.

mkoohafkan commented 3 months ago

Ah I see. Is there no equivalent method for the NHDPlus HR domain?

dblodgett-usgs commented 3 months ago

No, not really. Looks like you are in AK, -- NHDPlusHR doesn't exist there either -- so it's doubly problematic. There's very little elevation data that works for catchment delineation or raindrop trace applications in Alaska unfortunately.

mkoohafkan commented 3 months ago

hmm, that's strange---for this location there are flowlines (GNIS_ID 01408991) and delineated catchments (NHDPlusID 75024900000247) in the NHDPlus HR geodatabase (NetworkNHDFlowline and NHDPlusCatchment layers, respectively).

While the raindrop trace and split catchment features would be nice, it would be fine for my use case to just grab the catchment containing my gage and all upstream catchments. Can this be accomplished with hydroloom/nhdplusTools?

dblodgett-usgs commented 3 months ago

Oh -- I see. Sorry, I didn't realize there was as much NHDPlusHR in Alaska as there is.

Yes, you should be able to use hydroloom to do network navigations on the NHDPlusHR network and union catchments together to create basins.

https://doi-usgs.github.io/nhdplusTools/articles/nhdplushr.html https://doi-usgs.github.io/hydroloom/articles/network_navigation.html

Should be good resources.

https://doi-usgs.github.io/hydroloom/reference/navigate_hydro_network.html should work with nhdplushr out of the box.

mkoohafkan commented 3 months ago

Thanks, I think I have an alternative solution working now thanks to your links. Not sure what level of control you have over this, but it would be helpful if the function could differentiate between error due to being outside the domain vs other errors/network connection issues.

dblodgett-usgs commented 3 months ago

I agree -- that would be very helpful. I'll leave this issue open and see if I can improve it in the future. Thanks for your patience and perseverance.