Sentinel-2 COG Downloader/Loader
Search Element 84 Earth Search for Sentinel-2 L2A Cloud-Optimized GeoTIFFs, stitch every tile needed for full bounding-box coverage, keep only the bands you ask for, and return an xarray array.
I know this is a bit niche but I've found myself writing this code multiple times over the years so I'm putting it in a package.
Install
pip install sentinel-2-cog-downloader
With uv:
uv add sentinel-2-cog-downloader
Usage
from s2_cog_dl import Downloader, NoViableDataError
downloader = Downloader(
bbox=[-122.86, 37.61, -122.15, 38.11], # west, south, east, north
datetime="2026-01-01", # target time; ±14 days by default
bands=["red", "green", "blue", "nir"], # or Sentinel-2 aliases like "B04"
max_cloud_coverage=25,
)
try:
result = downloader.download()
except NoViableDataError as exc:
raise
array = result.to_array() # DataArray with a "band" dimension
dataset = result.to_dataset()
A single date is expanded by search_window_days (default 14). Pass an explicit range to search only that window:
Downloader(bbox=bbox, datetime=["2026-01-01", "2026-01-15"])
Output CRS defaults to the UTM zone of the bbox. Pixel size is metres (resolution=10) and is converted to degrees when crs="EPSG:4326".
Publish (maintainers)
Build and upload with the stdlib-adjacent PyPA tools:
pip install -e ".[publish]"
make publish-test # TestPyPI
make publish # PyPI
Or with uv:
uv build
uv publish --publish-url https://test.pypi.org/legacy/
uv publish
twine / uv publish expect TWINE_USERNAME / UV_PUBLISH_TOKEN (or an interactive login) with a PyPI API token.
Metadata
Release files for sentinel-2-cog-downloader 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sentinel_2_cog_downloader-0.1.0.tar.gz | 12.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sentinel_2_cog_downloader-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.8 kB
Release files / sentinel_2_cog_downloader-0.1.0.tar.gz
| Download URL | sentinel_2_cog_downloader-0.1.0.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
269c32c00ac7738e6a08b63197d2937d69de10cc793feca0371dc8a517f3c54b
|
|
BLAKE2b-256 checksum How to use checksums |
67ad09ad9a9cb3089b628d0654caef2c963129035a7ab07e9b65f7e8ed564d32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.0
|
Release files / sentinel_2_cog_downloader-0.1.0-py3-none-any.whl
| Download URL | sentinel_2_cog_downloader-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
edf0e809ec78905ae6cb870f01085df75657c69c8e704ff942974c14c32d2b13
|
|
BLAKE2b-256 checksum How to use checksums |
fef2e5d29ddd4c6702fa90c551b230d1f4125bdc2c290a37cd9e2196e0a5f66f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.0
|
Security for sentinel-2-cog-downloader 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.