Closed snowman2 closed 5 years ago
~/scripts/rioxarray/rioxarray/rioxarray.py in reproject_match(self, match_data_array, resampling) 648 dst_crs, 649 dst_affine_width_height=(dst_affine, dst_width, dst_height), --> 650 resampling=resampling, 651 ) 652 ~/scripts/rioxarray/rioxarray/rioxarray.py in reproject(self, dst_crs, resolution, dst_affine_width_height, resampling) 607 name=self._obj.name, 608 data=dst_data, --> 609 coords=_make_coords(self._obj, dst_affine, dst_width, dst_height, dst_crs), 610 dims=tuple(dst_dims), 611 attrs=new_attrs, ~/scripts/rioxarray/rioxarray/rioxarray.py in _make_coords(src_data_array, dst_affine, dst_width, dst_height, dst_crs) 175 src_data_array[coord].dims, 176 src_data_array[coord].values, --> 177 src_data_array[coord].attrs, 178 ) 179 new_coords = _warp_spatial_coords(src_data_array, dst_affine, dst_width, dst_height) ~/scripts/terrain-compute/.venv/lib/python3.6/site-packages/xarray/core/variable.py in __init__(self, dims, data, attrs, encoding, fastpath) 1622 if self.ndim != 1: 1623 raise ValueError('%s objects must be 1-dimensional' % -> 1624 type(self).__name__) 1625 1626 # Unlike in Variable, always eagerly load values into memory ValueError: IndexVariable objects must be 1-dimensional
This can happen when not dropping the band coordinate after open_rasterio and using squeeze for a single band raster:
band
open_rasterio
import xarray xds = xarray.open_rasterio("file.tif").squeeze()
Current workaround:
xds = xarray.open_rasterio("file.tif").squeeze().drop("band")
This can happen when not dropping the
band
coordinate afteropen_rasterio
and using squeeze for a single band raster: