---------------------------------------------------------------------------
GEOSException Traceback (most recent call last)
Cell In[3], line 2
1 if __name__ == "__main__":
----> 2 da, gbox = warp_resample()
Cell In[2], line 24, in warp_resample()
22 gbox = GeoBox.from_bbox(te, dstSRS, shape=(height, width))
23 da = da.odc.assign_crs(srcSRS)
---> 24 return xr_reproject(da, gbox)
File /opt/conda/lib/python3.11/site-packages/odc/geo/_xr_interop.py:744, in xr_reproject(src, how, resampling, dst_nodata, dtype, resolution, shape, tight, anchor, tol, round_resolution, **kw)
734 kw = {
735 "shape": shape,
736 "resolution": resolution,
(...)
741 **kw,
742 }
743 if isinstance(src, xarray.DataArray):
--> 744 return _xr_reproject_da(
745 src, how, resampling=resampling, dst_nodata=dst_nodata, dtype=dtype, **kw
746 )
747 return _xr_reproject_ds(
748 src, how, resampling=resampling, dst_nodata=dst_nodata, dtype=dtype, **kw
749 )
File /opt/conda/lib/python3.11/site-packages/odc/geo/_xr_interop.py:849, in _xr_reproject_da(src, how, resampling, dst_nodata, dtype, **kw)
846 if is_dask_collection(src):
847 from ._dask import dask_rio_reproject
--> 849 dst: Any = dask_rio_reproject(
850 src.data,
851 src_gbox,
852 dst_geobox,
853 resampling=resampling,
854 src_nodata=src_nodata,
855 dst_nodata=fill_value,
856 ydim=ydim,
857 dtype=dtype,
858 **kw,
859 )
860 else:
861 dst = numpy.full(dst_shape, fill_value, dtype=dtype)
File /opt/conda/lib/python3.11/site-packages/odc/geo/_dask.py:97, in dask_rio_reproject(src, s_gbox, d_gbox, resampling, src_nodata, dst_nodata, ydim, chunks, dtype, **kwargs)
95 gbt_src = GeoboxTiles(s_gbox, src.chunks[ydim : ydim + 2])
96 gbt_dst = GeoboxTiles(d_gbox, chunks)
---> 97 d2s_idx = gbt_dst.grid_intersect(gbt_src)
99 dst_shape = with_yx(src.shape, d_gbox.shape.yx)
100 dst_chunks: Tuple[Tuple[int, ...], ...] = with_yx(src.chunks, gbt_dst.chunks)
File /opt/conda/lib/python3.11/site-packages/odc/geo/geobox.py:1530, in GeoboxTiles.grid_intersect(self, src)
1526 src_footprint = src.base.extent
1527 else:
1528 # compute "robust" source footprint in CRS of self via espg:4326
1529 src_footprint = (
-> 1530 src.base.footprint(4326, 2) & self.base.footprint(4326, 2)
1531 ).to_crs(self.base.crs)
1533 xy_chunks_with_data = list(self.tiles(src_footprint))
1534 deps: Dict[Tuple[int, int], List[Tuple[int, int]]] = {}
File /opt/conda/lib/python3.11/site-packages/odc/geo/geom.py:387, in wrap_shapely.<locals>.wrapped(*args)
384 if first.crs != arg.crs:
385 raise CRSMismatchError((first.crs, arg.crs))
--> 387 result = method(*[arg.geom for arg in args])
388 if isinstance(result, base.BaseGeometry):
389 return Geometry(result, first.crs)
File /opt/conda/lib/python3.11/site-packages/odc/geo/geom.py:536, in Geometry.__and__(self, other)
535 @wrap_shapely
--> 536 def __and__(self, other: "Geometry") -> "Geometry": return self.__and__(other)
File /opt/conda/lib/python3.11/site-packages/shapely/geometry/base.py:189, in BaseGeometry.__and__(self, other)
188 def __and__(self, other):
--> 189 return self.intersection(other)
File /opt/conda/lib/python3.11/site-packages/shapely/geometry/base.py:599, in BaseGeometry.intersection(self, other, grid_size)
593 def intersection(self, other, grid_size=None):
594 """
595 Returns the intersection of the geometries.
596
597 Refer to `shapely.intersection` for full documentation.
598 """
--> 599 return shapely.intersection(self, other, grid_size=grid_size)
File /opt/conda/lib/python3.11/site-packages/shapely/decorators.py:77, in multithreading_enabled.<locals>.wrapped(*args, **kwargs)
75 for arr in array_args:
76 arr.flags.writeable = False
---> 77 return func(*args, **kwargs)
78 finally:
79 for arr, old_flag in zip(array_args, old_flags):
File /opt/conda/lib/python3.11/site-packages/shapely/set_operations.py:131, in intersection(a, b, grid_size, **kwargs)
127 raise ValueError("grid_size parameter only accepts scalar values")
129 return lib.intersection_prec(a, b, grid_size, **kwargs)
--> 131 return lib.intersection(a, b, **kwargs)
GEOSException: TopologyException: side location conflict at 0 -85.287757732815791. This can occur if the input geometry is invalid.