In [1]:
%matplotlib inline
import scipy.signal as sisig
import xarray as xr
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from pathlib import Path
In [4]:
xr.show_versions()
INSTALLED VERSIONS
------------------
commit: None

xarray: 0.11.0
pandas: 0.24.2
numpy: 1.15.4
scipy: 1.1.0
netCDF4: 1.4.2
h5netcdf: 0.7.4
h5py: 2.8.0
Nio: None
zarr: None
cftime: 1.0.3.4
PseudonetCDF: None
rasterio: None
iris: None
bottleneck: 1.2.1
cyordereddict: None
dask: 0.19.1
distributed: 1.23.1
matplotlib: 2.2.3
cartopy: None
seaborn: 0.9.0
setuptools: 40.2.0
pip: 19.2.3
conda: 4.6.14
pytest: 3.8.0
IPython: 6.5.0
sphinx: 1.7.9
In [5]:
data_base_path = "https://data.geomar.de/thredds/dodsC/tmdata/git_geomar_de_data/"
hadisst_ref = 'v1.x.x'
hadisst_path = data_base_path + "HadISST/{ref}/data/HadISST_sst.nc".format(ref=hadisst_ref)

print("Will get data from:\n\t{}".format(hadisst_path))
Will get data from:
	https://data.geomar.de/thredds/dodsC/tmdata/git_geomar_de_data/HadISST/v1.x.x/data/HadISST_sst.nc
In [6]:
sst = xr.open_dataset(str(hadisst_path)).sst
print(sst)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/anaconda3/lib/python3.7/site-packages/xarray/backends/file_manager.py in acquire(self)
    136             try:
--> 137                 file = self._cache[self._key]
    138             except KeyError:

/anaconda3/lib/python3.7/site-packages/xarray/backends/lru_cache.py in __getitem__(self, key)
     42         with self._lock:
---> 43             value = self._cache[key]
     44             move_to_end(self._cache, key)

KeyError: [<function _open_netcdf4_group at 0x10e41da60>, ('https://data.geomar.de/thredds/dodsC/tmdata/git_geomar_de_data/HadISST/v1.x.x/data/HadISST_sst.nc', <SerializableLock: 0f9ff1e3-891e-46dd-a62f-6a38aa31dbea>), 'r', (('clobber', True), ('diskless', False), ('format', 'NETCDF4'), ('group', None), ('persist', False))]

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
<ipython-input-6-098e1d7b4d01> in <module>()
----> 1 sst = xr.open_dataset(str(hadisst_path)).sst
      2 print(sst)

/anaconda3/lib/python3.7/site-packages/xarray/backends/api.py in open_dataset(filename_or_obj, group, decode_cf, mask_and_scale, decode_times, autoclose, concat_characters, decode_coords, engine, chunks, lock, cache, drop_variables, backend_kwargs)
    318         if engine == 'netcdf4':
    319             store = backends.NetCDF4DataStore.open(
--> 320                 filename_or_obj, group=group, lock=lock, **backend_kwargs)
    321         elif engine == 'scipy':
    322             store = backends.ScipyDataStore(filename_or_obj, **backend_kwargs)

/anaconda3/lib/python3.7/site-packages/xarray/backends/netCDF4_.py in open(cls, filename, mode, format, group, clobber, diskless, persist, lock, lock_maker, autoclose)
    353             kwargs=dict(group=group, clobber=clobber, diskless=diskless,
    354                         persist=persist, format=format))
--> 355         return cls(manager, lock=lock, autoclose=autoclose)
    356 
    357     @property

/anaconda3/lib/python3.7/site-packages/xarray/backends/netCDF4_.py in __init__(self, manager, lock, autoclose)
    312 
    313         self._manager = manager
--> 314         self.format = self.ds.data_model
    315         self._filename = self.ds.filepath()
    316         self.is_remote = is_remote_uri(self._filename)

/anaconda3/lib/python3.7/site-packages/xarray/backends/netCDF4_.py in ds(self)
    357     @property
    358     def ds(self):
--> 359         return self._manager.acquire().value
    360 
    361     def open_store_variable(self, name, var):

/anaconda3/lib/python3.7/site-packages/xarray/backends/file_manager.py in acquire(self)
    141                     kwargs = kwargs.copy()
    142                     kwargs['mode'] = self._mode
--> 143                 file = self._opener(*self._args, **kwargs)
    144                 if self._mode == 'w':
    145                     # ensure file doesn't get overriden when opened again

/anaconda3/lib/python3.7/site-packages/xarray/backends/netCDF4_.py in _open_netcdf4_group(filename, lock, mode, group, **kwargs)
    245     import netCDF4 as nc4
    246 
--> 247     ds = nc4.Dataset(filename, mode=mode, **kwargs)
    248 
    249     with close_on_error(ds):

netCDF4/_netCDF4.pyx in netCDF4._netCDF4.Dataset.__init__()

netCDF4/_netCDF4.pyx in netCDF4._netCDF4._ensure_nc_success()

OSError: [Errno -68] NetCDF: I/O failure: b'https://data.geomar.de/thredds/dodsC/tmdata/git_geomar_de_data/HadISST/v1.x.x/data/HadISST_sst.nc'
In [ ]: