Open huaracheguarache opened 1 year ago
Indeed currently we do not support indexing a CFTimeIndex-backed array using a list of strings, but that's something I think we would be happy to change (e.g. we do accept a list of strings to interp
for CFTimeIndex-backed arrays).
For the time being you should be able to use cftime.DatetimeAllLeap
values themselves:
ds.sel(time=[cftime.DatetimeAllLeap(2023, 1, 1), cftime.DatetimeAllLeap(2023, 1, 2)])
Ok, great! Thanks for the tip.
On Mon, Feb 6, 2023 at 13:51, Spencer Clark @.***> wrote:
Indeed currently we do not support indexing a CFTimeIndex-backed array using a list of strings, but that's something I think we would be happy to change (e.g. we do accept a list of strings to interp for CFTimeIndex-backed arrays).
For the time being you should be able to use cftime.DatetimeAllLeap values themselves:
ds
.
sel
(
time
=
[
cftime
.
DatetimeAllLeap
(
2023
,
1
,
1
),
cftime
.
DatetimeAllLeap
(
2023
,
1
,
2
)])
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
What happened?
When I try to select a subset of the data in a dataset/array with a list containing dates it fails when the time index is in cftime, and I get the following error message:
KeyError: "not all values found in index 'time'"
What did you expect to happen?
I expect selecting a set of dates with a list to work the same way as when the time index is in datetime64.
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
No response
Environment