From b17f8cf558d1dea1a0ee6e2c749095932882847a Mon Sep 17 00:00:00 2001 From: Fabrice Brito Date: Tue, 31 Oct 2023 08:42:30 +0100 Subject: [PATCH] crop step --- docs/app/crop/app.md | 22 ++++++++++++++++++++-- mkdocs.yml | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/docs/app/crop/app.md b/docs/app/crop/app.md index a17610d..3535d04 100644 --- a/docs/app/crop/app.md +++ b/docs/app/crop/app.md @@ -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 @@ -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: @@ -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<-- diff --git a/mkdocs.yml b/mkdocs.yml index b42c5c0..dac2b11 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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