id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type
701062999,MDU6SXNzdWU3MDEwNjI5OTk=,4422,Problem decoding times in data from OpenDAP server,6514690,closed,0,,,11,2020-09-14T12:45:44Z,2022-01-12T14:48:49Z,2020-10-26T09:50:18Z,NONE,,,,"**What happened**: I download data from an OpenDAP server using `xarray` directly. Then, I save the `xarray.DataArray` object to file. The times I get in the index are different (see output below). Note, for instance, the second element of the index in the original dataset is `2020-09-13T00:59:59.999997000`, while after saving and loading again is `2020-09-13T00:59:59.999997056`
**What you expected to happen**: I'm not sure if this is a bug or just something that we cannot rely upon, but I would expect the index `time` to have the same values in both objects.
**Minimal Complete Verifiable Example**:
```python
import datetime as dt
import xarray as xr
import cftime
print(xr.__version__)
print(cftime.__version__)
yesterday = (dt.date.today() - dt.timedelta(days=1)).strftime('%Y%m%d')
src = xr.open_dataset(f'https://nomads.ncep.noaa.gov/dods/gfs_0p25_1hr/gfs{yesterday}/gfs_0p25_1hr_00z')
print('-'*60)
var = src['ugrd10m'].isel(time=slice(0, 8))
print('Original: ', var.time)
var.to_netcdf('test.nc')
print('-'*60)
dst = xr.open_dataset('test.nc')
print('Recovered:', dst.time)
```
**Anything else we need to know?**:
Output of the previous script
```
0.16.0
1.2.1
------------------------------------------------------------
Original:
array(['2020-09-13T00:00:00.000000000', '2020-09-13T00:59:59.999997000',
'2020-09-13T02:00:00.000003000', '2020-09-13T03:00:00.000000000',
'2020-09-13T03:59:59.999997000', '2020-09-13T05:00:00.000003000',
'2020-09-13T06:00:00.000000000', '2020-09-13T06:59:59.999997000'],
dtype='datetime64[ns]')
Coordinates:
* time (time) datetime64[ns] 2020-09-13 ... 2020-09-13T06:59:59.999997
Attributes:
grads_dim: t
grads_mapping: linear
grads_size: 121
grads_min: 00z13sep2020
grads_step: 1hr
long_name: time
minimum: 00z13sep2020
maximum: 00z18sep2020
resolution: 0.041666668
------------------------------------------------------------
Recovered:
array(['2020-09-13T00:00:00.000000000', '2020-09-13T00:59:59.999997056',
'2020-09-13T02:00:00.000002944', '2020-09-13T03:00:00.000000000',
'2020-09-13T03:59:59.999997056', '2020-09-13T05:00:00.000002944',
'2020-09-13T06:00:00.000000000', '2020-09-13T06:59:59.999997056'],
dtype='datetime64[ns]')
Coordinates:
* time (time) datetime64[ns] 2020-09-13 ... 2020-09-13T06:59:59.999997056
Attributes:
grads_dim: t
grads_mapping: linear
grads_size: 121
grads_min: 00z13sep2020
grads_step: 1hr
long_name: time
minimum: 00z13sep2020
maximum: 00z18sep2020
resolution: 0.041666668
```
**Environment**:
I create a clean enviroment with:
```conda create -n xarray_test python=3.6 xarray cfgrib cftime netCDF4```
Output of xr.show_versions()
```
>>> xr.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.6.12 |Anaconda, Inc.| (default, Sep 8 2020, 23:10:56)
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 4.4.0-112-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: en_US.utf-8
LANG: en_US.utf-8
LOCALE: en_US.UTF-8
libhdf5: 1.10.6
libnetcdf: 4.7.4
xarray: 0.16.0
pandas: 1.1.1
numpy: 1.19.1
scipy: None
netCDF4: 1.5.4
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.2.1
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: 0.9.8.4
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
pint: None
setuptools: 49.6.0.post20200814
pip: 20.2.2
conda: None
pytest: None
IPython: None
sphinx: None
```
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4422/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue