-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
New: FeatureHighlight a new community raised "feature request" issueHighlight a new community raised "feature request" issue
Description
✨ Feature Request
Should/ could allow passing a string to convert
(of the NetCDFTimeConverter
) 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:
import numpy as np
import matplotlib.pyplot as plt
import xarray as xr
data = np.random.randn(100)
time = xr.date_range("2000", "2100", freq="A", calendar="noleap")
da = xr.DataArray(data, coords={"time": time})
f, ax = plt.subplots()
da.plot(ax=ax)
ax.set_xlim(None, da.time.sel(time="2050").item())
It would be nice if we could pass a string - similar as we do with sel
in xarray, e.g.:
ax.set_xlim(None, "2050")
Additional context
Click to expand this section...
Please add additional verbose information in this section e.g., references, screenshots, listings etc
Metadata
Metadata
Assignees
Labels
New: FeatureHighlight a new community raised "feature request" issueHighlight a new community raised "feature request" issue
Type
Projects
Status
No status