Skip to main content

eoread - Read satellite products as xarray Datasets

Read earth observation products as lazy, dask-backed xarray.Dataset objects, for integration in processing chains, subsetting, conversion, etc.

Target features:

  • one reader class per (sensor, level), sharing a common contract and output schema
  • easy input/output, conversion, subsetting and manipulation
  • easy processing by blocks
  • lazy file access — nothing is computed at construction
  • allow processing in parallel with dask
  • quality flags decoded on demand, never stored
  • read/write NetCDF

Installation

hyp add --hygeos eoread

Open a product

A reader is a class, one per (sensor, level), grouped by sensor under eoread.readers:

from eoread.readers.msi import Level1C_MSI

ds = Level1C_MSI('S2B_MSIL1C_20250320T104639_N0511_R051_T31UDS_20250320T142408.SAFE',
                 chunks=1000, resolution=60)

Calling the class reads the product and returns the dataset directly: ds is an xarray.Dataset whose variables are lazy dask arrays — they are not read nor computed until they are accessed.

Every reader shares the base signature

Reader(path, chunks=None, metadata_template=None, verbose=False)

and may add reader-specific options as extra keyword arguments with defaults (e.g. resolution on MSI).

Every returned dataset conforms to the canonical output schema and is validated at read time (stamped with a schema_version attribute). Unsupported product types or versions raise a ProductError subclass loudly — never a silent fallback.

Supported readers

Sensor Level(s) Module
Sentinel-2 MSI L1C, L2A eoread.readers.msi
Sentinel-3 OLCI L1, L2 eoread.readers.olci
MERIS L1 eoread.readers.meris
Landsat 8/9 OLI L1TP eoread.readers.oli
MODIS L1B eoread.readers.modis
ECOSTRESS L1B, L1C, L2 eoread.readers.ecostress
PACE OCI L1B eoread.readers.pace
VENµS L1C, L2A eoread.readers.venus
SGLI L1B eoread.readers.sgli
HYPSO-1 L1 eoread.readers.hypso
GOES-NG L1 eoread.readers.goesng
GEOSAT (DE-1/DE-2) L1 eoread.readers.geosat
Pleiades / Pleiades Neo L1 eoread.readers.pleiades, eoread.readers.pleiades_neo
PlanetScope L1 eoread.readers.planetscope

eoread.reader.discover_readers() lists every reader class programmatically.

Subsetting

xarray Datasets allow easy subsetting:

# product subsetting based on row and column indices (canonical dim names)
sub = ds.isel(y=slice(500, 600), x=slice(400, 500))

With geographical coordinates:

sub = ds.sel(lat=slice(45.5, 46.0), lon=slice(3.0, 3.5))

The core package provides helpers for geographic subsetting:

from hygeos_core.tools import sub_rect, sub_pt

# based on a range of lat/lon
sub = sub_rect(ds, lat_min, lon_min, lat_max, lon_max)

# based on a center and a radius (km)
sub = sub_pt(ds, pt_lat, pt_lon, rad)

Quality flags

No pre-decoded flag masks are stored in the dataset. Flags are decoded on demand from the raw flag layers by the reader class:

from eoread.flags import GenericFlags

# lazy boolean mask, e.g. invalid pixels for MSI
mask = Level1C_MSI.getflag(ds, GenericFlags.L1_INVALID)

Readers supporting flags advertise themselves through the ds.attrs['_flag_reader'] attribute. To pack several flags into a single variable for blockwise processing:

from eoread.flags import FlagsInit, GenericFlags

init = FlagsInit(
    flags={GenericFlags.LAND: 1 << 0, GenericFlags.CLOUD: 1 << 1},
    dtype='uint16',
    flag_reader=ds.attrs['_flag_reader'],
)
ds = init.map_blocks(ds)   # adds a packed 'flags' variable

Flag support varies by reader; getflag raises ValueError for an unsupported flag.

Metadata

By default readers keep the full product metadata in ds.attrs['metadata']. Pass metadata_template to keep only selected branches:

ds = Level1C_MSI('product.SAFE',
                 metadata_template=[['General_Info', 'Product_Info'],
                                    ['Product_Identifier']])

Output products

Writing to NetCDF is supported by the xarray.Dataset.to_netcdf method.

A helper function is provided by hygeos_core.files.to_netcdf, which provides features like automatic file naming, temporary files and compression.

Chunking

For efficient processing:

Migrating from v1

The pre-v2 readers (eoread.legacy.*, including the Level1()/Level2() auto-detection functions) were removed in 2.0. To map a v2 dataset back to the v1 layout:

from eoread.compat import v1
ds_v1 = v1(ds)

A few sensors carry documented clean breaks where v2 values intentionally differ from v1 (see eoread.compat.CLEAN_BREAKS).

Tests

Uses pytest, on real products only; tests skip cleanly when a sample product is not available:

$ pixi run gate     # no-data gate (import smoke + collection)
$ pytest tests/

Metadata

Release files for eoread 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eoread 2.0.0
File Size Uploaded Provenance Actions
eoread-2.0.0.tar.gz 975.7 kB Without provenance Details for eoread-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for eoread 2.0.0
File Interpreter ABI Platform Actions
eoread-2.0.0-py3-none-any.whl Python 3 none any Details for eoread-2.0.0-py3-none-any.whl

Total release size: 2.0 MB

Release files / eoread-2.0.0.tar.gz

Download URL eoread-2.0.0.tar.gz
Size 975.7 kB
Tags Source
SHA-256 checksum
How to use checksums
eb755290d8bed89b814db37caadf64961f7aada8166d4ddf1f21439c27843a6f
BLAKE2b-256 checksum
How to use checksums
3ff797e4c848971e0af6ab9c9b5956f43f6c5ad2f1db734b24846d213300ef86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / eoread-2.0.0-py3-none-any.whl

Download URL eoread-2.0.0-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
08db471deefd26259d70730f206d6dc0a3c29f65e9785e65bd6e6e51f0bad83a
BLAKE2b-256 checksum
How to use checksums
1fa6b43b4d09c2df9e2665f3b311983efc27bea40e8a4ac57a53eb43a2b38619
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for eoread 2.0.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.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page