Skip to content

Commit 9bb461d

Browse files
committed
EP-4053/#255 Add basic docs (under cookbook) and CHANGELOG entry
1 parent f1d31da commit 9bb461d

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Add `options` argument to `DataCube.atmospheric_correction` ([Open-EO/openeo-python-driver#91](https://github.com/Open-EO/openeo-python-driver/issues/91))
1313
- Add `atmospheric_correction_options` and `cloud_detection_options` arguments to `DataCube.ard_surface_reflectance` ([Open-EO/openeo-python-driver#91](https://github.com/Open-EO/openeo-python-driver/issues/91))
1414
- UDP storing: add support for "returns", "categories", "examples" and "links" properties ([#242](https://github.com/Open-EO/openeo-python-client/issues/242))
15+
- Add `openeo.extra.spectral_indices`: experimental API to easily compute spectral indices (vegetation, water, urban, ...)
16+
on a `DataCube`, using the index definitions from [Awesome Spectral Indices](https://awesome-ee-spectral-indices.readthedocs.io/en/latest/)
1517

1618

1719
### Changed

docs/cookbook/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ OpenEO CookBook
88
ard
99
sampling
1010
udp_sharing
11+
spectral_indices

docs/cookbook/spectral_indices.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
====================================
2+
Spectral Indices
3+
====================================
4+
5+
.. warning::
6+
This is a new experimental API, subject to change.
7+
8+
.. automodule:: openeo.extra.spectral_indices
9+
:members: list_indices, compute_and_rescale_indices, append_and_rescale_indices, compute_indices, append_indices, compute_index, append_index
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
"""
2-
Calculate spectral indices (vegetation indices, water indices, etc.) in one line
2+
Easily calculate spectral indices (vegetation, water, urban etc.).
3+
4+
Supports the indices defined in the
5+
`Awesome Spectral Indices <https://awesome-ee-spectral-indices.readthedocs.io/>`_ project
6+
by `David Montero Loaiza <https://github.com/davemlz>`_.
7+
8+
9+
.. versionadded:: 0.9.1
10+
311
"""
412

513
from openeo.extra.spectral_indices.spectral_indices import *

openeo/extra/spectral_indices/spectral_indices.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,13 @@ def compute_and_rescale_indices(datacube: DataCube, index_dict: dict, append=Fal
144144
}
145145
}
146146
147-
See `list_indices()` for supported indices.
147+
If you don't want to rescale your data, you can fill the input-, index- and output-range with ``None``.
148148
149-
.. note:: this "rescaled" index version uses an experimental API (e.g. `index_dict` argument) that is subject to change.
149+
See `list_indices()` for supported indices.
150150
151-
If you don't want to rescale your data, you can fill the input-, index- and output range with None.
152151
:return: the datacube with the indices attached as bands
152+
153+
.. warning:: this "rescaled" index helper uses an experimental API (e.g. `index_dict` argument) that is subject to change.
153154
"""
154155
index_specs = load_indices()
155156

@@ -185,9 +186,9 @@ def append_and_rescale_indices(datacube: DataCube, index_dict: dict) -> DataCube
185186
186187
See `list_indices()` for supported indices.
187188
188-
.. note:: this "rescaled" index version uses an experimental API (e.g. `index_dict` argument) that is subject to change.
189-
190189
:return: data cube with appended indices
190+
191+
.. warning:: this "rescaled" index helper uses an experimental API (e.g. `index_dict` argument) that is subject to change.
191192
"""
192193
return compute_and_rescale_indices(datacube=datacube, index_dict=index_dict, append=True)
193194

@@ -233,6 +234,7 @@ def compute_index(datacube: DataCube, index: str) -> DataCube:
233234
:param index: name of the index to compute. See `list_indices()` for supported indices.
234235
:return: data cube containing the index as band
235236
"""
237+
# TODO: option to compute the index with `reduce_dimension` instead of `apply_dimension`?
236238
return compute_indices(datacube=datacube, indices=[index], append=False)
237239

238240

0 commit comments

Comments
 (0)