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

Issue with rcode in API request? #365

Open
nolantownsend opened this issue Oct 1, 2021 · 1 comment
Open

Issue with rcode in API request? #365

nolantownsend opened this issue Oct 1, 2021 · 1 comment

Comments

@nolantownsend
Copy link

nolantownsend commented Oct 1, 2021

  • StreamStats version: 0.1.5
  • Python version: 3.8.11
  • Operating System: Windows 10

Description

I was using streamstats to get different basin characteristics in watersheds in GA. If I understand correctly, there is a function within the package that determines the state the lat/long coordinate is in so it can make an API call with that rcode. However, I think that the rcode technically coincides with the streamgrid that the lat/long coordinate is near.

See the stream grids here: https://streamstatsags.cr.usgs.gov/StreamGrids/directoryBrowsing.asp

What I Did

There was a particular lat/long coordinate that falls within Florida, but the streamgrid for Georgia actually extends down into this area of Florida.

To confirm this I tried running the coordinates through the StreamStats Service Documentation (https://streamstats.usgs.gov/docs/streamstatsservices/#/).

I tried both of the following REST Query URLs:
https://streamstats.usgs.gov/streamstatsservices/watershed.geojson?rcode=FL&xlocation=-82.12233534&ylocation=30.26887137&crs=4326&includeparameters=false&includeflowtypes=false&includefeatures=true&simplify=true

and:
https://streamstats.usgs.gov/streamstatsservices/watershed.geojson?rcode=GA&xlocation=-82.12233534&ylocation=30.26887137&crs=4326&includeparameters=false&includeflowtypes=false&includefeatures=true&simplify=true

I found that the GA rcode garners a response but the FL one gives an error. In my mind I think one solution would be downloading all the stream grids for each state and then creating a polygon for each of those based on the extents. Those polygons would essentially be the states you would want those lat/long coordinates fall into and determine the rcode based off of.

As a test I ran the following code:

lat, lon = 30.43632736, -82.28711271
ws = streamstats.Watershed(lat=lat, lon=lon)
print(ws)

I got the following error:

RetryError: HTTPSConnectionPool(host='streamstats.usgs.gov', port=443): Max retries exceeded with url: /streamstatsservices/watershed.geojson?rcode=FL&xlocation=-82.28711271&ylocation=30.43632736&crs=4326&includeparameters=True&includeflowtypes=False&includefeatures=True&simplify=False (Caused by ResponseError('too many 500 error responses'))

Please disregard or correct me if I am incorrect!

@amedenblik
Copy link

StreamStats has not been developed for Florida, so that is the reason for the error.

image

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