-
Notifications
You must be signed in to change notification settings - Fork 39
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
Comments
Yes, this definitely belong logically in cftime :) |
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. |
@spencerahill, are there any plans to submit a pull request for this? |
@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. |
OK, I will leave it open |
What would the API be for this? A |
Honestly it's probably fine to keep much of this in xarray. cftime.strptime
feels like a nice abstraction to add here, though.
…On Tue, Dec 18, 2018 at 1:13 PM Spencer Hill ***@***.***> wrote:
What would the API be for this? A cftime.strptime function, akin to
datetime.strptime
<https://docs.python.org/3/library/datetime.html#datetime.datetime.strptime>?
The relevant code in xarray
<https://github.com/pydata/xarray/blob/9c8005937556211a8bf28a946744da3768846c5a/xarray/coding/cftimeindex.py#L12-L100>
has parse_iso8601, _parse_iso8601_with_reso, and _parsed_string_to_bounds
functions.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#51 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABKS1gHNj_0Rqpdkvjq7TmrgJUsq4lVAks5u6VpogaJpZM4UXM1m>
.
|
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. |
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
The text was updated successfully, but these errors were encountered: