hyriver / pygeohydro

A part of HyRiver software stack for accessing hydrology data through web services
https://docs.hyriver.io
Other
68 stars 23 forks source link

NWIS data retrieval enhancement ideas #75

Closed rsignell-usgs closed 2 years ago

rsignell-usgs commented 2 years ago

It would be great to be able to set some parameter to ensure that the retrieved NWIS data are in UTC.

Also it would be nice to have the ability to return the data (along with metadata such as units!) as an xarray dataset instead of a pandas dataframe.

There is an example NWIS code here by @dnowacki-usgs that optionally returns an xarray dataset.

cheginit commented 2 years ago

Thanks for these good suggestions. I implemented them and updated README and the NWIS example notebook. Please take a look, give them a try, and let me know what you think.

rsignell-usgs commented 2 years ago

@cheginit , I just tried the lastest from master, and it worked great! Thanks so much for implementing this!

cheginit commented 2 years ago

Great. Thanks!

rsignell-usgs commented 2 years ago

@cheginit , I just realized that if I requested 6000 stations, I would get 6000 variables. It would be better if the stations were a new dimension (e.g. "station_id" or "feature_id") and we also had a "station_id" or "feature_id" variable that contained the name (character or int, I guess). Would that be difficult? Should I submit a new ticket?

cheginit commented 2 years ago

@rsignell-usgs I actually thought about this. The issue with this approach is that I have to include all station-specific attrs such as station name, lon, lat, etc as a new coordinate. So there is going to be too many dims. At the moment each station has 9 attributes, for example:

image

My initial approach looks like this:

image

But at the end I just went with the simplest solution to keep all the attrs.

I am open to suggestions. Having time and station ID as dims is more in line with xarray but then we end up with too many dims. One way would be to just keep lon, lat and alt and drop the rest.

cheginit commented 2 years ago

After some thinking, I came up with a solution, all attrs as variables:

image

There's no need for submitting a new feature. I will reference this issue.

Let me know what you think about this approach.

rsignell-usgs commented 2 years ago

@cheginit, that's a great idea!!! Love it!

cheginit commented 2 years ago

Great! I'll probably release a new version late Dec. Till then, you can use it by installing from the main branch.