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

Partial datetime string parsing in cftime #51

Open
spencerahill opened this issue Jun 1, 2018 · 8 comments
Open

Partial datetime string parsing in cftime #51

spencerahill opened this issue Jun 1, 2018 · 8 comments

Comments

@spencerahill
Copy link

Recently in the xarray mailing list (here) and in aospy (here) the need has arisen for the partial datetime string parsing that is currently implemented in xarray as private API, which we therefore don't want to rely on. @spencerkclark argued, and I think I agree, that this functionality is outside the scope of xarray in terms of making it public API.

Separately, @mcgibbon raised the notion of porting it to cftime, which I like the idea of also. Does this seem reasonable? It seems like such a common datetime-related need that it would well fit in the scope of cftime.

CC: @shoyer for any thoughts from the xarray side

@shoyer
Copy link
Contributor

shoyer commented Jun 1, 2018

Yes, this definitely belong logically in cftime :)

@shoyer
Copy link
Contributor

shoyer commented Jun 1, 2018

I think we are the only authors of this code (OK, technically Google owns what I wrote), so there should be no problem redistributing it under the cftime license.

@jswhit
Copy link
Collaborator

jswhit commented Aug 18, 2018

@spencerahill, are there any plans to submit a pull request for this?

@spencerahill
Copy link
Author

@jswhit I am on travel for several weeks and then under a really pressing deadline through Nov. 1, so unfortunately the earliest I would be able to get to this is sometime in November. But I'm happy to do so then. I invite someone else to do it in the meantime if there is an immediate need.

@jswhit
Copy link
Collaborator

jswhit commented Aug 18, 2018

OK, I will leave it open

@spencerahill
Copy link
Author

What would the API be for this? A cftime.strptime function, akin to datetime.strptime? The relevant code in xarray has parse_iso8601, _parse_iso8601_with_reso, and _parsed_string_to_bounds functions.

@shoyer
Copy link
Contributor

shoyer commented Dec 18, 2018 via email

@swartn
Copy link

swartn commented Jun 28, 2024

Extending on this, we have the need to use cftime and related logic in a project (including partial strings), but we do not need any other xarray functionality. So we have been adapting some of the xarray logic for essentially dealing with cftime partial strings and offsets / timedeltas. At least within our team, we concluded it would be helpful to have some of that functionality available in cftime, for those who need to deal with these kind of dates, but do not need xarray. I'm not sure of the feeling on this - but if there was interest, we could consider directing some effort to making a PR to cftime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants