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

NWIS data retrieval enhancement ideas #75

Closed
rsignell-usgs opened this issue Nov 30, 2021 · 8 comments
Closed

NWIS data retrieval enhancement ideas #75

rsignell-usgs opened this issue Nov 30, 2021 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@rsignell-usgs
Copy link

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 pushed a commit that referenced this issue Nov 30, 2021
@cheginit cheginit self-assigned this Nov 30, 2021
@cheginit cheginit added the enhancement New feature or request label Nov 30, 2021
@cheginit
Copy link
Collaborator

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
Copy link
Author

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

@cheginit
Copy link
Collaborator

cheginit commented Dec 2, 2021

Great. Thanks!

cheginit pushed a commit that referenced this issue Dec 5, 2021
… that is, all station number are unique. This prevents an issue with setting attrs where duplicate indexes cause an exception when being converted to a dict (#75) [skip ci]
@rsignell-usgs
Copy link
Author

@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
Copy link
Collaborator

cheginit commented Dec 6, 2021

@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
Copy link
Collaborator

cheginit commented Dec 6, 2021

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.

cheginit pushed a commit that referenced this issue Dec 6, 2021
…dding all other station attrs as variables (#75). [skip ci]
@rsignell-usgs
Copy link
Author

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

@cheginit
Copy link
Collaborator

cheginit commented Dec 7, 2021

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

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

No branches or pull requests

2 participants