-
Notifications
You must be signed in to change notification settings - Fork 32
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
how to best set lim? // allow string in convert
?
#178
Comments
@spencerkclark Do you have any thoughts on this? @SciTools/peloton wonders if this is doable at all. |
In principle I think this would be doable, though it would take a little thought to get right. @mathause are you thinking that we would interpret the passed strings independent of whether they corresponded to the start or end of the interval, e.g. While matplotlib does not support passing strings for limits of datetime axes on its own (matplotlib/matplotlib#25219), it appears at least pandas has a converter that does. In pandas it seems the answer would be fig, ax = plt.subplots(1, 1)
times = pd.date_range("2049", periods=2500)
series = pd.Series(range(2500), index=times)
series.plot(ax=ax)
ax.set_xlim(None, "2050") I'm not sure I have the bandwidth right now to implement this, but I would be open to reviewing a PR. |
From @SciTools/peloton: is there a way of doing this without introducing further dependencies? Right now nc-time-axis has very few: nc-time-axis/requirements/py311.yml Lines 13 to 16 in 0594c9b
... which makes it nice and flexible with Xarray, Iris and others. |
✨ Feature Request
Should/ could allow passing a string to
convert
(of theNetCDFTimeConverter
) be beneficial?Motivation
I want to set the xlim of a nc-time axis. Is there a more convinent way than to pass
cftime._cftime.datetime
?It seems I need to do:
It would be nice if we could pass a string - similar as we do with
sel
in xarray, e.g.:Additional context
Click to expand this section...
The text was updated successfully, but these errors were encountered: