Skip to content

Issue with rcode in API request? #365

@nolantownsend

Description

@nolantownsend
  • 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions