Skip to content

Commit

Permalink
docs: execute the example cells
Browse files Browse the repository at this point in the history
  • Loading branch information
12rambau committed Feb 22, 2025
1 parent ef48b43 commit 6eff56d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions geetools/ee_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1686,11 +1686,12 @@ def classToBands(self, class_info: dict, band: str | int = 0) -> ee.Image:
band: band that contains class information
Example:
.. code-block:: python
.. jupyter-execute::
import ee, geetools
from geetools.utils import initialize_documentation
ee.Initialize()
initialize_documentation()
class_info = {
'2': 'dark',
Expand All @@ -1700,8 +1701,9 @@ def classToBands(self, class_info: dict, band: str | int = 0) -> ee.Image:
'9': 'clouds_high',
'10': 'cirrus'
}
image = ee.Image('ee.Image("COPERNICUS/S2_SR_HARMONIZED/20230120T142709_20230120T143451_T18GYT")
image = ee.Image("COPERNICUS/S2_SR_HARMONIZED/20230120T142709_20230120T143451_T18GYT")
decoded = image.geetools.classToBands(class_info, "SCL")
decoded.getInfo()
"""
class_info = format_class_info(class_info)
# I don't see the class info coming from the server, so it'll client side until I get challenged
Expand All @@ -1723,11 +1725,12 @@ def classMask(self, class_info: dict, classes: Optional[list] = None, band: str
band: name of the bit band. Defaults to first band.
Example:
.. code-block:: python
.. jupyter-execute::
import ee, geetools
from geetools.utils import initialize_documentation
ee.Initialize()
initialize_documentation()
class_info = {
'2': 'dark',
Expand All @@ -1737,8 +1740,9 @@ def classMask(self, class_info: dict, classes: Optional[list] = None, band: str
'9': 'clouds_high',
'10': 'cirrus'
}
image = ee.Image('ee.Image("COPERNICUS/S2_SR_HARMONIZED/20230120T142709_20230120T143451_T18GYT")
image = ee.Image("COPERNICUS/S2_SR_HARMONIZED/20230120T142709_20230120T143451_T18GYT")
decoded = image.geetools.classMask(class_info, classes=["dark", "shadow"], "SCL")
decoded.getInfo()
"""
masks = self.classToBands(class_info, band)
masks = masks.select(classes) if classes else masks
Expand Down

0 comments on commit 6eff56d

Please sign in to comment.