earthkit-data
earthkit-data copied to clipboard
Allow multiple date formats when using sel on GRIB data
If ds
is a GRIB filedlist, using sel()
for the date
key only works when it is specified as an int
:
ds.sel(date=20230510)
However, ideally e.g. these should also work:
ds.sel(date="20230510")
ds.sel(date="2023-05-10")
ds.sel(date=np.datetime64("2023-05-10"))
ds.sel(date=datetime.datetime(2023,5,10))
...
Similarly, we should be able to specify datetime.timedelta or np.timedelta64 for "step":
ds.sel(step=datetime.timedelta(hours=6))
ds.sel(step=datetime.timedelta(hours=6, minutes=15))
ds.sel(step=np.timedelta64(6, 'h'))
...