Water detection

Let’s use EOReader for water detection

Warning: You will need matplotlib to complete this tutorial

Basic example

Let’s use EOReader for the first time !

Warning: You will need matplotlib to complete this tutorial

import os

# First of all, we need some satellite data. 
# Let's open a lightweight a Landsat-5 MSS collection 2 tile.
path = os.path.abspath("../../CI/DATA/LM05_L1TP_200029_19841014_20200902_02_T2.tar")
from eoreader.reader import Reader

# Create the reader
eoreader = Reader()

# This reader is a singleton can be called once and then open all your data.
# Use it like a logging.getLogger() instance
from eoreader.bands.alias import *

# Open your product
prod = eoreader.open(path) # No need to unzip here
print(prod)
<eoreader.products.optical.l5_product.L5Product object at 0x000001A77EC56E80>
# Here you have opened your product and you have its object in hands
# You can play a little with it to see what it got inside
print(f"Landsat tile: {prod.tile_name}")
print(f"Acquisition datetime: {prod.datetime}")
Landsat tile: 200029
Acquisition datetime: 1984-10-14 10:18:17
# Open here some more interesting geographical data: extent
extent = prod.extent()
extent.geometry.to_crs("EPSG:4326").iat[0]  # Display
../_images/water_detection_6_0.svg