def __getitem__(self, key):
        if self.is_remote:  # pragma: no cover
            getitem = partial(robust_getitem, catch=RuntimeError)
        else:
            getitem = operator.getitem

        try:
            data = getitem(self.array, key)
        except __HOLE__:
            # Catch IndexError in netCDF4 and return a more informative error
            # message.  This is most often called when an unsorted indexer is
            # used before the data is loaded from disk.
            msg = ('The indexing operation you are attempting to perform is '
                   'not valid on netCDF4.Variable object. Try loading your '
                   'data into memory first by calling .load().')
            if not PY3:
                import traceback
                msg += '\n\nOriginal traceback:\n' + traceback.format_exc()
            raise IndexError(msg)

        if self.ndim == 0:
            # work around for netCDF4-python's broken handling of 0-d
            # arrays (slicing them always returns a 1-dimensional array):
            # https://github.com/Unidata/netcdf4-python/pull/220
            data = np.asscalar(data)
        return data
dataset/ETHPy150Open pydata/xarray/xarray/backends/netCDF4_.py/NetCDF4ArrayWrapper.__getitem__