diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c7869f4..486fb89a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.3.1] - 2024-11-22 + +### Fixed + +- wkt geometries have now the full precision when storing it in zonal stats. + ## [0.3.0] - 2024-11-19 ### Added diff --git a/earthdaily/__init__.py b/earthdaily/__init__.py index 43b8cc53..ed6b277d 100644 --- a/earthdaily/__init__.py +++ b/earthdaily/__init__.py @@ -7,7 +7,7 @@ # to hide warnings from rioxarray or nano seconds conversion # warnings.filterwarnings("ignore") -__version__ = "0.3.0" +__version__ = "0.3.1" def EarthDataStore( diff --git a/earthdaily/earthdatastore/cube_utils/_zonal.py b/earthdaily/earthdatastore/cube_utils/_zonal.py index a7d29770..9c3185f2 100644 --- a/earthdaily/earthdatastore/cube_utils/_zonal.py +++ b/earthdaily/earthdatastore/cube_utils/_zonal.py @@ -183,7 +183,7 @@ def _loop_time_chunks(dataset, method, smart_load, time_chunks): geoms.to_crs(input_crs) if method == "numpy": - feats, yx_pos = _rasterize(geoms, dataset, all_touched=all_touched) + feats, yx_pos = _rasterize(geoms.copy(), dataset, all_touched=all_touched) positions = [np.asarray(yx_pos[i + 1]) for i in np.arange(geoms.shape[0])] positions = [position for position in positions if position.size > 0] del yx_pos @@ -213,8 +213,11 @@ def _loop_time_chunks(dataset, method, smart_load, time_chunks): # create the WKT geom if isinstance(buffer_meters, float | int): geoms.geometry = geoms["geometry_original"] + + if geoms.crs.to_epsg() != 4326: + geoms = geoms.to_crs("EPSG:4326") geometry = xr.DataArray( - list(geoms.iloc[f - 1].to_crs("EPSG:4326").geometry.to_wkt()), + geoms.iloc[list(f - 1)].geometry.apply(lambda x: x.wkt).values, dims=["feature"], coords={"feature": zs.feature.values}, )