Skip to content

Filtering out time object in netcdf data #8650

Answered by spencerkclark
gateuxx asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for the very clear question! I recommend taking a look at the convert_calendar method—I think the following should do what you are looking for:

data.convert_calendar("standard", dim="time", align_on="date")

Regarding drop_sel, for data indexed by a CFTimeIndex, xarray currently only accepts explicit cftime objects. Right now it will not automatically convert strings to dates, but we could consider changing that:

data.drop_sel(time=cftime.Datetime360Day(2091, 2, 29, 12))

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gateuxx
Comment options

Answer selected by gateuxx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants