Skip to content

Commit

Permalink
Merge pull request #10 from ESDS-Leipzig/stackstac_kw
Browse files Browse the repository at this point in the history
Add Stackstac kwargs
  • Loading branch information
davemlz authored Jan 21, 2024
2 parents f0bb7a3 + 6d37032 commit 9e9549f
Show file tree
Hide file tree
Showing 5 changed files with 1,413 additions and 1 deletion.
11 changes: 11 additions & 0 deletions cubo/cubo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def create(
resolution: Union[float, int] = 10.0,
stac: str = "https://planetarycomputer.microsoft.com/api/stac/v1",
gee: bool = False,
stackstac_kw: Optional[dict] = None,
**kwargs,
) -> xr.DataArray:
"""Creates a data cube from a STAC Catalogue as a :code:`xr.DataArray` object.
Expand Down Expand Up @@ -58,6 +59,11 @@ def create(
.. versionadded:: 2024.1.0
stackstac_kw : dict, default = None
Keyword arguments for :code:`stackstac` as a dictionary.
.. versionadded:: 2024.1.0
kwargs :
Additional keyword arguments passed to :code:`pystac_client.Client.search()`.
Expand Down Expand Up @@ -189,13 +195,18 @@ def create(
if not isinstance(bands, list) and bands is not None:
bands = [bands]

# Add stackstac arguments
if stackstac_kw is None:
stackstac_kw = dict()

# Create the cube
cube = stackstac.stack(
items,
assets=bands,
resolution=resolution,
bounds=bbox_utm,
epsg=epsg,
**stackstac_kw,
)

# Delete attributes
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ v2024.1.0

- Added support for Google Earth Engine.
- Added the :code:`gee` argument to :code:`cubo.create()`.
- Added support for :code:`stackstac` keyword arguments.
- Added the :code:`stackstac_kw` argument to :code:`cubo.create()`.

v2023.12.0
---------
Expand Down
3 changes: 2 additions & 1 deletion docs/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ Tutorials
tutorials/cube_visualization.ipynb
tutorials/using_collections.ipynb
tutorials/visualization_lexcube.ipynb
tutorials/using_gee.ipynb
tutorials/using_gee.ipynb
tutorials/stackstac.ipynb
Loading

0 comments on commit 9e9549f

Please sign in to comment.