Skip to content

Commit

Permalink
crop step
Browse files Browse the repository at this point in the history
  • Loading branch information
fabricebrito committed Oct 31, 2023
1 parent 4fdc94d commit b17f8cf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
22 changes: 20 additions & 2 deletions docs/app/crop/app.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### Step purpose

Purpose: to crop a particular band defined as a common band name (such as the "green" or "nir" band) from a satellite image acquired by either Sentinel-2 or Landsat-9.

### Code

The `crop.py` script is a command-line tool that takes as input

* a SpatioTemporal Asset Catalog (STAC) Item
Expand All @@ -6,7 +12,7 @@ The `crop.py` script is a command-line tool that takes as input

and then crops the specified band from the asset associated with the common band name to the specified AOI.

It uses various Python libraries like `pystac``, `rasterio`, `pyproj`, `shapely`, and `loguru`.
It uses various Python libraries like `pystac`, `rasterio`, `pyproj`, `shapely`, and `loguru`.

Here is an overview of the script's functionality:

Expand Down Expand Up @@ -39,7 +45,19 @@ Options:
--help Show this message and exit.
```

To use this script, you would typically run it from the command line, providing the necessary input options such as the STAC Item URL, AOI, EPSG code, and common band name. It will then crop the specified band from the STAC asset and save it as a GeoTIFF file. Make sure you have the required Python libraries installed to run the script successfully.
To use this script, you would typically run it from the command line, providing the necessary input options such as the STAC Item URL, AOI, EPSG code, and common band name:

```
python app.py \
--input-item "https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a-cogs/items/S2B_10TFK_20210713_0_L2A" \
--aoi "-121.399,39.834,-120.74,40.472" \
--epsg "EPSG:4326" \
--band "green"
```

It will then crop the specified band from the STAC asset and save it as a GeoTIFF file.

The Python code is provided here:

```python linenums="1" title="water-bodies/command-line-tools/crop/app.py"
--8<--
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ nav:
- OGC Context: app-package/ogc-context.md
- Introducing the application:
- Water bodies detection: app/app.md
- Steps:
- Application Steps:
- Crop:
- Description: app/crop/app.md
- Running the step: python-env/crop.md
Expand Down

0 comments on commit b17f8cf

Please sign in to comment.