From 71058e90c9b5382e4cc6552f61e491ffb24f800d Mon Sep 17 00:00:00 2001 From: <> Date: Thu, 2 Nov 2023 10:21:11 +0000 Subject: [PATCH] Deployed be13d4a with MkDocs version: 1.5.3 --- .nojekyll | 0 404.html | 1955 +++++ app-package/ogc-context/index.html | 2126 ++++++ app/crop/app/index.html | 1098 +++ app/detect_water_body.png | Bin 0 -> 33433 bytes app/normalized-difference/app/index.html | 943 +++ app/normalized-difference/index.html | 1976 +++++ app/otsu/app/index.html | 937 +++ app/otsu/index.html | 1978 +++++ app/stac/app/index.html | 1000 +++ app/water-bodies-detection/index.html | 947 +++ app/water_bodies.png | Bin 0 -> 29121 bytes app/wrapped.png | Bin 0 -> 67971 bytes assets/images/favicon.png | Bin 0 -> 1870 bytes assets/javascripts/bundle.aecac24b.min.js | 29 + assets/javascripts/bundle.aecac24b.min.js.map | 7 + assets/javascripts/lunr/min/lunr.ar.min.js | 1 + assets/javascripts/lunr/min/lunr.da.min.js | 18 + assets/javascripts/lunr/min/lunr.de.min.js | 18 + assets/javascripts/lunr/min/lunr.du.min.js | 18 + assets/javascripts/lunr/min/lunr.el.min.js | 1 + assets/javascripts/lunr/min/lunr.es.min.js | 18 + assets/javascripts/lunr/min/lunr.fi.min.js | 18 + assets/javascripts/lunr/min/lunr.fr.min.js | 18 + assets/javascripts/lunr/min/lunr.he.min.js | 1 + assets/javascripts/lunr/min/lunr.hi.min.js | 1 + assets/javascripts/lunr/min/lunr.hu.min.js | 18 + assets/javascripts/lunr/min/lunr.hy.min.js | 1 + assets/javascripts/lunr/min/lunr.it.min.js | 18 + assets/javascripts/lunr/min/lunr.ja.min.js | 1 + assets/javascripts/lunr/min/lunr.jp.min.js | 1 + assets/javascripts/lunr/min/lunr.kn.min.js | 1 + assets/javascripts/lunr/min/lunr.ko.min.js | 1 + assets/javascripts/lunr/min/lunr.multi.min.js | 1 + assets/javascripts/lunr/min/lunr.nl.min.js | 18 + assets/javascripts/lunr/min/lunr.no.min.js | 18 + assets/javascripts/lunr/min/lunr.pt.min.js | 18 + assets/javascripts/lunr/min/lunr.ro.min.js | 18 + assets/javascripts/lunr/min/lunr.ru.min.js | 18 + assets/javascripts/lunr/min/lunr.sa.min.js | 1 + .../lunr/min/lunr.stemmer.support.min.js | 1 + assets/javascripts/lunr/min/lunr.sv.min.js | 18 + assets/javascripts/lunr/min/lunr.ta.min.js | 1 + assets/javascripts/lunr/min/lunr.te.min.js | 1 + assets/javascripts/lunr/min/lunr.th.min.js | 1 + assets/javascripts/lunr/min/lunr.tr.min.js | 18 + assets/javascripts/lunr/min/lunr.vi.min.js | 1 + assets/javascripts/lunr/min/lunr.zh.min.js | 1 + assets/javascripts/lunr/tinyseg.js | 206 + assets/javascripts/lunr/wordcut.js | 6708 +++++++++++++++++ .../workers/search.f886a092.min.js | 42 + .../workers/search.f886a092.min.js.map | 7 + assets/stylesheets/main.4b4a2bd9.min.css | 1 + assets/stylesheets/main.4b4a2bd9.min.css.map | 1 + assets/stylesheets/palette.356b1318.min.css | 1 + .../stylesheets/palette.356b1318.min.css.map | 1 + containers/crop/index.html | 2166 ++++++ containers/norm-diff/index.html | 2135 ++++++ containers/otsu/index.html | 2132 ++++++ containers/scope/index.html | 2169 ++++++ containers/stac/index.html | 2142 ++++++ crop.cwl | 43 + cwl-cli/crop/index.html | 2251 ++++++ cwl-cli/norm-diff/index.html | 2171 ++++++ cwl-cli/otsu/index.html | 2164 ++++++ cwl-cli/scope/index.html | 1992 +++++ cwl-cli/stac/index.html | 2182 ++++++ cwl-workflow/cloud-native/index.html | 1187 +++ cwl-workflow/exec-cloud-native/index.html | 2152 ++++++ cwl-workflow/exec-stage-in/index.html | 2301 ++++++ cwl-workflow/scatter-cloud-native/index.html | 986 +++ cwl-workflow/scope/index.html | 2118 ++++++ cwl-workflow/stage-in-out/index.html | 873 +++ cwl-workflow/stage-in/index.html | 2177 ++++++ cwl-workflow/stage-out/index.html | 2329 ++++++ cwl-workflow/staged/index.html | 1187 +++ exec/scope/index.html | 1988 +++++ fair/best-practice/index.html | 2283 ++++++ index.html | 843 +++ kubernetes/calrissian/index.html | 2194 ++++++ kubernetes/k8s-s2-cloud-native/index.html | 2010 +++++ local-code/index.html | 2060 +++++ new-to/cwl/index.html | 2210 ++++++ new-to/yaml/index.html | 996 +++ python-env/crop/index.html | 2214 ++++++ python-env/norm-diff/index.html | 2171 ++++++ python-env/otsu/index.html | 2170 ++++++ python-env/stac/index.html | 2176 ++++++ reference/calrissian/index.html | 2368 ++++++ reference/cwl-commandlinetool/index.html | 1993 +++++ reference/cwl-workflow/index.html | 1987 +++++ reference/cwltool/index.html | 1981 +++++ reference/ogc-ap-bp/index.html | 1980 +++++ release/ci/index.html | 1240 +++ release/scope/index.html | 1990 +++++ search/search_index.json | 1 + sitemap.xml | 3 + sitemap.xml.gz | Bin 0 -> 127 bytes 98 files changed, 93965 insertions(+) create mode 100644 .nojekyll create mode 100644 404.html create mode 100644 app-package/ogc-context/index.html create mode 100644 app/crop/app/index.html create mode 100644 app/detect_water_body.png create mode 100644 app/normalized-difference/app/index.html create mode 100644 app/normalized-difference/index.html create mode 100644 app/otsu/app/index.html create mode 100644 app/otsu/index.html create mode 100644 app/stac/app/index.html create mode 100644 app/water-bodies-detection/index.html create mode 100644 app/water_bodies.png create mode 100644 app/wrapped.png create mode 100644 assets/images/favicon.png create mode 100644 assets/javascripts/bundle.aecac24b.min.js create mode 100644 assets/javascripts/bundle.aecac24b.min.js.map create mode 100644 assets/javascripts/lunr/min/lunr.ar.min.js create mode 100644 assets/javascripts/lunr/min/lunr.da.min.js create mode 100644 assets/javascripts/lunr/min/lunr.de.min.js create mode 100644 assets/javascripts/lunr/min/lunr.du.min.js create mode 100644 assets/javascripts/lunr/min/lunr.el.min.js create mode 100644 assets/javascripts/lunr/min/lunr.es.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.he.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hu.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hy.min.js create mode 100644 assets/javascripts/lunr/min/lunr.it.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ja.min.js create mode 100644 assets/javascripts/lunr/min/lunr.jp.min.js create mode 100644 assets/javascripts/lunr/min/lunr.kn.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ko.min.js create mode 100644 assets/javascripts/lunr/min/lunr.multi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.nl.min.js create mode 100644 assets/javascripts/lunr/min/lunr.no.min.js create mode 100644 assets/javascripts/lunr/min/lunr.pt.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ro.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ru.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sa.min.js create mode 100644 assets/javascripts/lunr/min/lunr.stemmer.support.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sv.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ta.min.js create mode 100644 assets/javascripts/lunr/min/lunr.te.min.js create mode 100644 assets/javascripts/lunr/min/lunr.th.min.js create mode 100644 assets/javascripts/lunr/min/lunr.tr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.vi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.zh.min.js create mode 100644 assets/javascripts/lunr/tinyseg.js create mode 100644 assets/javascripts/lunr/wordcut.js create mode 100644 assets/javascripts/workers/search.f886a092.min.js create mode 100644 assets/javascripts/workers/search.f886a092.min.js.map create mode 100644 assets/stylesheets/main.4b4a2bd9.min.css create mode 100644 assets/stylesheets/main.4b4a2bd9.min.css.map create mode 100644 assets/stylesheets/palette.356b1318.min.css create mode 100644 assets/stylesheets/palette.356b1318.min.css.map create mode 100644 containers/crop/index.html create mode 100644 containers/norm-diff/index.html create mode 100644 containers/otsu/index.html create mode 100644 containers/scope/index.html create mode 100644 containers/stac/index.html create mode 100644 crop.cwl create mode 100644 cwl-cli/crop/index.html create mode 100644 cwl-cli/norm-diff/index.html create mode 100644 cwl-cli/otsu/index.html create mode 100644 cwl-cli/scope/index.html create mode 100644 cwl-cli/stac/index.html create mode 100644 cwl-workflow/cloud-native/index.html create mode 100644 cwl-workflow/exec-cloud-native/index.html create mode 100644 cwl-workflow/exec-stage-in/index.html create mode 100644 cwl-workflow/scatter-cloud-native/index.html create mode 100644 cwl-workflow/scope/index.html create mode 100644 cwl-workflow/stage-in-out/index.html create mode 100644 cwl-workflow/stage-in/index.html create mode 100644 cwl-workflow/stage-out/index.html create mode 100644 cwl-workflow/staged/index.html create mode 100644 exec/scope/index.html create mode 100644 fair/best-practice/index.html create mode 100644 index.html create mode 100644 kubernetes/calrissian/index.html create mode 100644 kubernetes/k8s-s2-cloud-native/index.html create mode 100644 local-code/index.html create mode 100644 new-to/cwl/index.html create mode 100644 new-to/yaml/index.html create mode 100644 python-env/crop/index.html create mode 100644 python-env/norm-diff/index.html create mode 100644 python-env/otsu/index.html create mode 100644 python-env/stac/index.html create mode 100644 reference/calrissian/index.html create mode 100644 reference/cwl-commandlinetool/index.html create mode 100644 reference/cwl-workflow/index.html create mode 100644 reference/cwltool/index.html create mode 100644 reference/ogc-ap-bp/index.html create mode 100644 release/ci/index.html create mode 100644 release/scope/index.html create mode 100644 search/search_index.json create mode 100644 sitemap.xml create mode 100644 sitemap.xml.gz diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..639ac8e --- /dev/null +++ b/404.html @@ -0,0 +1,1955 @@ + + + +
+ + + + + + + + + + + + + + +Previous OGC Testbeds 13-16 initiated the design of an application package for Earth Observation Applications in distributed Cloud Platforms
+The application package provides information about the software item, metadata and dependencies
+Deployed and executed within an Exploitation Platform in a service compliant with the OGC API Processes specification
+OGC 20-089 Defines the Best Practice to package and deploy Earth Observation Applications in an Exploitation Platform
+OGC 20-089 defines guidance for the 3 viewpoints: +* For a Developer to adapt an application +* For an Integrator to package an application +* For an Platform to deploy and execute the application
+12 submitters organisations:
+Decouple application developers from exploitation platform operators and from application consumers:
+Enable exploitation platforms to virtually support any type of packaged EO application
+The Application Package:
+Application developers:
+The Common Workflow Language (CWL) is an open standard for describing analysis workflows and tools in a way that makes them portable and scalable across a variety of software and hardware environments, from workstations to cluster, cloud, and high performance computing environments.
+The CWL is a specification for describing analysis workflows and tools.
+CWL workflows are portable and scalable across a variety of software and hardware environments, from workstations to cluster, cloud, and high performance computing (HPC) environments.
+CWL is designed to meet the needs of data-intensive science, such as Bioinformatics, Medical Imaging, Astronomy, Physics, and Chemistry.
+ + + + + + +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.
+This step is highlighted below:
+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
.
Here is an overview of the script's functionality:
+It defines a function aoi2box
to convert an AOI expressed as a bounding box string into a list of floats.
It defines a function get_asset
to retrieve the asset of a STAC Item that is defined with a common band name. It iterates through the assets and checks if a band has the specified common name.
It defines a command-line interface using click
, with options for providing the input STAC Item URL, AOI, EPSG code, and common band name.
The crop
function is the main entry point. It reads the STAC Item specified by the input URL and retrieves the asset associated with the common band name. It then crops the asset to the specified AOI using the rasterio library.
It transforms the bounding box coordinates to match the EPSG code provided.
+It performs the cropping using the rasterio.mask.mask
function.
It writes the cropped image to a GeoTIFF file with a filename like "crop_bandname.tif."
+The script is executable as a command-line tool as its usage is:
+Usage: app.py [OPTIONS]
+
+ Crops a STAC Item asset defined with its common band name
+
+Options:
+ --input-item TEXT STAC Item URL or staged STAC catalog [required]
+ --aoi TEXT Area of interest expressed as a bounding box [required]
+ --epsg TEXT EPSG code [required]
+ --band TEXT Common band name [required]
+ --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:
+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:
+water-bodies/command-line-tools/crop/app.py | |
---|---|
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 |
|
#fbaOo*qYKn@z3!<@M$u$$dn_#vL{mmls Z$JP+bOv)DSvj*WSRxax9ln>H0u;Is16-+9;a
zlWgwt<5JUZwn0(0&{$Cv^m;B$h@iT)UbF^X8@%EsX(2l;1pDN2yD;)Y)5amxnA&%@
zt7ejDx9{T!K9j@Qz4gIY9rNjWtXqNCd8cV8e)k6#b!yyBBC%_lc3B7z#RIS39r2W!
z+C3ce%~X$u)|`|GL2rVUcd;}ekrh;__j|%b7lvxQofksvDs;dK7R|6)DT~G59+4T~
zZ^o$!hx5NS4kR_1*97|(C89{vNM8=`{Vsxhnp5P*MLAe-#j=AbbP|$^-mG{Z>GIn+
zXG5C#1v}<4jMl$?Y6=&J$q##}ATMkl{ 5P_dJh_(CzmDg6al7$?E!V8eUz$>T+51^D~vog?tcHjX|}a98rUZ
zXbV&qOupyJ(U4&&7WFBGC5{1}bPtvK>#J^dNcs~x!|V6dI(*a{BXm1}7k2ZfjN%9S
z_b1d=JZ(C|LmDn-7c`zt0KOSA9~fLY(jHOk3JMZ3hb1P?;GT&Pt_+l)QmVmGT2gx}
z{HJuy$kfN5m Purpose: to calculate the normalized difference of the "green" or "nir" bands. This step is highlighted below: The It uses the Here's an overview of what the script does: It defines a command-line interface using the The It reads the data from the first raster (specified by It then opens the second raster (specified by It updates the data type in the metadata to It creates an output raster named "norm_diff.tif" using It calculates the normalized difference between the two input arrays The script is executable as a command-line tool as its usage is: The Python code is provided here: This Python script is a command-line tool for performing a normalized difference operation on two input raster images. The normalized difference is commonly used in remote sensing and image processing to highlight certain features or properties in the images. Here's an overview of the script's functionality: It imports necessary libraries and modules, including The Inside the It sets up The script creates a new output GeoTIFF file named It reads the pixel values from both input datasets and converts them to floating-point arrays. It calculates the normalized difference as The output dataset is closed, and both input datasets are closed. Finally, the script logs "Done!" to indicate that the operation is complete. To use this script, one provides two input raster images as arguments. The script will calculate the normalized difference between the two images, save the result as Purpose: to apply the Otsu threshold to the normalized difference. This step is highlighted below: The It uses the Here's an overview of what the script does: It defines a command-line interface using the The It reads the data from the input raster using It applies the Otsu threshold to the input array by calling the It creates an output raster named "otsu.tif" using It writes the thresholded binary image to the output raster using dst_dataset.write(). The result, a binary image where pixel values are either True or False based on the thresholding, will be saved as "otsu.tif" in the same directory where the script is executed. The script is executable as a command-line tool as its usage is: The Python code is provided here: This Python script is a command-line tool for applying the Otsu threshold to a raster image. The Otsu thresholding method is a technique used for image segmentation to separate objects of interest from the background. Here's an overview of the script's functionality: It imports necessary libraries and modules, including click for defining a command-line interface, numpy for numerical operations, gdal for geospatial operations, skimage.filters for Otsu thresholding, and loguru for logging. The threshold function takes a numpy array as input and returns the binary result of applying the Otsu threshold to the array. The Otsu threshold is calculated using the threshold_otsu function from the skimage.filters module. The otsu function is defined to apply the Otsu threshold to the input raster image. It takes the path to the input raster as an argument. Inside the otsu function, it logs the name of the input raster file. It opens the input raster as a GDAL dataset and creates a new output GeoTIFF file named "otsu.tif." The script sets the geospatial information (geotransform and projection) for the output dataset to match the input raster. It reads the pixel values from the input dataset and converts them to a floating-point array. The Otsu thresholding is applied to the array, and the binary result is written to the output dataset. The output dataset uses a data type of GDT_Byte. The NoData value of the output dataset is set to 0. The output dataset is closed, and the input dataset is closed. Finally, the script logs "Done!" to indicate that the operation is complete. To use this script, you would run it from the command line and provide the path to the input raster image as an argument. The script will apply the Otsu thresholding method to the input image, save the binary result as "otsu.tif," and preserve the geospatial information from the input image. This script is useful for image segmentation tasks, such as separating objects from the background in remote sensing and image processing applications. Purpose: produce a STAC Catalog with a STAC Item describing the detected water body result. This step is highlighted below: The It takes the STAC Item URLs and corresponding water body GeoTIFFs as input, creates STAC Items for each water body, and organizes them into a STAC Catalog. The script utilizes the Here's an overview of what the script does: It defines a command-line interface using the The For each input pair (STAC Item URL and GeoTIFF), it reads the STAC Item, creates a directory with the same name as the item's ID, and copies the water body GeoTIFF into that directory. It uses the The created STAC Items are added to the STAC catalog. After processing all input pairs, it saves the STAC catalog to the root directory, specifying it as a self-contained catalog with the catalog type set to The script will create a STAC catalog containing the detected water bodies and save it in the current directory. The script is executable as a command-line tool as its usage is: The Python code is provided here: This application takes as input Copernicus Sentinel-2 or USSG Landsat-9 data and detects water bodies by applying the Otsu thresholding technique on the Normalized Difference Water Index (NDWI). The NDWI is calculated with: Typically, NDWI values of water bodies are larger than 0.2 and built-up features have positive values between 0 and 0.2. Vegetation has much smaller NDWI values, which results in distinguishing vegetation from water bodies easier. The NDWI values correspond to the following ranges: To ease the determination of the water surface/non water surface, the Ostu thresholding technique is used. In the simplest form, the Otsu algorithm returns a single intensity threshold that separate pixels into two classes, foreground and background. This threshold is determined by minimizing intra-class intensity variance, or equivalently, by maximizing inter-class variance: The application can be used in two modes: This scenario is depicted below: This scenario is depicted below: Alice packages the application as an Application Package to include a macro workflow that reads the list of Sentinel-2 STAC items references or Landsat-9 staged data, launches a sub-workflow to detect the water bodies and creates the STAC catalog: The sub-workflow applies the The development and test dataset is made of two Sentinel-2 acquisitions: And one Landsat-9 acquisition: Each YAyj=$7X-+ohH%J
zdE)B(x$c+yDypXA-6!&Iwq(0Xj|C!0KLiXyq
SOM^uDht6(>(G&+O_Ih5d^@uUnhb`v8i
zbjrH?{`PhFz5b9^JyN~rt?$87mBGf4o3OB`ucD#t#C
nHz|FmYCDtULDX;lGD?j0NF;Fs~5C2YJ{2pqPe
zEH*0*nVG5QQ$`~ud*bbtINQLZZ5hG+kz@CepX4>IWQDfS_PBk6*NR+{XQfKDGYz(^
z+|Rj8?D^o@{(}i^mcOkpwXced78reP1lZGSioMpC^}K0*YPme(HcJj)__Npy-HyQ>
za4im62y{Eyi8<<5imZK^yY`oVeUIONL!AS9nr~oWDqakU#;25$Dwu8(>PWO9p;E4%
zg0F&L=`Y96i^MRNtdh!T5%yTGT^dv0mqngvA7!?2nyGN-^o=Qff^GD=$qQ3*<^P=q
z%3^SSnohWCxP2fDnWs9#X^NYBWV`hS7iM!V$@U|7N@*OmL?f_valmAHIw-E$L46kO
zDph;(Wxx<`xfyFjL$IJpNs-~*PvZu9D;WVTA=~cME?BqJW62H`kAIw1cgc9G11r7!
z%ADT=a{W@!JF?(sppqe|t6$B3mcdE2^^TE*--RW_<00^Qq+8;m|13M%bSn(We;_VX
z<9n;_x>T7b7jnH_`^NGfq{iSgzlh1m?`O*K^!hW^e%+)CUWwa>>5L|S-t5@e*sPwl
zbeq>7iZ=hO8MpeHgqVU`ei?&hmGFc_W8+H@d+q>E$Yl?HceIJrv0I*i-fenQ$$fc3
z_6dpLVzaMBZHPjtCj*UYER~35rR$39DrqO`TwS~aC$Y(7QKF6>xoiNz+2Lwi12;@>
z*p+bBq3F}i6GCAOt{q&*IM+zV
+
Description
+Step purpose
+Code
+norm_diff
script is a command-line tool for performing a normalized difference between two raster images. click
, rasterio
, and numpy
libraries to perform the calculation and save the result as a GeoTIFF file.
+
+click
library, with two arguments for providing the file paths of the two raster images that you want to calculate the normalized difference for.normalized_difference
function is the main entry point. It opens the two input raster files specified as arguments.rasters[0]
) using rasterio
, and it also copies the metadata (e.g., projection
, geotransform
) of this raster to be used for the output.rasters[1]
) and reads its data."float32"
because the normalized difference result will be a floating-point image.rasterio
. This output raster will have the same metadata as the first input raster, but it will be of data type float32
.(array1 - array2) / (array1 + array2)
and writes it to the output raster using dst_dataset.write()
.Usage: app.py [OPTIONS] RASTERS...
+
+ Performs a normalized difference
+
+Options:
+ --help Show this message and exit.
+
water-bodies/command-line-tools/norm_diff/app.py 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
"""Normalized difference"""
+import click
+import rasterio
+import numpy as np
+from loguru import logger
+
+np.seterr(divide="ignore", invalid="ignore")
+
+
+@click.command(
+ short_help="Normalized difference",
+ help="Performs a normalized difference",
+)
+@click.argument("rasters", nargs=2)
+def normalized_difference(rasters):
+ """Performs a normalized difference"""
+
+ logger.info(f"Processing the normalized image with {rasters[0]} and {rasters[1]}")
+
+ with rasterio.open(rasters[0]) as ds1:
+ array1 = ds1.read(1)
+ out_meta = ds1.meta.copy()
+
+ with rasterio.open(rasters[0]) as ds2:
+ array2 = ds2.read(1)
+
+ out_meta.update({'dtype': "float32"})
+
+ with rasterio.open("norm_diff.tif", 'w', **out_meta) as dst_dataset:
+ logger.info(f"Write norm_diff.tif")
+ dst_dataset.write((array1 - array2) / (array1 + array2), indexes=1)
+
+ logger.info("Done!")
+
+if __name__ == "__main__":
+ normalized_difference()
+
+
Normalized difference
+
+click`` for defining a command-line interface,
numpy` for numerical operations,
gdalfor geospatial operations, and
loguru` for logging.normalized_difference
function is defined to perform the normalized difference operation. It takes two raster image file paths as input.normalized_difference
function, it logs the names of the input raster files.numpy
to allow division by zero and defines GDAL datasets for both input raster images."norm_diff.tif"
to store the result. It preserves the geospatial information (geotransform and projection) from the first input raster.(array1 - array2) / (array1 + array2)
and writes the result to the output dataset."norm_diff.tif"
and preserve the geospatial information from the first input image.
+
Description
+Step purpose
+Code
+otsu
Python script is a command-line tool for applying the Otsu threshold to a single input raster image. click
, rasterio
, numpy
, skimage.filters
, and loguru
libraries.
+
+click
library, with a single argument for providing the file path of the input raster image on which you want to apply the Otsu threshold.otsu
function is the main entry point. It opens the input raster file specified as the argument.rasterio
and also copies the metadata (e.g., projection
, geotransform
) of this raster to be used for the output.threshold
function. The threshold_otsu
function from skimage.filters
is used to calculate the Otsu threshold. The thresholding process marks pixels as True or False based on whether they are greater than the calculated threshold.rasterio
. This output raster will have the same metadata as the input raster.Usage: app.py [OPTIONS] RASTER
+
+ Applies the Otsu threshold
+
+Options:
+ --help Show this message and exit.
+
water-bodies/command-line-tools/otsu/app.py 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
"""Command line tool to apply the Otsu threshold to a raster"""
+import click
+import rasterio
+import numpy as np
+from skimage.filters import threshold_otsu
+from loguru import logger
+
+def threshold(data):
+ """Returns the Otsu threshold of a numpy array"""
+ return data > threshold_otsu(data[np.isfinite(data)])
+
+
+@click.command(
+ short_help="Otsu threshoold",
+ help="Applies the Otsu threshold",
+)
+@click.argument("raster", nargs=1)
+def otsu(raster):
+ """Applies the Otsu threshold"""
+
+ with rasterio.open(raster) as ds:
+ array = ds.read(1)
+ out_meta = ds.meta.copy()
+
+ logger.info(f"Applying the Otsu threshold to {raster}")
+
+ with rasterio.open("otsu.tif", 'w', **out_meta) as dst_dataset:
+ logger.info(f"Write otsu.tif")
+ dst_dataset.write(threshold(array), indexes=1)
+
+ logger.info("Done!")
+
+if __name__ == "__main__":
+ otsu()
+
+
Otsu
+
+
+
Description
+Step purpose
+Code
+stac
script is a command-line tool for creating a SpatioTemporal Asset Catalog (STAC) catalog containing detected water bodies.click
, pystac
, rio_stac
, and loguru
libraries.
+
+click
library. The script expects multiple input STAC Item URLs and corresponding water body GeoTIFFs as arguments.to_stac
function is the main entry point. It creates a new STAC catalog and iterates through the provided STAC Item URLs and water body GeoTIFFs.rio_stac
library to create a STAC Item for the water body. This includes specifying the source GeoTIFF, input date/time, asset roles, asset href, and more.pystac.CatalogType.SELF_CONTAINED
.Usage: app.py [OPTIONS]
+
+ Creates a STAC catalog with the water bodies
+
+Options:
+ --input-item TEXT STAC Item URL [required]
+ --water-body TEXT Water body geotiff [required]
+ --help Show this message and exit.
+
water-bodies/command-line-tools/stac/app.py 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
"""Creates a STAC catalog with the detected water bodies""" ""
+import os
+import shutil
+import click
+import pystac
+import rio_stac
+from loguru import logger
+
+@click.command(
+ short_help="Creates a STAC catalog",
+ help="Creates a STAC catalog with the water bodies",
+)
+@click.option(
+ "--input-item",
+ "item_urls",
+ help="STAC Item URL",
+ required=True,
+ multiple=True,
+)
+@click.option(
+ "--water-body",
+ "water_bodies",
+ help="Water body geotiff",
+ required=True,
+ multiple=True,
+)
+def to_stac(item_urls, water_bodies):
+ """Creates a STAC catalog with the detected water bodies"""
+
+ logger.info(f"Creating a STAC Catalog for {' '.join(water_bodies)}")
+ cat = pystac.Catalog(id="catalog", description="water-bodies")
+
+ for index, item_url in enumerate(item_urls):
+ if os.path.isdir(item_url):
+ catalog = pystac.read_file(os.path.join(item_url, "catalog.json"))
+ item = next(catalog.get_items())
+ else:
+ item = pystac.read_file(item_url)
+
+ water_body = water_bodies[index]
+
+ os.makedirs(item.id, exist_ok=True)
+ shutil.copy(water_body, item.id)
+
+ out_item = rio_stac.stac.create_stac_item(
+ source=water_body,
+ input_datetime=item.datetime,
+ id=item.id,
+ asset_roles=["data", "visual"],
+ asset_href=os.path.basename(water_body),
+ asset_name="data",
+ with_proj=True,
+ with_raster=False,
+ )
+
+ cat.add_items([out_item])
+
+ cat.normalize_and_save(
+ root_href="./", catalog_type=pystac.CatalogType.SELF_CONTAINED
+ )
+ logger.info("Done!")
+
+if __name__ == "__main__":
+ to_stac()
+
+
Water bodies detection
+Water bodies detection
+
+
+
+
+
+
+
+Range
+Description
+
+
+0,2 - 1
+Water surface
+
+
+0.0 - 0,2
+Flooding, humidity
+
+
+-0,3 - 0.0
+Moderate drought, non-aqueous surfaces
+
+
+
+-1 - -0.3
+Drought, non-aqueous surfaces
+
+
+
+
+crop
, Normalized difference
, Otsu threshold
steps:
+
+
+
+
+
+
+Acquisitions
+
+
+
+
+Mission
+Sentinel-2
+Sentinel-2
+
+
+Date
+2022-05-24
+2021-07-13
+
+
+URL
+S2B_10TFK_20210713_0_L2A
+S2A_10TFK_20220524_0_L2A
+
+
+
+Quicklook
+
+
+
+
+
+
+
+
+
+Acquisition
+
+
+
+Date
+2023-10-15
+
+
+URL
+LC09_L2SP_042033_20231015_02_T1
+
+
+
+Quicklook
+
+ Command Line Tool
step such as crop
, Normalized difference
, Otsu threshold
and Create STAC
runs a simple Python script in a dedicated container.L;)+==dto5PkA0rdux7W8
zNa5;c#@3E=JNLc5H@jn)fi8J_i>~mgC`cDFSXVMwOAf1BY%vMBKd=l?X3|J%jq`fS
zA8N(&Lp*xIQr@@dw-=XwGr2d7R^B~d;I
*$6ac;^cpF0#`M+x^D=2smAs;&aWBRN#0CooO-scqc^;xFdVb$5$Sx2~Z^52E)
z{`}!DI>ATzr&A53rlsxDz4+f}?IwqCKbTV@91`)i44A{Mc^2OS
z3C-GCyS!