Python SDK

Python SDK Latest Release s2dr3-20251218

Install and run the S2DR3 Python SDK, including the latest parameters and COG output option.

This article covers the S2DR3 Python SDK release identified as s2dr3-20251218.

Requirements

  • Linux.
  • Python 3.12 or later.
  • NVIDIA GPU tested by Gamma Earth: T4, P100, V100, or A100.
  • 16 GB VRAM.
  • 16 GB RAM minimum; 32 GB RAM preferred.

Install the SDK

Install GDAL and the S2DR3 wheel:

apt install -qq pip gdal-bin
pip -q install https://storage.googleapis.com/0x7ff601307fa5/s2dr3-20251218.1-cp312-cp312-linux_x86_64.whl

Configure infer.py

Set the default paths for input data, output data, and logs:

parser.add_argument("--datapath", type=str, default="/home/ubuntu/data/datapath", help="Input image or folder")
parser.add_argument("--savepath", type=str, default="/home/ubuntu/data/savepath", help="Output image or folder")
parser.add_argument("--logpath", type=str, default="/home/ubuntu/data/logs", help="Path for logging")

Sentinel-2 data is automatically downloaded to datapath.

Run GPU Inference

cd <path-to-the-infer.py>
python infer.py -f --date <YYYY-MM-DD> --aoi <W S E N>

Example:

python infer.py -f --date 2021-08-15 --aoi 30.8520 50.3993 30.8750 50.4131

Main Parameters

ParameterDescription
--dateExact Sentinel-2 scene date. The run fails if the scene does not exist.
--date_rangeNumber of days back from the target date to search.
--aoiBounding box AOI. It should fit entirely within the Sentinel-2 scene.
--max_cloudsMaximum cloud cover allowed in the date search.
--geojsonInput GeoJSON file with AOI polygons.
--mgrsMGRS tile index.
--iso2-digit ISO country code.
--NMMGRS subsubtile indices on the 9x9 grid.
--UVMGRS subtile indices on the 3x3 grid.
--datapathPath for storing original Sentinel-2 data.
--savepathPath for generated super-resolved data.
--logpathLog file path.
--bands_outSpectral bands to generate in Sentinel-2 format.

Options

OptionDescription
-c, --cogsGenerate COG outputs for TCI, NDVI, and IRP.
-f, --forceForce re-processing of existing products.
-t, --get_tileForce downloading the entire Sentinel-2 MGRS tile.
-d, --debugPrint debugging information.
-q, --quietRun completely quiet.
-s, --simulateSimulate on a small test tile.

Changelog

Compared with the older SDK source, the 2025-12-18 release adds or clarifies:

  • New main parameter --date_range: number of days back from the target date to search.
  • New main parameter --max_clouds: maximum cloud cover allowed in the date search.
  • New option -c, --cogs: generate COG outputs for TCI, NDVI, and IRP.

S2DR4 Switch

To switch an infer.py workflow from S2DR3 to S2DR4, use:

from s2dr4.inferutils import infer

Outputs

The SDK can produce:

  • 10-channel MS 16-bit uint16 GeoTIFF in original UTM projection.
  • 4-channel BGRN 16-bit uint16 GeoTIFF in original UTM projection.
  • 4-channel RGBA 8-bit GeoTIFF in Web Mercator projection.

Limitations

  • Exact-date runs fail if the Sentinel-2 scene does not exist.
  • The bounding-box AOI should fit entirely within the Sentinel-2 scene.
  • The current SDK manual says AOI should not exceed 10x10 km / 100 km2 in this dev version.
  • SentinelHub has a width/height limit of 2500 px.

Related