I have an xarray containing data from an NetCDF4 data file.
This xarray has a time column where several rows probably contain missing data. Their time stamp is always ‘1904-01-01T00:00:00.000000’. But no specific NAN values. Also the other data columns have different than NAN unvalid values.
How can I delete these rows anyhow?
The xarray looks like:
<xarray.DataArray 'time' (time: 5760)>
array(['2018-02-21T00:00:04.000000000',
'2018-02-21T00:00:19.000000000',
'1904-01-01T00:00:00.000000000',
'2018-02-21T00:00:34.000000000',
...,
'2018-02-21T23:59:52.000000000',
'1904-01-01T00:00:00.000000000',
'1904-01-01T00:00:00.000000000',
'2018-02-21T23:59:58.000000000',
'1904-01-01T00:00:00.000000000'],
dtype='datetime64[ns]')
The xarray computation guide doesn’t help me in that case.
dropna
won’t work as there is not really any NANs.
Then
I tried with
DS = DS[DS.time != '2020-01-01T00:00:00']
and DS = DS.where(DS.time > '2020-01-01T00:00:00')
but that all wouldn’t work on xarrays.
How is the correct way handling that problem?