Skip to content

sensorsio Tutorial

The tutorial describes how to read Sentinel-2 data with sensorsio



Motivation

The notebook demonstrates how to leverage the sensorsio Python package to load and process Sentinel-2 Level-2A (MAJA format) imagery efficiently. It covers key capabilities like reprojection, subsetting, and reading both raw bands and masks into numpy and xarray.

Prerequisites

To follow the tutorial, you need:

  • Python environment setup: Ability to run Jupyter notebooks. Installing the library can be done via: pip install sensorsio
  • Sentinel-2 L2A data: MAJA-processed Sentinel-2 product, e.g. downloaded from THEIA or a similar provider.

Tutorial Content

The notebook proceeds through several structured steps:

  1. Import & Instantiate

  2. Import the Sentinel-2 driver from sensorsio.

  3. Load a Sentinel-2 image by pointing at the directory path of the L2A product.

  4. Reading Data

  5. Use read_as_numpy to retrieve selected resolution bands (e.g., 10m group).

  6. Use read_as_xarray to get an xarray.Dataset with dimensions, coordinates, masks, and metadata.

  7. Visualization

  8. Apply utils.rgb_render to generate RGB-composite arrays with scaling parameters.

  9. Plot side-by-side comparisons using Matplotlib for visual inspection.

  10. Extras & Metadata Access

  11. Highlight access to sensor-specific metadata such as tile identifier, CRS, and acquisition date.

Contacts