<jupyter_start><jupyter_text>Basic exampleLet's use EOReader for the first time !<jupyter_code>import os

# First of all, we need some satellite data. 
# Let's open a lightweight a Landsat-5 TM collection 2 tile.
path = os.path.join("/home", "data", "DATA", "PRODS", "LANDSATS_COL2", "LT05_L1TP_200030_20111110_20200820_02_T1.tar")
from eoreader.reader import Reader

# Create the reader
# This reader is a singleton can be called once and then open all your data.
eoreader = Reader()
# Open your product
# No need to extract the product here: Archived Landsat-5 Collection are handled by EOReader
prod = eoreader.open(path)
# 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}")
# Retrieve the UTM CRS of the tile
prod.crs
# Open here some more interesting geographical data: extent and footprint
base = prod.extent.plot(color='cyan', edgecolor='black')
prod.footprint.plot(ax=base, color='blue', edgecolor='black', alpha=0.5)<jupyter_output><empty_output><jupyter_text>See the difference between footprint and extent hereunder:|Without nodata | With nodata||--- | ---|| ![without_nodata](https://zupimages.net/up/21/14/69i6.gif) | ![with_nodata](https://zupimages.net/up/21/14/vg6w.gif) |<jupyter_code>from eoreader.bands import *
from eoreader.env_vars import DEM_PATH

# Select the bands you want to load
bands = [GREEN, NDVI, YELLOW, CLOUDS]

# Compute DEM band only if you have set a DEM in your environment path
if DEM_PATH in os.environ:
    bands.append(HILLSHADE)

# Be sure they exist for Landsat-5 TM sensor:
ok_bands = [band for band in bands if prod.has_band(band)]
print(to_str(ok_bands))  # Landsat-5 TM doesn't provide YELLOW band
# Load those bands as a dict of xarray.DataArray
band_dict = prod.load(ok_bands)
band_dict[GREEN]
# The nan corresponds to the nodata you see on the footprint
# Plot a subsampled version
band_dict[GREEN][:, fc00:db20:35b:7399::5, ::10].plot()
# Plot a subsampled version
band_dict[NDVI][:, fc00:db20:35b:7399::5, ::10].plot()
# Plot a subsampled version
if HILLSHADE in band_dict:
    band_dict[HILLSHADE][:, fc00:db20:35b:7399::5, ::10].plot()
# You can also stack those bands
stack = prod.stack(ok_bands)
stack
# Plot a subsampled version
import matplotlib.pyplot as plt

nrows = len(stack)
fig, axes = plt.subplots(nrows=nrows, figsize=(2 * nrows, 6 * nrows), subplot_kw={"box_aspect": 1})  # Square plots
for i in range(nrows):
    stack[i, fc00:db20:35b:7399::5, ::10].plot(x="x", y="y", ax=axes[i])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1191827468785471, 'fraction_numerical': 0.03897086643965191, 'mean_word_length': 5.4330900243309, 'pattern_counts': {'":': 1, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '398925', 'license': 'Apache-2.0', 'n_tokens_mistral': 1010, 'n_tokens_neox': 929, 'n_words': 294, 'path': 'docs/notebooks/base.ipynb', 'repo_name': 'sertit/eoreader', 'size': '2575'}