error message:
KeyError: "not all values found in index 'time'. Try setting the method keyword argument (example: method='nearest')."
with method:
TypeError: Cannot compare dtypes datetime64[ns] and datetime64[ns, tzutc()]
I find an issue was needed, although a easy fix is doable (just pass to np.datatime64), many datasets dont have the timestamp in that format so, an easy fix on this side was just to change the formating whenever the indexing selection occures.
While trying to use .sel to get certain times from the xarray if the timestamp used for compared was not in np.datetime64 it would either:
Code to replicate:
Now to get the erros: <class 'datetime.datetime'>
error message: KeyError: "not all values found in index 'time'. Try setting the
method
keyword argument (example: method='nearest')."with method: TypeError: Cannot compare dtypes datetime64[ns] and datetime64[ns, tzutc()]
I find an issue was needed, although a easy fix is doable (just pass to np.datatime64), many datasets dont have the timestamp in that format so, an easy fix on this side was just to change the formating whenever the indexing selection occures.
If you agree I can open a PR to solve this