diff --git a/CHANGELOG.md b/CHANGELOG.md index ea9f9e73..47a7f173 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ 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.0.1] + +### Changed + +- Default chunks using odc is now `x="auto"` and `y="auto"`. +- `geobox` or `geopolygon` is used to have a preclipped datacube to the bounding box of the geometry. It enhances performances. + ## [0.0.1-rc8] - 2023-07-12 ### Added @@ -13,21 +20,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - handle cross calibration (harmonization) using private collection. - `Auth` automatically to EarhtDataStore after 3600 seconds. - `Auth` now supports presign_urls parameter. -- `load_pivot_corumba` in datasets +- `load_pivot_corumba` in datasets. ### Fixed -- Perfect dimension compatibility between cloudmask and sensor datacube using `geobox` . +- Perfect dimension compatibility between cloudmask and sensor datacube using `geobox`. - Force loading native landsat cloudmask because not compatible with dask. ## [0.0.1-rc7] - 2023-11-22 ### Fixed -- issue with unlogged datacube and non-geodataframe intersects -- for element84 sentinel-2-l2a collection, `boa_offset_applied`is set to True since 2022-02-28 -- added `nir` band in `boa_offset_applied` control -- fix percentage in landsat agriculture cloudmask +- issue with unlogged datacube and non-geodataframe intersects. +- for element84 sentinel-2-l2a collection, `boa_offset_applied`is set to True since 2022-02-28. +- added `nir` band in `boa_offset_applied` control. +- fix percentage in landsat agriculture cloudmask . ## [0.0.1-rc6] - 2023-11-10 @@ -39,7 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- `intersects` argument in search/datacube now supports wkt/geojson/geopandas +- `intersects` argument in search/datacube now supports wkt/geojson/geopandas. - `common_band_names` default set to True in datacube creation. It uses the new Assets Mapper in order to define to best suitable bands according to user needs. - `clear_cover` argument in the datacube method when using the `earthdatastore.Auth` method. - `datasets.load_pivot()` to load a GeoDataFrame of a pivot in Nebraska (alternates between corn or soy between years). @@ -103,16 +110,16 @@ really faster faster. Previous behavior is available by selecting `method="stand ### Changed -- Python version must be at least 3.10 -- Gdal version must be at least 3.7.0 -- A better documentation +- Python version must be at least 3.10. +- Gdal version must be at least 3.7.0. +- A better documentation. ## [0.0.1-beta] 2023-09-20 ### Added -- First public release under the name of earthdaily -- module earthdatastore gathers all cube fonctions -- earthdatastore.Auth() allows methods for search and datacube creation -- Add if missing default scale/offset factor to collection (landsat-c2l2-sr, landsat-c2l2-st, landsat-c2l1) \ No newline at end of file +- First public release under the name of earthdaily. +- module earthdatastore gathers all cube fonctions. +- earthdatastore.Auth() allows methods for search and datacube creation. +- Add if missing default scale/offset factor to collection (landsat-c2l2-sr, landsat-c2l2-st, landsat-c2l1). \ No newline at end of file diff --git a/earthdaily/__init__.py b/earthdaily/__init__.py index c40011cf..a6342258 100644 --- a/earthdaily/__init__.py +++ b/earthdaily/__init__.py @@ -1,3 +1,3 @@ from . import earthdatastore, datasets -__version__ = "0.0.1-rc8" +__version__ = "0.0.1" diff --git a/earthdaily/earthdatastore/cube_utils/__init__.py b/earthdaily/earthdatastore/cube_utils/__init__.py index 2418d7d3..5f29b155 100644 --- a/earthdaily/earthdatastore/cube_utils/__init__.py +++ b/earthdaily/earthdatastore/cube_utils/__init__.py @@ -55,8 +55,9 @@ def _cube_odc(items_collection, assets=None, times=None, dtype="float32", **kwar if "resampling" in kwargs: if isinstance(kwargs["resampling"], int): kwargs["resampling"] = Resampling(kwargs["resampling"]).name - kwargs["chunks"] = kwargs.get("chunks", dict(x=512, y=512, time=1)) - + kwargs["chunks"] = kwargs.get("chunks", dict(x="auto", y="auto", time=1)) + if "geobox" in kwargs.keys() and "geopolygon" in kwargs.keys(): + kwargs.pop("geobox") ds = stac.load( items_collection, bands=assets, @@ -123,6 +124,8 @@ def datacube( assets = aM.map_collection_assets(items_collection[0].collection_id, assets) if isinstance(assets, dict): assets_keys = list(assets.keys()) + if engine == 'odc' and intersects is not None: + kwargs['geopolygon'] = intersects ds = engines[engine]( items_collection, assets=assets_keys if isinstance(assets, dict) else assets, @@ -165,9 +168,9 @@ def datacube( intersects = GeometryManager(intersects).to_geopandas() if isinstance(intersects, gpd.GeoDataFrame): - # itrscts = intersects.to_crs(ds.rio.crs).iloc[[0]] # optimize by perclipping using bbox - ds = ds.rio.clip_box(*intersects.to_crs(ds.rio.crs).total_bounds) + # no need anymore thanks to geobox/geopolygon in doc + # ds = ds.rio.clip_box(*intersects.to_crs(ds.rio.crs).total_bounds) ds = ds.rio.clip(intersects.to_crs(ds.rio.crs).geometry) # apply nodata ds = _apply_nodata(ds, nodatas)