diff --git a/xarray/backends/rasterio_.py b/xarray/backends/rasterio_.py index 5821e45041a..b629eb51241 100644 --- a/xarray/backends/rasterio_.py +++ b/xarray/backends/rasterio_.py @@ -282,10 +282,10 @@ def open_rasterio(filename, parse_coordinates=None, chunks=None, cache=None, # CRS is a dict-like object specific to rasterio # If CRS is not None, we convert it back to a PROJ4 string using # rasterio itself - try: - attrs['crs'] = riods.crs.to_proj4() - except AttributeError: - attrs['crs'] = riods.crs.to_string() + try: + attrs['crs'] = riods.crs.to_proj4() + except AttributeError: + attrs['crs'] = riods.crs.to_string() if hasattr(riods, 'res'): # (width, height) tuple of pixels in units of CRS attrs['res'] = riods.res