I have a data array arr
with coordinate 'time'.
arr
:
<xarray.DataArray 'T' (time: 731)>
array([244.40161, 244.39998, ..., 244.40936, 244.40549], dtype=float32)
Coordinates:
* time (time) datetime64[ns] 1979-01-01T09:00:00 ... 1980-12-31T09:00:00
Extracting the first 5 time coordinates, arr.time.values[:5]
:
array(['1979-01-01T09:00:00.000000000', '1979-01-02T09:00:00.000000000',
'1979-01-03T09:00:00.000000000', '1979-01-04T09:00:00.000000000',
'1979-01-05T09:00:00.000000000'], dtype='datetime64[ns]')
I want the format of my date-time to just be '1979-01-01'
, '1979-01-02'
etc. without the time, or normalise the time at 00:00:00.
There are some solutions for pandas data frame but I'm not quite sure how to apply them here since the functions aren't applicable (Converting between datetime, Timestamp and datetime64, Keep only date part when using pandas.to_datetime)