Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sen2VM Release history

## Merged in main
## Merged in main (1.3.0.rc2)

### Main feature

Expand All @@ -12,11 +12,17 @@

* Feature:

*
* Handle mosaic DEM (multiple square degrees): #62

* Doc:

*
* Notebooks improvements:

* Separate static input download in a dedicated notebook (#56)
* Allow more flexible input structure with separated input locations (#56)
* Creation of a Notebook for Inverse location (#54)
* Allow using OTB instead of gdal in direct location Notebook (through a new notebook)


## 1.2.0 (2026-05-04)

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ghcr.io/sen2vm/sen2vm-build-env:latest AS launcher

ENV SEN2VM_VERSION=1.3.0.rc1
ENV SEN2VM_VERSION=1.3.0.rc2

WORKDIR /Sen2vm

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>esa.sen2vm</groupId>
<artifactId>sen2vm-core</artifactId>
<!-- NOTE: remind to change also the SEN2VM_VERSION in the Dokerfile-->
<version>1.3.0.rc1</version>
<version>1.3.0.rc2</version>

<name>sen2vm-core</name>
<url>https://github.com/sen2vm/sen2vm-core</url>
Expand Down
156 changes: 128 additions & 28 deletions sen2vm-notebook/README_Notebooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,97 @@
# Sen2VM Notebook Processing Workflow

Comment thread
aburie-cs marked this conversation as resolved.
This repository provides a complete workflow to run **Sen2VM** inside Docker and generate orthorectified and mosaicked outputs from Sentinel-2 L1B data.

Four notebooks are provided:

* **inputs-download-notebook.ipynb**
Downloads all required input data (GEOID and GIPP) from the Git repository.

* **notebook-direct-grid.ipynb**
Runs Sen2VM with the **direct** mode, using the downloaded inputs, along with the IERS file and L1B product, to produce orthorectified and mosaicked images using gdal functions.

* **notebook-direct-grid-otb.ipynb**
Runs Sen2vm with the **direct** mode, using the downloaded inputs, along with the IERS file and L1B product, to product orthorectified and mosaicked images using otb functions.

* **notebook-inverse-grid.ipynb**
Runs Sen2VM with the **inverse** mode, using the downloaded inputs, along with the IERS file and L1B product, to produce orthorectified and mosaicked images.

The project is designed and tested on **Linux**. It may not work reliably on **Windows**.
Actually, this notebook can generate an inverse grid but can not use it to apply the orthorectification.

## Prerequisites

* **Docker** is avaialble on the running machine (installed and running)
* **Python 3.x**
* **the full sen2vm-notebook folder shall be present:**

* notebook.ipynb
* inputs-download-notebook.ipynb
* notebook-direct-grid.ipynb
* notebook-direct-grid-otb.ipynb
* notebook-inverse-grid.ipynb

* requirements.txt
* gdal-latest folder

* Required data:

* **Sentinel-2 L1B product** : /DATASTRIP and /GRANULE.
* **DEM files** placed in the appropriate directory
* **Sentinel-2 L1B product**: /DATASTRIP and /GRANULE.
* **DEM files**

## Mandatory Directory Structure

Only a `WORKDIR` folder is required. All outputs, as well as intermediate files generated during execution, will be stored there.

## Inputs

Several inputs are needed:
* L1B S2 product under EUP.SAFE format:
```bash
<L1B_product>/
├── DATASTRIP # Required
├── GRANULE # Required
├── S2*OPER_MTD_SAFL1B_PDMC*.xml #Required
└── ...
```
* Digital Elevation Model (DEM)

* IERS (prediction of Earth orientation, IERS can be donwloaded using **notebook.ipynb** (cell number 2))

* GIPP (GIPP can be downloaded from the GIT repositery using **inputs-download-notebook.ipynb**)

* GEOID (GEOID can also be downloaded from the GIT repositery using **inputs-download-notebook.ipynb** )

Thanks to a recent update (#issue 56), now the differents inputs path are absolute path.

## Directory Structure after execution
```bash
WORKDIR
├── DATA/
│ ├── DEM/ # Put your DEM files here
| ├── GEOID/ # Put your GEOID files here (Optional)
│ └── <L1B_product>/ # Place the full L1B product here
| ├── DATASTRIP # Required
| ├── GRANULE # Required
| └── ...
└── ...
├── bulletin*.txt # IERS prediction of earth exploration (downloaded by the cell n°3)
├── output/ # output after orthorectification and mosaic (.tif)
│ ├── DIRECT_gdal
│ │ ├─ GDAL_OUTPUT_ORTHO # .tif orthorectified, one for each band and detector
│ │ └─ GDAL_OUTPUT_MOSAIC # .tif orthorectified and merged by band, one for each band
│ ├── DIRECT_otb
│ │ ├─ INVERSE_GRID # inverse gelocation grid, generated from direct grids by sen2vminvlocfromdirlocgrid.py, these grids encode the transformation between sensor geometry and map geometry
│ │ ├─ raw # contains the raw L1B images extracted per detector and per band, expressed in the sensor geometry (i.e., before any orthorectification or map projection)
│ │ ├─ otb_no_georef # contains images resampled using OTB with the inverse grids. The data are projected onto a regular grid but are not yet fully georeferenced
│ │ ├─ output_georef # contains the final orthorectificatied and georeferenced images
│ │ └─ mosaic # contains mosaicked images generated per spectral band by merging all detector-level orthorectified
│ └── INVERSE
│ ├─ INVERSE_GRID # inverse gelocation grid, generated by sen2vm, these grids encode the transformation between sensor geometry and map geometry
│ ├─ raw # contains the raw L1B images extracted per detector and per band, expressed in the sensor geometry (i.e., before any orthorectification or map projection)
│ ├─ otb_no_georef # contains images resampled using OTB with the inverse grids. The data are projected onto a regular grid but are not yet fully georeferenced
│ ├─ output_georef # contains the final orthorectificatied and georeferenced images
│ └─ mosaic # contains mosaicked images generated per spectral band by merging all detector-level orthorectified images
├── src/ # contains a .sh used to run in the gdal docker generated by the notebook
└── UserConf # contains .txt config files generated by the notebook
```

If the GEOID folder is empty, the notebopok will automaticaly use the geoid provided by sen2vm-core

## Python Environment Setup

In the notebook directory create your venv :
In the notebook directory create your venv:

```bash
python3 -m venv .venv
Expand All @@ -63,38 +116,85 @@ pip install -r requirements.txt

Select the virtual environment kernel in your Jupyter session.

## Notebook Configuration
## Notebooks Configuration

In **inputs-download-notebook.ipynb**:
In the first cell of the notebook:

1. Set the paths to:

* The directory where you want the GIPP files to be downloaded
* The directory where you want the GEOID files to be downloaded

In **notebook-direct-grid.ipynb** or **notebook-direct-grid-otb.ipynb** or **notebook-inverse-grid.ipynb**:
In the first cell of the notebook:

1. Set the path to:
1. Set the absolute paths to:

* The working directory
* The L1B product
* The output directory
* The GIPP directory
* The GEOID directory
* The DEM directory
* The IERS file (if you do not have the IERS file, put `""`, and one will be automatically ed to the working directory)
* NB : The output directory will be created in the working directory

2. Adjust configuration parameters for:

* Sen2VM
* Orthorectification settings

3. Specify whether the docker images should be removed

## Processing Steps

Execute the notebook cell by cell in the following order:
If you do not have your own GIPP and GEOID files, or if they are not already downloaded,
execute the **inputs-download-notebook.ipynb** cell by cell in the following order:

1. Variable definitions
1. Path definitions
2. Clone `sen2vm-gipp`, and manage GIPP assets
3. Automatic download of the IERS bulletin
4. Generation of `config.json` in: `/WORKDIR/UserConf`
5. Generation of `params.json` in: `/WORKDIR/UserConf`
6. Execution of sen2vm inside Docker
7. Generation of a `.sh` script, then execution inside a second Docker container running the latest GDAL:

* Orthorectification by band
3. Copy `Geoid` folder from `"/sen2vm-core/src/test/resources/DEM_GEOID"`

Then if you want to use the direct grids with gdal functions only, execute the **notebook-direct-grid.ipynb** cell by cell:

1. Variable and path definitions
2. Automatic download of the IERS bulletin if none is provided by the user
3. Generation of `config.json` in: `/WORKDIR/UserConf`
4. Generation of `params.json` in: `/WORKDIR/UserConf`
5. Execution of sen2vm inside Docker to generatre the direct grids
6. Generation of a `.sh` script, then execution inside a second Docker container running the latest GDAL:

* Orthorectification by band that generate images in `WORKDIR/DIRECT/GDAL_OUTPUT_ORTHO` using the function **gdalwarp**
* Mosaicking by band that generate an image in `WORKDIR/DIRECT/GDAL_OUTPUT_MOSAIC` using the function **gdalmerge.py**

If you want to use the direct grids with otb functions for the orthorectification, execute the **notebook-direct-grid-otb.ipynb** cell by cell:

1. Variable and path definitions
2. Automatic download of the IERS bulletin if none is provided by the user
3. Generation of `config.json` in: `/WORKDIR/UserConf`
4. Generation of `params.json` in: `/WORKDIR/UserConf`
5. Execution of sen2vm inside Docker to generate the direct grids
6. Generation of inverse grids in `WORKDIR/output/INVERSE/INVERSE_GRID` from the direct direct grids using **sen2vminvlocfromdirlocgrid**
7. Orthorectification using OTB inside a docker then mosaicking using GDAL:

* Orthorectification by band
* Mosaicking

Docker images are automatically cleaned up after each execution.
Docker images can be removed or kept depending on the value of `REMOVE_DOCKER_IMAGE` in step 1.

If you want to use the inverse grids, execute the **notebook-inverse-grid.ipynb** cell by cell:

1. Variable and path definitions
2. Automatic download of the IERS bulletin if none is provided by the user
3. Generation of `config.json` in: `/WORKDIR/UserConf`
4. Generation of `params.json` in: `/WORKDIR/UserConf`
5. Execution of sen2vm inside Docker to generate the inverse grids in `WORKDIR/output/INVERSE/INVERSE_GRID`
6. Orthorectification using OTB inside a docker then mosaicking using GDAL:

* Orthorectification by band
* Mosaicking

Docker images can be removed or kept depending on the value of `REMOVE_DOCKER_IMAGE` in step 1.
## Execution

Run all notebook cells sequentially.
Expand Down
Loading
Loading