Closed huard closed 3 years ago
I can look into this. All the parts are there. It can probably be fixed with a try-except catch.
Ok thanks,
I'd like a simple test like this to work:
from shapely.geometry import Polygon
# Create dummy Dataset
dims = ("lon", "lat")
n = {"lon": 5, "lat": 6}
ds = xr.Dataset(data_vars={"foo": (dims, np.ones(shape=list(n.values())))},
coords={"lon": ("lon", np.arange(n["lon"])),
"lat": ("lat", np.arange(n["lat"]))}
)
poly = Polygon([[0.5, 0], [2.5, 0], [2.5, 2.5], [0.5, 2.5]])
shape = gpd.GeoDataFrame(geometry=[poly])
subset.subset_shape(ds, shape=shape)
with output lat being [0, 1, 2] and output lon [1,2]
fixed with #96
Description
subset_shape
fails atshape_crs = CRS(poly.crs)
ifpoly.crs
isNone
, which is the case if shape is a simple geometry with no CRS information attached.