Sensors — Readers#
Instrument readers that decode L1 formats into calibrated, geolocated pyramids
Datasets. For real MTG-FCI L1C FDHSI granules use read_fci_l1c: it decodes
the packed radiance from the nested data/<channel>/measured groups, reads the
per-granule calibration coefficients, and stitches the chunks by their
geostationary geotransform Y origin (validated on real MTI1/Meteosat-12
granules — see issue #40). Read several channels in one call with
channels=[...], which returns a dict[str, Dataset] and reads each chunk's
structure and coefficients once for the whole set (e.g. the red/blue/near-IR
bands of a true-colour composite); available_channels(chunks) lists which
channels the chunk set carries (it also accepts a single chunk path).
open_fci_l1c_chunk is the lower-level radiance opener for use with the generic
read_fci (which also accepts channels=[...]).
For MSG-SEVIRI Level-1.5 native (.nat) granules use read_seviri: it decodes
a VIS/IR channel's 10-bit packed counts, applies the granule's per-channel
Cal_Slope / Cal_Offset and the registry calibration, and returns the scene
north-up on the 3 km geostationary grid (validated on a real Meteosat-10
granule — see issue #40). parse_seviri_native is the underlying .nat decoder,
and a custom parse callable can still be injected.
For Himawari-8/9 AHI Himawari Standard Data (.DAT) granules use read_ahi: it
walks the 11 self-describing HSD header blocks, decodes the band's 16-bit counts,
applies the granule's own count-to-radiance slope / intercept, masks the error
(65535) and outside-scan (65534) sentinel counts, and returns the band north-up
on its geostationary grid. Calibration prefers the coefficients the granule
carries over the registry's nominal table: a solar band (1-6) uses the granule's
c' as its band solar irradiance, and a thermal band (7-16) inverts Planck's law
with the granule's own c / h / k and applies its quadratic
Tb = c0 + c1*Te + c2*Te^2 correction — which the registry's linear
alpha / beta form cannot express.
A granule names its own band, so band is optional and merely asserts the
expectation. A full disk ships as 10 segment files; pass the segment paths of one
band together and they are stitched by their block #7 first-line numbers, with a
gap or a duplicate reported rather than silently left blank. A contiguous
subset is accepted too and returns only the lines it covers, georeferenced
where they belong in the disk — so a partial download reads as the band of the
disk it actually covers; completeness is not required, only contiguity. A single
segment reads on its own the same way. .DAT.bz2 granules are decompressed
transparently.
The segments must come from one acquisition. Line numbers alone do not establish
that, because every timeline numbers its segments identically — two scenes ten
minutes apart would otherwise stitch into a seamless-looking image of two
different moments. read_ahi therefore checks the satellite, the observation
timeline and area, the declared segment count, and the projection block, and
refuses a mixed set.
Note it does not require the segments to share an observation start time. AHI scans the disk progressively, so each segment carries its own: on a real band-13 full disk, segments 1 and 10 start 526.0 s apart. The start times are only required to fall within an hour of each other, which separates the same timeline on different days without rejecting a legitimate scan.
from pyramids_eo.sensors.readers import read_ahi
# one segment, calibrated to brightness temperature
bt = read_ahi("HS_H08_20150415_0230_B13_FLDK_R20_S0101.DAT")
# a stitched full disk from its 10 segments
import glob
disk = read_ahi(sorted(glob.glob("HS_H08_20150415_0230_B13_FLDK_R20_S*.DAT")))
parse_ahi_hsd is the underlying decoder, returning uncalibrated radiance, and
parse_hsd_header exposes the granule's grid, projection and calibration without
reading its pixels.
Because HSD carries no per-granule solar irradiance for the reflective bands in a
form the registry can hold, ahi.yaml deliberately omits solar_irradiance: a
solar calibration attempted without a granule raises CalibrationError rather
than quietly using a value from elsewhere. See the table's own header for the
provenance of every constant in it.
One unit detail matters if you supply your own thermal coefficients or hand
read_ahi a Dataset you built yourself. HSD is micrometre-based throughout:
block #5 field 4 holds 10.4 for band 13 (not 1.04e-05), and the slope and
intercept of the same block give radiance per micrometre, W / (m2 sr um).
The registry's inverse Planck instead takes it per wavenumber,
mW / (m2 sr (cm-1)-1). read_ahi rebases between the two itself — by
L * wavelength_um**2 * 1e-1 — on every path that reaches the registry, so a
Dataset source and an explicit coeffs= both calibrate correctly.
The two bases differ by a factor of 1.5 (3.9 µm) to 17.7 (13.3 µm), which is the
dangerous part: skipping the rebasing yields a plausible temperature rather than
an obviously broken one — a 280 K scene reads as about 189 K. So a Dataset
holding radiance in some other unit will not be rescued here, and the error will
not announce itself: pass the granule, or convert before you call.
(If you are reading the specification alongside this: every text extraction of the
PDF loses its micro sign, so the wavelength and radiance units appear there as
[m] and W / (m2 sr m). Table 1 listing the bands as 0.47 to 13.3 is what
settles that they are micrometres.)
Sentinel-3: swath readers#
For Sentinel-3 .SEN3 granules use read_olci (OLCI L1B EFR / ERR) and
read_slstr (SLSTR L1 RBT). Both decode through pyramids' bundled GDAL NetCDF
driver — there is no netCDF4 dependency and nothing from the satpy stack — and
available_olci_channels(granule) lists the OLCI bands a granule carries.
These two differ from the geostationary readers above in three ways worth knowing:
-
They are swath instruments. A pushbroom sensor sweeps a curved strip of ground, so no affine geotransform can describe where the pixels are; the product instead ships a longitude and a latitude for every pixel. The results therefore carry a GDAL
GEOLOCATIONmetadata domain pointing at those arrays, a placeholder pixel/line geotransform, and no CRS.Sentinel-3 stores those arrays CF-packed as
int32micro-degrees, and GDAL's geolocation transformer reads geolocation arrays raw, without applyingscale_factor. The readers therefore point the domain at a small generated VRT that applies the packing, so the warp below receives real degrees rather than micro-degrees. The VRT is XML only — no geolocation array is read or copied until a warp pulls from it.
Nothing is resampled — a caller who wants a map grid warps on demand:
```python
from osgeo import gdal
from pyramids_eo.sensors.readers import read_olci
swath = read_olci("S3A_OL_1_EFR.SEN3", channel="Oa08")
swath.geotransform # the placeholder grid, not a geographic one
gdal.Warp("oa08.tif", swath.raster, geoloc=True) # user-driven reprojection
```
-
They decode only. Radiometric calibration choices are out of scope for these readers (issue #136), so
read_olcireturns radiance and does not convert to reflectance; a caller converting it should use the granule's own per-detectorsolar_fluxfrominstrument_data.nc. The SLSTR RBT product is already geophysical, soS7–S9/F1–F2arrive as brightness temperature in kelvin with no Planck conversion applied. -
SLSTR is dual-view and multi-grid. It images each scene twice, so
view="nadir"/"n"or"oblique"/"o"selects one.viewdefaults toNone, which is not a synonym for nadir: a channel name may spell the view itself ("S8_BT_io"), and a spelled view wins — nadir is the fallback only when neither the channel norview=names one. Its channels sit on different resolutions —S1–S6on the 500 magrid (withS4–S6also on the alternative 500 mb),S7–S9on the 1 kmigrid, and of the fire channelsF1onforiwhileF2isi-only — they are asymmetric, and there is noF2_BT_f*.nc, so anf-less granule still readsF1fromi.grid=restricts a read to one grid and never falls back to another, so an explicitgrid=can't quietly hand back a different resolution.available_slstr_channels(granule)reports what a granule carries on the grids of one view per call —view="nadir"unless you ask for"oblique"— which is how to discover a non-nominal layout. Because the grids differ in shape,channels=[...]returns adict[str, Dataset]of differently-sized arrays rather than a stack. -
OLCI comes as EFR or ERR. The two share every filename and variable name and differ only in pixel size (300 m against ~1200 m), so
read_olcidetects the product type from the granule name — falling back toxfdumanifest.xml— and reportsresolution_maccordingly. A granule that identifies itself as neither carries noresolution_mat all, rather than a figure that could be wrong by a factor of four. (Nothing in this package reads that key today —harmonisetakes an explicit reference grid — so it is provenance for a caller, not an input to the stack.)
A reader keyword passed through read_file as a KEY=VALUE list arrives as a
string, because Dataset.read_file normalises open_options to GDAL's form. The
drivers therefore translate the string spellings of a boolean
(false/true, yes/no, on/off, 1/0, case-insensitively) and reject a
string they do not recognise, instead of treating the truthy "false" as
switching the option on. A value that is not a string reaches the reader
untouched, so the dict form with a real False is the unambiguous way to write
it. Note that a channel set is a direct-call feature:
read_file requires one Dataset back, so use read_olci(..., channels=[...])
when you want several at once.
Himawari AHI (HSD) remains unimplemented: its byte-level layout comes from JMA's Himawari Standard Data User's Guide, which is needed before a correct decoder can be written (see issue #136).
pyramids_eo.sensors.readers
#
Instrument readers — the package entry points.
Each reader takes a file path / chunk set / Dataset and returns a pyramids
Dataset / DatasetCollection (or curvilinear equivalent).
read_fci— MTG-FCI L1C (FDHSI): stitch a channel (or several —channels=[...]returns adict) across its chunk set and calibrate to reflectance / brightness temperature.read_fci_l1c— decode + stitch + calibrate one channel or several (channels=[...]returns adict, opening each chunk once) across real MTG-FCI L1C FDHSI chunk files (packed radiance in nested groups, per-granule coefficients, geostationary grid).available_channels— list the VIS/IR channels present in FCI L1C FDHSI chunk(s).open_fci_l1c_chunk— lower-levelopen_chunkreading the FCI L1C FDHSI nesteddata/<channel>/measured/effective_radianceradiance for use withread_fci.read_ahi— Himawari-8/9 AHI Himawari Standard Data (.DAT): decode one band from a granule (or stitch its segment set) and calibrate to reflectance / brightness temperature on the geostationary grid, using the granule's own coefficients.parse_ahi_hsd— decode one HSD granule to a geolocated radianceDataset(the uncalibrated layer underread_ahi).parse_hsd_header/HsdHeader— decode the HSD header blocks from granule bytes the caller supplies, for the grid, projection and calibration without interpreting the pixels. It takes bytes rather than a path, so reading a granule's header alone means reading the file yourself;read_ahidoes that internally when it sizes a stitch.band_name/band_from_filename— AHI band keys (3 -> "B03"), and the band an HSD file name declares.read_seviri— MSG-SEVIRI Level-1.5 native (.nat): decode + calibrate + geolocate a VIS/IR channel (viaparse_seviri_native, or an injected parser).parse_seviri_native— decode one VIS/IR channel of an MSG Level-1.5 native.natgranule to a geolocated radianceDataset(the defaultread_seviriparser).read_olci— Sentinel-3 OLCI L1B (EFR / ERR): decode one radiance band (or several —channels=[...]returns adict) from a.SEN3granule onto its native swath grid, geolocated by a GDALGEOLOCATIONdomain.available_olci_channels— list the OLCI radiance bands a.SEN3granule carries.product_type— tell an OLCI granule's EFR / ERR product apart (Nonewhen the granule names neither, or both), which is what fixes its ground resolution.read_slstr— Sentinel-3 SLSTR L1 RBT: decode one channel (or several) for a chosenview(nadir / oblique) and grid, likewise swath-geolocated.available_slstr_channels— list the channels, and grids per channel, an SLSTR granule can actually be read for in one view.harmonise— align multi-resolution bands onto one common target grid.
The Sentinel-3 readers decode to arrays plus CF metadata only — radiometric
calibration choices stay with the caller (issue #136). Being swath instruments,
their results carry a GDAL GEOLOCATION domain over the granule's per-pixel
longitude / latitude arrays rather than an affine geotransform, and they resample
nothing.
HsdHeader
dataclass
#
The HSD header fields a read needs, decoded from one granule.
Attributes:
| Name | Type | Description |
|---|---|---|
satellite |
str
|
Satellite name from block #1, as the granule spells it --
|
band_number |
int
|
AHI band number, 1-16 (block #5). |
columns |
int
|
Pixels per line in this granule / segment (block #2). |
lines |
int
|
Lines in this granule / segment (block #2). |
bits_per_pixel |
int
|
Stored bit depth, always 16 for HSD (block #2). |
valid_bits |
int
|
Valid bits per pixel for the band — 11, 12 or 14 depending on
the band (block #5). Decoded and exposed, but deliberately not
applied: the reader does not clip or mask counts that exceed
|
compression |
int
|
Data-block compression flag — 0 none, 1 gzip, 2 bzip2. |
sub_lon |
float
|
Sub-satellite longitude, degrees east (block #3). |
cfac |
int
|
Column scaling factor of the normalised projection (block #3). |
lfac |
int
|
Line scaling factor of the normalised projection (block #3). |
coff |
float
|
Column offset — the sub-satellite column, 1-based (block #3). |
loff |
float
|
Line offset — the sub-satellite line, 1-based (block #3). |
rs_km |
float
|
Distance from the Earth's centre to the satellite (block #3). |
req_km |
float
|
Ellipsoid equatorial radius, WGS84 (block #3). |
rpol_km |
float
|
Ellipsoid polar radius, WGS84 (block #3). |
slope |
float
|
Count-to-radiance slope actually in force (block #5); the
calibrated (updated) value for a solar band when the granule
carries one. Only its magnitude is screened — a negative gain
decodes and is passed through (see :data: |
intercept |
float
|
Count-to-radiance intercept in force (block #5). |
error_count |
int
|
Count value marking an error pixel (block #5, 65535). |
outside_count |
int
|
Count value marking a pixel outside the scan area (block #5, 65534). |
central_wavelength_um |
float
|
Band central wavelength in micrometres
(block #5 field 4). HSD is micrometre-based throughout: the field
carries 10.4 for band 13, not 1.04e-05, and the slope / intercept
of the same block give radiance per micrometre. Every text
extraction of the specification PDF loses its micro sign -- the
whole document decodes to ASCII but for one multiplication sign --
so the unit renders as |
albedo_coefficient |
float | None
|
Solar bands only — |
planck_c0 |
float | None
|
Thermal bands only — constant term of the effective-to-
brightness-temperature correction; |
planck_c1 |
float | None
|
Thermal bands only — linear term, else |
planck_c2 |
float | None
|
Thermal bands only — quadratic term, else |
light_speed |
float | None
|
Thermal bands only — speed of light the granule was
calibrated with (m/s), else |
planck_constant |
float | None
|
Thermal bands only — Planck constant (J s), else |
boltzmann_constant |
float | None
|
Thermal bands only — Boltzmann constant (J/K), else
|
total_segments |
int
|
Number of segments the full image is split into (#7). |
segment_number |
int
|
This granule's segment sequence number (block #7). |
first_line |
int
|
1-based line of this segment within the full image (#7). |
observation_area |
str
|
Observation-area token from block #1 ( |
observation_timeline |
int
|
Observation timeline as |
observation_start_mjd |
float
|
Observation start time in Modified Julian Date
(block #1). Per segment, not per image: AHI scans the disk
progressively, so every segment of one acquisition carries its own.
Measured on a real band-13 full disk, segments 1 and 10 start 526.0 s
apart. It therefore does NOT identify an acquisition:
|
total_header_length |
int
|
Header length the granule declares (block #1), used to check the header walk rather than trusted blindly. |
total_data_length |
int
|
Pixel-payload length the granule declares (block #1). |
Examples:
- A decoded band-13 full-disk header reports its band, its radiometric
kind, and the satellite height the projection is built from:
>>> from pyramids_eo.sensors.readers.ahi import HsdHeader >>> header = HsdHeader( ... satellite="Himawari-8", band_number=13, columns=5500, lines=5500, ... bits_per_pixel=16, valid_bits=14, compression=0, sub_lon=140.7, ... cfac=20466275, lfac=20466275, coff=2750.5, loff=2750.5, ... rs_km=42164.0, req_km=6378.1370, rpol_km=6356.7523, ... slope=0.5, intercept=-10.0, error_count=65535, outside_count=65534, ... central_wavelength_um=10.4, albedo_coefficient=None, ... planck_c0=0.0, planck_c1=1.0, planck_c2=0.0, ... light_speed=299792458.0, planck_constant=6.62606957e-34, ... boltzmann_constant=1.3806488e-23, ... total_segments=10, segment_number=1, first_line=1, ... observation_area="FLDK", observation_timeline=230, ... observation_start_mjd=57127.1041666667, ... total_header_length=1598, total_data_length=60500000, ... ) >>> header.band 'B13' >>> header.kind 'thermal' >>> round(header.satellite_height_m) 35785863
Source code in src/pyramids_eo/sensors/readers/ahi.py
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 | |
band
property
#
Return the registry band key for this granule.
Returns:
| Type | Description |
|---|---|
str
|
The zero-padded |
str
|
both the bundled registry's channel key and the band field of the |
str
|
HSD file name (e.g. |
kind
property
#
Return the band's radiometric kind.
Returns:
| Type | Description |
|---|---|
str
|
|
str
|
same split the specification uses to decide which variant of |
str
|
calibration block #5 a granule carries. |
Examples:
- The split falls between bands 6 and 7, which is where the
specification switches block #5 from its visible / near-infrared
variant to its infrared one:
>>> import dataclasses >>> from pyramids_eo.sensors.readers.ahi import HsdHeader >>> header = HsdHeader( ... satellite="Himawari-8", band_number=13, columns=5500, lines=5500, ... bits_per_pixel=16, valid_bits=14, compression=0, sub_lon=140.7, ... cfac=20466275, lfac=20466275, coff=2750.5, loff=2750.5, ... rs_km=42164.0, req_km=6378.1370, rpol_km=6356.7523, ... slope=0.5, intercept=-10.0, error_count=65535, outside_count=65534, ... central_wavelength_um=10.4, albedo_coefficient=None, ... planck_c0=0.0, planck_c1=1.0, planck_c2=0.0, ... light_speed=299792458.0, planck_constant=6.62606957e-34, ... boltzmann_constant=1.3806488e-23, ... total_segments=10, segment_number=1, first_line=1, ... observation_area="FLDK", observation_timeline=230, ... observation_start_mjd=57127.1041666667, ... total_header_length=1598, total_data_length=60500000, ... ) >>> [dataclasses.replace(header, band_number=n).kind for n in (1, 6, 7, 16)] ['solar', 'solar', 'thermal', 'thermal']
satellite_height_m
property
#
Return the satellite height above the ellipsoid, in metres.
The projection block gives the distance from the Earth's centre; the geostationary CRS wants the perspective-point height above the equator, which is that distance less the equatorial radius.
Returns:
| Type | Description |
|---|---|
float
|
The perspective-point height in metres, derived from the granule's |
float
|
own |
band_from_filename(path)
#
Return the band key named by an HSD file name, when it follows Table 4.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Any
|
Path to an HSD granule. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The |
str | None
|
does not follow the HSD convention. |
Examples:
- A conventional name yields its band; anything else yields
None:
Source code in src/pyramids_eo/sensors/readers/ahi.py
band_name(number)
#
Return the registry channel key for an AHI band number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
int
|
Band number, 1-16. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The zero-padded |
str
|
the HSD file name (e.g. |
Examples:
- Band numbers are zero-padded to two digits:
Source code in src/pyramids_eo/sensors/readers/ahi.py
parse_ahi_hsd(path)
#
Decode one HSD granule to a geolocated radiance Dataset.
Reads the header, decodes the band's 16-bit counts, applies the granule's own count-to-radiance slope / intercept, masks the error and outside-scan sentinel counts to NaN, and registers the geostationary grid. A segment is georeferenced at its true place in the full image, so one segment reads on its own without being mistaken for the whole disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Any
|
Path to a Himawari Standard Data |
required |
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
per-micrometre-of-wavelength basis ( |
Any
|
geostationary grid, with the geostationary CRS and NaN nodata. |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When the file is not a readable HSD granule (see
:func: |
Source code in src/pyramids_eo/sensors/readers/ahi.py
parse_hsd_header(buffer)
#
Decode the HSD header blocks a read depends on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buffer
|
bytes
|
The granule bytes (already decompressed). |
required |
Returns:
| Type | Description |
|---|---|
HsdHeader
|
The decoded :class: |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When the granule is not recognisable HSD, a block is
truncated or mislabelled, block #1 contradicts the header walk, the
band number is out of range, the grid is empty, a solar band's
albedo coefficient is non-finite, or the count-to-radiance slope is
unusable — non-finite, or of a magnitude below :data: |
Source code in src/pyramids_eo/sensors/readers/ahi.py
read_ahi(source, band=None, *, sensor='ahi', calibrate=True, sun_earth_distance=1.0, cos_sza=None, coeffs=None)
#
Read one AHI band from Himawari Standard Data into a Dataset.
Decodes the band's counts to radiance with the granule's own calibration,
then — when calibrate is set — converts to a physical quantity: reflectance
for a solar band (1-6) and brightness temperature for a thermal one (7-16).
Both conversions prefer the coefficients the granule carries over the
registry's nominal table, so the result is granule-accurate.
Pass the segment paths of one band together to read a stitched full disk; pass one path to read that segment alone, georeferenced where it belongs in the disk. A contiguous subset of the segments is also accepted and returns just those lines, so a partial download reads as the band of the disk it actually covers rather than being padded out or refused. The segments must come from one acquisition — same band, satellite, observation timeline and area — since line numbers alone repeat across timelines. Their observation start times differ, one per segment, because the disk is scanned progressively; the timeline and area are what identify the acquisition, and because that pair recurs daily the start times are bounded to within an hour of each other rather than compared for equality.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
Path to an HSD |
required |
band
|
Any
|
The band to read ( |
None
|
sensor
|
str
|
Registry sensor name (default |
'ahi'
|
calibrate
|
bool
|
When |
True
|
sun_earth_distance
|
float
|
Sun-earth distance (AU) for solar-band reflectance.
The default |
1.0
|
cos_sza
|
Any
|
Cosine of the solar zenith angle for the reflectance sun-angle
correction, or |
None
|
coeffs
|
dict[str, Any] | None
|
Per-granule calibration coefficients preferred over both the
granule's own values and the registry (see
:func: |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
it carries the granule's own geostationary grid — the geostationary CRS, |
Any
|
a metre geotransform and NaN nodata. Read from a |
Any
|
keeps that dataset's geotransform, CRS and EPSG instead, since no HSD |
Any
|
header is available to rebuild a grid from; only the values change. |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When |
CalibrationError
|
When a band lacks the constants its kind needs. |
UnknownSensorError
|
When the sensor / band is not in the registry. |
Source code in src/pyramids_eo/sensors/readers/ahi.py
1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 | |
open_fci_l1c_chunk(path, channel, *, radiance_group=_FCI_RADIANCE_GROUP)
#
Open one real FCI L1C FDHSI chunk from its nested group layout.
Unlike _default_open_chunk (which assumes a flat variable named like the
channel), this reads the radiance from the nested group path a real FCI L1C
FDHSI chunk uses — by default data/<channel>/measured/effective_radiance —
through pyramids' group-qualified NetCDF.get_variable, which navigates the
/-separated group path. Pass it to read_fci as open_chunk for real
granules:
from pyramids_eo.sensors.readers import open_fci_l1c_chunk, read_fci
scene = read_fci(chunk_paths, "ir_105", open_chunk=open_fci_l1c_chunk)
Warning
The nested group path matches the documented FDHSI layout, but has not
been validated byte-for-byte against a real EUMETSAT granule, and this
opener does not (yet) extract the per-granule calibration coefficients
from the chunk's group attributes — supply them via
read_fci(..., coeffs=...) or rely on the registry fallback. See issue
40.#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Any
|
Path to a single FCI L1C FDHSI chunk NetCDF file. |
required |
channel
|
str
|
Channel identifier (e.g. |
required |
radiance_group
|
str
|
Group-qualified variable-name template with a single
|
_FCI_RADIANCE_GROUP
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
(a |
Any
|
|
Source code in src/pyramids_eo/sensors/readers/fci.py
read_fci(chunks, channel=None, *, channels=None, sensor='fci', calibrate=True, sun_earth_distance=1.0, cos_sza=None, coeffs=None, open_chunk=None)
#
Read one or several FCI channels across a chunk set into Datasets.
For each requested channel, orders the chunks north -> south by their top-left
latitude (so the caller may pass them in any order), stitches the radiance
row-wise, calibrates it to reflectance (solar) or brightness temperature
(thermal), and returns a geolocated pyramids Dataset carrying the
northernmost chunk's CRS + geotransform. The chunks must share a CRS, cell
size and column count and be vertically contiguous (validated per channel,
since channels differ in resolution).
Pass exactly one of channel (returns a Dataset) or channels (returns a
dict[str, Dataset]); read_fci(chunks, "ir_105") is unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chunks
|
Any
|
An ordered iterable of chunks, each either a pyramids |
required |
channel
|
str | None
|
A single channel identifier (e.g. |
None
|
channels
|
Sequence[str] | None
|
A sequence of channel identifiers for a |
None
|
sensor
|
str
|
Registry sensor name (default |
'fci'
|
calibrate
|
bool
|
When |
True
|
sun_earth_distance
|
float
|
Sun-earth distance (AU) for solar-channel reflectance. |
1.0
|
cos_sza
|
Any
|
Cosine of the solar zenith angle for the reflectance sun-angle
correction, or |
None
|
coeffs
|
dict[str, Any] | None
|
Per-granule calibration coefficients preferred over the registry
fallback (see |
None
|
open_chunk
|
Any
|
Callable |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
channel (for |
Any
|
stitched grid. |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When neither / both of |
CalibrationError
|
When a channel lacks the constants its kind needs. |
UnknownSensorError
|
When the sensor / channel is not in the registry. |
Source code in src/pyramids_eo/sensors/readers/fci.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
available_channels(chunks)
#
List the VIS/IR channels present across FCI L1C FDHSI chunk file(s).
Opens each chunk's multidimensional dataset and reports the data/<channel>
groups that carry an effective_radiance array, so a caller can discover the
channel names instead of hard-coding them. The union across chunks is returned
(a trailer chunk contributes none), sorted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chunks
|
Any
|
A single chunk path, or an iterable of chunk paths. (For
convenience this discovery helper also accepts a lone path, whereas
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
The sorted channel identifiers available in the chunk(s). |
Source code in src/pyramids_eo/sensors/readers/fci_l1c.py
read_fci_l1c(paths, channel=None, *, channels=None, calibrate=True, sun_earth_distance=1.0, cos_sza=None)
#
Read one or several channels across a set of real FCI L1C FDHSI chunks.
Decodes each chunk once for the whole requested channel set
(read_fci_l1c_chunks opens the chunk's structure a single time), drops chunks
without a channel's radiance (e.g. CHK-TRAIL), then for each channel orders
the chunks north -> south by their geotransform Y origin, checks they are
vertically contiguous (and share a grid), stitches the radiance, and calibrates
it with the per-granule coefficients (reflectance for a solar channel,
brightness temperature for a thermal one). Each result is a geolocated pyramids
Dataset on the granule's geostationary grid (metre geotransform reconstructed
from the angular grid and the CRS satellite height, with its x axis reconciled
to the CRS so a warp is not mirrored east-west — issue #56).
Pass exactly one of channel (returns a Dataset) or channels (returns a
dict[str, Dataset]); read_fci_l1c(paths, "ir_105") is unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paths
|
Any
|
Iterable of FCI L1C FDHSI chunk file paths (any order; trailer / non-imagery chunks are skipped). |
required |
channel
|
str | None
|
A single channel identifier (e.g. |
None
|
channels
|
Sequence[str] | None
|
A sequence of channel identifiers for a |
None
|
calibrate
|
bool
|
When |
True
|
sun_earth_distance
|
float
|
Sun-earth distance (AU) for solar-channel reflectance.
The default |
1.0
|
cos_sza
|
Any
|
Cosine of the solar zenith angle for the reflectance sun-angle
correction, or |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
channel (for |
Any
|
stitched geostationary grid, with NaN nodata and the geostationary CRS. |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When neither / both of |
CalibrationError
|
When a channel lacks the constants its kind needs. |
UnknownSensorError
|
When a channel is not in the registry. |
Source code in src/pyramids_eo/sensors/readers/fci_l1c.py
available_olci_channels(source)
#
List the OLCI radiance bands a granule actually carries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
The canonical channel names present, sorted ( |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When |
Source code in src/pyramids_eo/sensors/readers/olci.py
product_type(granule)
#
Detect whether a granule is the full- or reduced-resolution OLCI product.
EFR and ERR granules hold the same OaNN_radiance.nc filenames and the
same variable names, so the product type -- and therefore the ground
resolution, 300 m against ~1200 m -- is only knowable from the granule's own
naming or its manifest. Both are checked -- the name first, then
xfdumanifest.xml -- and None means neither identified the product, in
which case the reader reports no resolution rather than asserting a wrong one.
An ambiguous source is treated exactly like a silent one: a text carrying
both tokens yields None rather than the first match, because an ERR granule
routinely references the EFR product it was derived from, so preferring either
one would be a guess (see _product_tokens).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
granule
|
Path
|
The |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
|
str | None
|
and equally when it names both products. |
Examples:
- A standard product name identifies itself, so no file access is needed:
- A granule that names neither, and carries no manifest saying so, yields
None-- which is what makes the reader omitresolution_mrather than guess it: - A name claiming both products is ambiguous, so it too yields
Nonerather than the first token found:
Source code in src/pyramids_eo/sensors/readers/olci.py
read_olci(source, channel=None, *, channels=None, geolocation=True)
#
Read one or several OLCI L1B radiance bands from a .SEN3 granule.
Decodes each requested band's packed OaNN_radiance variable (raw *
scale_factor + add_offset, with the _FillValue and anything outside the
variable's validity limits masked to NaN) and returns it as a swath Dataset
carrying the granule's per-pixel geolocation as a GDAL GEOLOCATION domain.
The limits come from the valid_min / valid_max scalars the OLCI L1
specification carries -- not from a combined valid_range, which appears
nowhere in it -- and are compared against the raw, still-packed values.
Pass exactly one of channel (returns a Dataset) or channels (returns a
dict[str, Dataset] keyed by canonical channel name).
This reader decodes only -- it does not convert radiance to reflectance
(issue #136 scopes radiometric calibration choices out). The granule's
instrument_data.nc carries the per-detector solar_flux a caller needs for
that conversion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The |
required |
channel
|
str | None
|
A single band ( |
None
|
channels
|
Sequence[str] | None
|
A sequence of bands for a |
None
|
geolocation
|
bool
|
When |
True
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
|
Raises:
| Type | Description |
|---|---|
ReaderError
|
When neither / both of |
Note
A _FillValue that is not a finite number cannot mask anything, so the
decode emits a UserWarning per affected band and the result's nodata is
incomplete rather than the read failing (see invalid_mask).
Source code in src/pyramids_eo/sensors/readers/olci.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | |
parse_seviri_native(path, channel, *, subsatellite_longitude=0.0)
#
Decode one VIS/IR channel of an MSG Level-1.5 native (.nat) granule.
Reads the segment table and the fixed-layout 15Header (reference grid,
grid step and the per-granule calibration), then unpacks the channel's 10-bit
counts from every image line record, applies the granule Cal_Slope /
Cal_Offset to get radiance, masks the zero-count (off-earth) corners to
NaN, and orients the scene north-up / west-left. Only the image lines
actually present are read, so a header-preserved subset (whose header still
declares the full disk) decodes correctly rather than reading past end-of-file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Any
|
Path to an MSG SEVIRI Level-1.5 native |
required |
channel
|
str
|
A VIS/IR channel identifier (e.g. |
required |
subsatellite_longitude
|
float
|
Sub-satellite longitude (degrees east) for the
geostationary CRS. Defaults to |
0.0
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
grid, with the geostationary CRS, a metre geotransform, and NaN nodata. |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When the channel is unknown / HRV, the file is not a
recognised MSG Level-1.5 native granule (no segment table, or the
|
Source code in src/pyramids_eo/sensors/readers/seviri.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
read_seviri(source, channel, *, sensor='seviri', calibrate=True, sun_earth_distance=1.0, cos_sza=None, coeffs=None, parse=None, subsatellite_longitude=0.0)
#
Read one SEVIRI channel into a calibrated, geolocated Dataset.
Decodes the channel radiance (from a .nat granule via parse, or straight
from a Dataset source), then calibrates it to reflectance (solar) or
brightness temperature (thermal) via the registry and returns a pyramids
Dataset carrying the source's CRS + geotransform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
A path to an MSG Level-1.5 native |
required |
channel
|
str
|
Channel identifier (e.g. |
required |
sensor
|
str
|
Registry sensor name (default |
'seviri'
|
calibrate
|
bool
|
When |
True
|
sun_earth_distance
|
float
|
Sun-earth distance (AU) for solar-channel reflectance.
The default |
1.0
|
cos_sza
|
Any
|
Cosine of the solar zenith angle for the reflectance sun-angle
correction, or |
None
|
coeffs
|
dict[str, Any] | None
|
Per-granule calibration coefficients preferred over the registry
fallback (see |
None
|
parse
|
Any
|
Callable |
None
|
subsatellite_longitude
|
float
|
Sub-satellite longitude (degrees east) passed to
the default native parser for the geostationary CRS (default |
0.0
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When |
CalibrationError
|
When a channel lacks the constants its kind needs. |
UnknownSensorError
|
When the sensor / channel is not in the registry. |
Source code in src/pyramids_eo/sensors/readers/seviri.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | |
available_slstr_channels(source, *, view='nadir')
#
Report which channels a granule carries in one view, and on which grids.
This is how a caller discovers a product's real layout rather than assuming
it -- including that F2 lives on the 1 km i grid while F1 is on f, and
which of S4-S6 are duplicated onto the alternative 500 m b grid.
A grid is listed only when the granule holds both the measurement file and
the geodetic_<grid><view>.nc the measurement needs, so what this reports is
what read_slstr can actually return -- a measurement whose annotation file is
missing would raise there, and listing it would promise a read that fails. A
granule stripped of its geodetic files therefore reports {} even though the
measurement files are all present.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The |
required |
view
|
str
|
|
'nadir'
|
Returns:
| Type | Description |
|---|---|
dict[str, list[str]]
|
A |
dict[str, list[str]]
|
holds a measurement and a matching geodetic file for, in the product's |
dict[str, list[str]]
|
own channel order -- |
dict[str, list[str]]
|
alphabetical order the error messages use. Each channel's grid letters are |
dict[str, list[str]]
|
likewise in the order |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When |
Source code in src/pyramids_eo/sensors/readers/slstr.py
read_slstr(source, channel=None, *, channels=None, view=None, grid=None, geolocation=True)
#
Read one or several SLSTR L1 RBT channels from a .SEN3 granule.
Decodes each requested channel's packed variable (raw * scale_factor +
add_offset, with the _FillValue and anything outside the variable's
validity limits masked to NaN) and returns it as a swath Dataset carrying
the matching grid's per-pixel geolocation as a GDAL GEOLOCATION domain. The
limits come from the valid_min / valid_max scalars the SLSTR L1
specification carries -- not from a combined valid_range, which appears
nowhere in it -- and are compared against the raw, still-packed values.
Pass exactly one of channel (returns a Dataset) or channels (returns a
dict[str, Dataset]). Channels on different grids have different array
shapes, which is why a channel set returns a dict rather than a stack.
Either may also be given in the product's own variable spelling
("S5_radiance_bn"), and the grid and view it carries then select the
file: they are honoured, not merely tolerated. So a channel set may mix views
and grids per channel -- channels=["S5_radiance_an", "S8_BT_io"] reads one
nadir and one oblique -- while view= / grid= supply whatever a bare
spelling leaves open. A spelling that contradicts an explicit view= / grid=
is an error rather than one of the two being silently ignored.
This reader decodes only -- issue #136 scopes radiometric calibration
choices out. The RBT product is already geophysical, so S7-S9 / F1-F2
arrive as brightness temperature in kelvin with no conversion applied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The |
required |
channel
|
str | None
|
A single channel ( |
None
|
channels
|
Sequence[str] | None
|
A sequence of channels for a |
None
|
view
|
str | None
|
|
None
|
grid
|
str | None
|
An explicit grid letter ( |
None
|
geolocation
|
bool
|
When |
True
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
|
Raises:
| Type | Description |
|---|---|
ReaderError
|
When neither / both of |
Note
A _FillValue that is not a finite number cannot mask anything, so the
decode emits a UserWarning per affected channel and the result's nodata
is incomplete rather than the read failing (see invalid_mask).
Source code in src/pyramids_eo/sensors/readers/slstr.py
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | |
pyramids_eo.sensors.readers.fci_l1c
#
Real MTG-FCI L1C FDHSI granule reader.
read_fci_l1c decodes and stitches one channel — or several in a single pass
(channels=[...] returns a dict, reading each chunk's structure and
coefficients once for the whole set) — across the real FCI L1C FDHSI chunk files
of a repeat cycle, and available_channels lists which channels a chunk carries.
Unlike the generic read_fci (which stitches already-opened radiance
Datasets), this reads the actual granule layout:
- the packed
uint16radiance from the nested groupdata/<channel>/measured/effective_radiance, unpacked to physical radiance via the variable'sscale_factor/add_offsetand masked by itsvalid_range/_FillValue; - the per-granule calibration coefficients carried as sibling variables in
the same group (
radiance_to_bt_conversion_coefficient_a/_b/_wavenumberfor thermal channels,channel_effective_solar_irradiancefor solar ones), preferred over the nominal registry table; - the chunks are ordered and stitched by their geostationary geotransform Y
origin (FCI's
start_position_rowruns opposite to the geospatial Y, so it is read as metadata but is not the stitch key); a chunk that carries no radiance for the channel — e.g. theCHK-TRAILtrailer — is skipped.
The granule stores the grid in geostationary angular (radian) coordinates with
a metre geostationary CRS; the metre geotransform is reconstructed as
angular_geotransform * satellite_height (from the CRS +h). This addresses the
axis-unit mismatch behind pyramids #706 by keeping the CRS explicit rather than
letting it be misread as lon/lat. FCI's x is a scanning azimuth angle whose sign
runs opposite to PROJ's geostationary x (which increases eastward), so the scaled
x pixel width comes out negative with its origin on the eastern limb; the reader
reconciles it to the CRS — re-anchoring the origin on the western limb with a
positive x width, the array left untouched — so a warped scene is not mirrored
east-west (issue #56).
Validated against real MTI1/Meteosat-12 FDHSI chunks (see issue #40): ir_105
stitches to brightness temperature in the expected range on the geostationary
grid. The reader uses GDAL (already vendored by pyramids) to read the nested
groups and scalar variables — no extra dependency.
read_fci_l1c(paths, channel=None, *, channels=None, calibrate=True, sun_earth_distance=1.0, cos_sza=None)
#
Read one or several channels across a set of real FCI L1C FDHSI chunks.
Decodes each chunk once for the whole requested channel set
(read_fci_l1c_chunks opens the chunk's structure a single time), drops chunks
without a channel's radiance (e.g. CHK-TRAIL), then for each channel orders
the chunks north -> south by their geotransform Y origin, checks they are
vertically contiguous (and share a grid), stitches the radiance, and calibrates
it with the per-granule coefficients (reflectance for a solar channel,
brightness temperature for a thermal one). Each result is a geolocated pyramids
Dataset on the granule's geostationary grid (metre geotransform reconstructed
from the angular grid and the CRS satellite height, with its x axis reconciled
to the CRS so a warp is not mirrored east-west — issue #56).
Pass exactly one of channel (returns a Dataset) or channels (returns a
dict[str, Dataset]); read_fci_l1c(paths, "ir_105") is unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paths
|
Any
|
Iterable of FCI L1C FDHSI chunk file paths (any order; trailer / non-imagery chunks are skipped). |
required |
channel
|
str | None
|
A single channel identifier (e.g. |
None
|
channels
|
Sequence[str] | None
|
A sequence of channel identifiers for a |
None
|
calibrate
|
bool
|
When |
True
|
sun_earth_distance
|
float
|
Sun-earth distance (AU) for solar-channel reflectance.
The default |
1.0
|
cos_sza
|
Any
|
Cosine of the solar zenith angle for the reflectance sun-angle
correction, or |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
channel (for |
Any
|
stitched geostationary grid, with NaN nodata and the geostationary CRS. |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When neither / both of |
CalibrationError
|
When a channel lacks the constants its kind needs. |
UnknownSensorError
|
When a channel is not in the registry. |
Source code in src/pyramids_eo/sensors/readers/fci_l1c.py
available_channels(chunks)
#
List the VIS/IR channels present across FCI L1C FDHSI chunk file(s).
Opens each chunk's multidimensional dataset and reports the data/<channel>
groups that carry an effective_radiance array, so a caller can discover the
channel names instead of hard-coding them. The union across chunks is returned
(a trailer chunk contributes none), sorted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chunks
|
Any
|
A single chunk path, or an iterable of chunk paths. (For
convenience this discovery helper also accepts a lone path, whereas
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
The sorted channel identifiers available in the chunk(s). |
Source code in src/pyramids_eo/sensors/readers/fci_l1c.py
pyramids_eo.sensors.readers.fci
#
MTG-FCI L1C (FDHSI) reader.
read_fci stitches a channel across the ~40 NetCDF chunks of one FCI repeat
cycle, calibrates the raw radiance to reflectance / brightness temperature via
the sensor registry, and returns a geolocated pyramids Dataset ready for
to_crs / warped_view.
Warning
The zero-config default (_default_open_chunk) assumes each chunk exposes
the requested channel's radiance as a NetCDF variable named like the
channel. Real FCI L1C FDHSI stores radiance in nested groups
(data/<channel>/measured/effective_radiance) with the calibration
coefficients in group attributes — for those granules pass
open_fci_l1c_chunk (which reads that nested layout) as open_chunk, plus
the coefficients via coeffs. The stitch + calibrate + geolocate logic is
unit-tested on synthetic chunks, and open_fci_l1c_chunk is unit-tested for
its group-path resolution, but the exact FCI variable layout and the
per-granule coefficient attributes still need validation against a real
granule (see issue #40).
open_fci_l1c_chunk(path, channel, *, radiance_group=_FCI_RADIANCE_GROUP)
#
Open one real FCI L1C FDHSI chunk from its nested group layout.
Unlike _default_open_chunk (which assumes a flat variable named like the
channel), this reads the radiance from the nested group path a real FCI L1C
FDHSI chunk uses — by default data/<channel>/measured/effective_radiance —
through pyramids' group-qualified NetCDF.get_variable, which navigates the
/-separated group path. Pass it to read_fci as open_chunk for real
granules:
from pyramids_eo.sensors.readers import open_fci_l1c_chunk, read_fci
scene = read_fci(chunk_paths, "ir_105", open_chunk=open_fci_l1c_chunk)
Warning
The nested group path matches the documented FDHSI layout, but has not
been validated byte-for-byte against a real EUMETSAT granule, and this
opener does not (yet) extract the per-granule calibration coefficients
from the chunk's group attributes — supply them via
read_fci(..., coeffs=...) or rely on the registry fallback. See issue
40.#
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Any
|
Path to a single FCI L1C FDHSI chunk NetCDF file. |
required |
channel
|
str
|
Channel identifier (e.g. |
required |
radiance_group
|
str
|
Group-qualified variable-name template with a single
|
_FCI_RADIANCE_GROUP
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
(a |
Any
|
|
Source code in src/pyramids_eo/sensors/readers/fci.py
read_fci(chunks, channel=None, *, channels=None, sensor='fci', calibrate=True, sun_earth_distance=1.0, cos_sza=None, coeffs=None, open_chunk=None)
#
Read one or several FCI channels across a chunk set into Datasets.
For each requested channel, orders the chunks north -> south by their top-left
latitude (so the caller may pass them in any order), stitches the radiance
row-wise, calibrates it to reflectance (solar) or brightness temperature
(thermal), and returns a geolocated pyramids Dataset carrying the
northernmost chunk's CRS + geotransform. The chunks must share a CRS, cell
size and column count and be vertically contiguous (validated per channel,
since channels differ in resolution).
Pass exactly one of channel (returns a Dataset) or channels (returns a
dict[str, Dataset]); read_fci(chunks, "ir_105") is unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chunks
|
Any
|
An ordered iterable of chunks, each either a pyramids |
required |
channel
|
str | None
|
A single channel identifier (e.g. |
None
|
channels
|
Sequence[str] | None
|
A sequence of channel identifiers for a |
None
|
sensor
|
str
|
Registry sensor name (default |
'fci'
|
calibrate
|
bool
|
When |
True
|
sun_earth_distance
|
float
|
Sun-earth distance (AU) for solar-channel reflectance. |
1.0
|
cos_sza
|
Any
|
Cosine of the solar zenith angle for the reflectance sun-angle
correction, or |
None
|
coeffs
|
dict[str, Any] | None
|
Per-granule calibration coefficients preferred over the registry
fallback (see |
None
|
open_chunk
|
Any
|
Callable |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
channel (for |
Any
|
stitched grid. |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When neither / both of |
CalibrationError
|
When a channel lacks the constants its kind needs. |
UnknownSensorError
|
When the sensor / channel is not in the registry. |
Source code in src/pyramids_eo/sensors/readers/fci.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
pyramids_eo.sensors.readers.seviri
#
MSG-SEVIRI Level-1.5 native (.nat) reader.
read_seviri decodes one SEVIRI VIS/IR channel from a real MSG Level-1.5 native
(.nat) granule and returns a calibrated, geolocated pyramids Dataset
(reflectance for a solar channel, brightness temperature for a thermal one).
The .nat format is a packed binary: an ASCII Main/Secondary Product Header
carrying the segment table, a fixed-layout binary 15Header (the Level-1.5
prologue, with the per-granule calibration and the reference grid), then the
15Data image records — one record per scan line, holding a 65-byte side-info
header plus 10-bit packed counts for each selected channel in turn (the 11
VIS/IR channels first, then HRV). parse_seviri_native reads the segment table
and the 15Header, then for the requested channel unpacks the counts, applies
the granule's Cal_Slope / Cal_Offset to get radiance, masks the
off-earth (zero-count) corners, and orients the scene north-up / west-left (the
grid origin is South-East). read_seviri then calibrates that radiance via the
sensor registry.
Validated against a real Meteosat-10 (MSG3) full-disk granule (see issue #40):
IR_108 decodes to brightness temperature in the expected range on the 3 km
geostationary grid. HRV (a different, higher-resolution geometry) is out of
scope.
parse_seviri_native(path, channel, *, subsatellite_longitude=0.0)
#
Decode one VIS/IR channel of an MSG Level-1.5 native (.nat) granule.
Reads the segment table and the fixed-layout 15Header (reference grid,
grid step and the per-granule calibration), then unpacks the channel's 10-bit
counts from every image line record, applies the granule Cal_Slope /
Cal_Offset to get radiance, masks the zero-count (off-earth) corners to
NaN, and orients the scene north-up / west-left. Only the image lines
actually present are read, so a header-preserved subset (whose header still
declares the full disk) decodes correctly rather than reading past end-of-file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Any
|
Path to an MSG SEVIRI Level-1.5 native |
required |
channel
|
str
|
A VIS/IR channel identifier (e.g. |
required |
subsatellite_longitude
|
float
|
Sub-satellite longitude (degrees east) for the
geostationary CRS. Defaults to |
0.0
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
grid, with the geostationary CRS, a metre geotransform, and NaN nodata. |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When the channel is unknown / HRV, the file is not a
recognised MSG Level-1.5 native granule (no segment table, or the
|
Source code in src/pyramids_eo/sensors/readers/seviri.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
read_seviri(source, channel, *, sensor='seviri', calibrate=True, sun_earth_distance=1.0, cos_sza=None, coeffs=None, parse=None, subsatellite_longitude=0.0)
#
Read one SEVIRI channel into a calibrated, geolocated Dataset.
Decodes the channel radiance (from a .nat granule via parse, or straight
from a Dataset source), then calibrates it to reflectance (solar) or
brightness temperature (thermal) via the registry and returns a pyramids
Dataset carrying the source's CRS + geotransform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
A path to an MSG Level-1.5 native |
required |
channel
|
str
|
Channel identifier (e.g. |
required |
sensor
|
str
|
Registry sensor name (default |
'seviri'
|
calibrate
|
bool
|
When |
True
|
sun_earth_distance
|
float
|
Sun-earth distance (AU) for solar-channel reflectance.
The default |
1.0
|
cos_sza
|
Any
|
Cosine of the solar zenith angle for the reflectance sun-angle
correction, or |
None
|
coeffs
|
dict[str, Any] | None
|
Per-granule calibration coefficients preferred over the registry
fallback (see |
None
|
parse
|
Any
|
Callable |
None
|
subsatellite_longitude
|
float
|
Sub-satellite longitude (degrees east) passed to
the default native parser for the geostationary CRS (default |
0.0
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When |
CalibrationError
|
When a channel lacks the constants its kind needs. |
UnknownSensorError
|
When the sensor / channel is not in the registry. |
Source code in src/pyramids_eo/sensors/readers/seviri.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | |
pyramids_eo.sensors.readers.olci
#
Sentinel-3 OLCI Level-1B (EFR / ERR) reader -- native, satpy-free.
read_olci(granule, channel="Oa08") decodes one OLCI radiance band (or several
via channels=[...]) out of a .SEN3 granule into a pyramids Dataset, through
pyramids' bundled GDAL NetCDF driver. No netCDF4, and nothing from the satpy
stack.
OLCI is a pushbroom swath instrument, so the result carries its geolocation
as a GDAL GEOLOCATION domain pointing at the granule's per-pixel
geo_coordinates.nc longitude / latitude arrays -- not an affine geotransform,
which cannot describe a swath. The reader resamples nothing; a caller who wants a
map grid warps the result themselves (gdal.Warp(..., geoloc=True)).
Per issue #136 this decodes to arrays plus standard CF metadata only:
radiometric calibration choices (radiance -> reflectance) stay with the callers
and the composites tier, and the granule's own instrument_data.nc carries the
solar_flux needed for that conversion.
available_olci_channels(source)
#
List the OLCI radiance bands a granule actually carries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
The canonical channel names present, sorted ( |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When |
Source code in src/pyramids_eo/sensors/readers/olci.py
product_type(granule)
#
Detect whether a granule is the full- or reduced-resolution OLCI product.
EFR and ERR granules hold the same OaNN_radiance.nc filenames and the
same variable names, so the product type -- and therefore the ground
resolution, 300 m against ~1200 m -- is only knowable from the granule's own
naming or its manifest. Both are checked -- the name first, then
xfdumanifest.xml -- and None means neither identified the product, in
which case the reader reports no resolution rather than asserting a wrong one.
An ambiguous source is treated exactly like a silent one: a text carrying
both tokens yields None rather than the first match, because an ERR granule
routinely references the EFR product it was derived from, so preferring either
one would be a guess (see _product_tokens).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
granule
|
Path
|
The |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
|
str | None
|
and equally when it names both products. |
Examples:
- A standard product name identifies itself, so no file access is needed:
- A granule that names neither, and carries no manifest saying so, yields
None-- which is what makes the reader omitresolution_mrather than guess it: - A name claiming both products is ambiguous, so it too yields
Nonerather than the first token found:
Source code in src/pyramids_eo/sensors/readers/olci.py
read_olci_band(source, channel, *, geolocation=True)
#
Decode a single OLCI radiance band from a .SEN3 granule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The |
required |
channel
|
Any
|
The band to read ( |
required |
geolocation
|
bool
|
When |
True
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
flags a fill / out-of-range pixel, with CF metadata and (by default) the |
Any
|
swath |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When the channel name is not an OLCI band, the granule has
no such band file, or the variable cannot be decoded. With
|
Note
A _FillValue that is not a finite number cannot mask anything, so the
decode emits a UserWarning and the result's nodata is incomplete rather
than the read failing (see invalid_mask).
Source code in src/pyramids_eo/sensors/readers/olci.py
read_olci(source, channel=None, *, channels=None, geolocation=True)
#
Read one or several OLCI L1B radiance bands from a .SEN3 granule.
Decodes each requested band's packed OaNN_radiance variable (raw *
scale_factor + add_offset, with the _FillValue and anything outside the
variable's validity limits masked to NaN) and returns it as a swath Dataset
carrying the granule's per-pixel geolocation as a GDAL GEOLOCATION domain.
The limits come from the valid_min / valid_max scalars the OLCI L1
specification carries -- not from a combined valid_range, which appears
nowhere in it -- and are compared against the raw, still-packed values.
Pass exactly one of channel (returns a Dataset) or channels (returns a
dict[str, Dataset] keyed by canonical channel name).
This reader decodes only -- it does not convert radiance to reflectance
(issue #136 scopes radiometric calibration choices out). The granule's
instrument_data.nc carries the per-detector solar_flux a caller needs for
that conversion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The |
required |
channel
|
str | None
|
A single band ( |
None
|
channels
|
Sequence[str] | None
|
A sequence of bands for a |
None
|
geolocation
|
bool
|
When |
True
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
|
Raises:
| Type | Description |
|---|---|
ReaderError
|
When neither / both of |
Note
A _FillValue that is not a finite number cannot mask anything, so the
decode emits a UserWarning per affected band and the result's nodata is
incomplete rather than the read failing (see invalid_mask).
Source code in src/pyramids_eo/sensors/readers/olci.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | |
pyramids_eo.sensors.readers.slstr
#
Sentinel-3 SLSTR Level-1 RBT reader -- native, satpy-free.
read_slstr(granule, channel="S5") decodes one SLSTR channel (or several via
channels=[...]) out of a .SEN3 granule into a pyramids Dataset, through
pyramids' bundled GDAL NetCDF driver. No netCDF4, and nothing from the satpy
stack.
SLSTR is dual-view and multi-grid, which drives this reader's two extra arguments:
view-- the instrument images each scene twice,"nadir"(straight down) and"oblique"(slanted, ~55 deg forward). Each view is a separate grid.grid-- channels live on different resolutions: the solar channelsS1-S6on the 500 magrid (withS4-S6duplicated onto the alternative 500 mb), the thermalS7-S9on the 1 kmigrid, and of the fire channelsF1on the 1 kmfgrid butF2oni-- they are asymmetric, and there is noF2_BT_f*.nc.read_slstrtries each channel's documented grids in order (F1falls back toifor products predating thefbaseline), andgrid=restricts the read to one grid.available_slstr_channelsreports what a particular granule actually carries.
Because the grids differ in shape, a multi-channel read returns a dict rather
than a stack -- channels=["S5", "S8"] yields arrays of different sizes.
Like OLCI, SLSTR is a swath instrument, so a result carries its geolocation as a
GDAL GEOLOCATION domain over the matching geodetic_* annotation file rather
than an affine geotransform, and this reader resamples nothing.
Per issue #136 this decodes to arrays plus standard CF metadata only. Note the
RBT product is already geophysical: S1-S6 are radiances and S7-S9 /
F1-F2 are brightness temperatures in kelvin as shipped, so no Planck
conversion is applied (or needed) here.
available_slstr_channels(source, *, view='nadir')
#
Report which channels a granule carries in one view, and on which grids.
This is how a caller discovers a product's real layout rather than assuming
it -- including that F2 lives on the 1 km i grid while F1 is on f, and
which of S4-S6 are duplicated onto the alternative 500 m b grid.
A grid is listed only when the granule holds both the measurement file and
the geodetic_<grid><view>.nc the measurement needs, so what this reports is
what read_slstr can actually return -- a measurement whose annotation file is
missing would raise there, and listing it would promise a read that fails. A
granule stripped of its geodetic files therefore reports {} even though the
measurement files are all present.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The |
required |
view
|
str
|
|
'nadir'
|
Returns:
| Type | Description |
|---|---|
dict[str, list[str]]
|
A |
dict[str, list[str]]
|
holds a measurement and a matching geodetic file for, in the product's |
dict[str, list[str]]
|
own channel order -- |
dict[str, list[str]]
|
alphabetical order the error messages use. Each channel's grid letters are |
dict[str, list[str]]
|
likewise in the order |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When |
Source code in src/pyramids_eo/sensors/readers/slstr.py
read_slstr_band(source, channel, *, view=None, grid=None, geolocation=True)
#
Decode a single SLSTR channel from a .SEN3 granule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The |
required |
channel
|
Any
|
The channel to read ( |
required |
view
|
str | None
|
|
None
|
grid
|
str | None
|
An explicit grid letter ( |
None
|
geolocation
|
bool
|
When |
True
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
temperature in kelvin for |
Any
|
flags a fill / out-of-range pixel, with CF metadata and (by default) the |
Any
|
swath |
Raises:
| Type | Description |
|---|---|
ReaderError
|
When the channel, view or |
Note
A _FillValue that is not a finite number cannot mask anything, so the
decode emits a UserWarning and the result's nodata is incomplete rather
than the read failing (see invalid_mask).
Source code in src/pyramids_eo/sensors/readers/slstr.py
read_slstr(source, channel=None, *, channels=None, view=None, grid=None, geolocation=True)
#
Read one or several SLSTR L1 RBT channels from a .SEN3 granule.
Decodes each requested channel's packed variable (raw * scale_factor +
add_offset, with the _FillValue and anything outside the variable's
validity limits masked to NaN) and returns it as a swath Dataset carrying
the matching grid's per-pixel geolocation as a GDAL GEOLOCATION domain. The
limits come from the valid_min / valid_max scalars the SLSTR L1
specification carries -- not from a combined valid_range, which appears
nowhere in it -- and are compared against the raw, still-packed values.
Pass exactly one of channel (returns a Dataset) or channels (returns a
dict[str, Dataset]). Channels on different grids have different array
shapes, which is why a channel set returns a dict rather than a stack.
Either may also be given in the product's own variable spelling
("S5_radiance_bn"), and the grid and view it carries then select the
file: they are honoured, not merely tolerated. So a channel set may mix views
and grids per channel -- channels=["S5_radiance_an", "S8_BT_io"] reads one
nadir and one oblique -- while view= / grid= supply whatever a bare
spelling leaves open. A spelling that contradicts an explicit view= / grid=
is an error rather than one of the two being silently ignored.
This reader decodes only -- issue #136 scopes radiometric calibration
choices out. The RBT product is already geophysical, so S7-S9 / F1-F2
arrive as brightness temperature in kelvin with no conversion applied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The |
required |
channel
|
str | None
|
A single channel ( |
None
|
channels
|
Sequence[str] | None
|
A sequence of channels for a |
None
|
view
|
str | None
|
|
None
|
grid
|
str | None
|
An explicit grid letter ( |
None
|
geolocation
|
bool
|
When |
True
|
Returns:
| Type | Description |
|---|---|
Any
|
A pyramids |
Any
|
|
Raises:
| Type | Description |
|---|---|
ReaderError
|
When neither / both of |
Note
A _FillValue that is not a finite number cannot mask anything, so the
decode emits a UserWarning per affected channel and the result's nodata
is incomplete rather than the read failing (see invalid_mask).
Source code in src/pyramids_eo/sensors/readers/slstr.py
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | |
pyramids_eo.sensors.readers.harmonise
#
Harmonise multi-resolution L1 bands onto a common grid.
FCI / SEVIRI channels arrive at different native resolutions (FCI: 0.5 / 1 / 2
km). harmonise warps/crops each band onto one target grid by delegating to
pyramids' align (which copies the reference's CRS, rows/columns, and cell size
and resamples the band onto it). No
new reprojection code; the reference grid decides the output.
harmonise(bands, reference, *, method=None)
#
Align a set of bands onto a reference grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bands
|
Any
|
The bands to harmonise — a mapping |
required |
reference
|
Any
|
A pyramids |
required |
method
|
str | None
|
Resampling method. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The aligned bands in the same container shape as the input: a |
Any
|
|
Raises:
| Type | Description |
|---|---|
ReaderError
|
When |
Source code in src/pyramids_eo/sensors/readers/harmonise.py
Raster-driver plugins#
The EO readers are also registered as pyramids.raster_drivers plugins (the hook
pyramids-core 0.70 added), so pyramids.dataset.Dataset.read_file(<source>) can
route a source straight into pyramids-eo — no import of this package needed at the
call site. Installing pyramids-eo is the whole integration. The
Reading EO sources via read_file guide covers the dispatch
rules, the open_options contract, and per-source recipes in full; the essentials:
| driver name | source | reader |
|---|---|---|
earthengine |
ee://<asset-id> |
from_earthengine |
seviri |
a .nat granule |
read_seviri |
ahi |
an HSD granule named HS_….DAT (optionally .bz2) |
read_ahi |
s2 |
a .SAFE product (or .SAFE.zip) |
from_sentinel2 |
fci |
an FCI L1C granule: a chunk directory, a glob, or an fci:// path |
read_fci_l1c |
olci |
a Sentinel-3 OLCI .SEN3 granule directory, or an olci:// path |
read_olci |
slstr |
a Sentinel-3 SLSTR .SEN3 granule directory, or a slstr:// path |
read_slstr |
from pyramids.dataset import Dataset
# auto-routed: GDAL cannot open these, so read_file falls through to the plugin
nat = Dataset.read_file("MSG_SEVIRI.nat", open_options={"channel": "IR_108"})
ee = Dataset.read_file("ee://USGS/SRTMGL1_003", open_options={"bbox": (0, 0, 1, 1)})
fci = Dataset.read_file("/data/fci_granule", open_options={"channel": "ir_105"})
fci2 = Dataset.read_file("fci:///data/fci_granule", open_options={"channel": "ir_105"})
# Himawari AHI: claimed by the HSD file-name convention, not by the generic .dat suffix,
# and the granule names its own band so open_options may be omitted entirely
ahi = Dataset.read_file("HS_H08_20150415_0230_B13_FLDK_R20_S0101.DAT")
# Sentinel-3: OLCI and SLSTR share the .SEN3 suffix, so the granule's contents decide
# which driver claims it (an olci:// / slstr:// prefix, or driver=, names one explicitly)
olci = Dataset.read_file("S3A_OL_1_EFR.SEN3", open_options={"channel": "Oa08"})
slstr = Dataset.read_file(
"S3A_SL_1_RBT.SEN3", open_options={"channel": "S8", "view": "oblique"}
)
# Sentinel-2: a product directory auto-routes (GDAL cannot open one), and a zipped
# product auto-routes too because the driver pre-empts GDAL for `.zip`
s2 = Dataset.read_file("S2A_MSIL2A.SAFE", open_options={"bands": ["B04", "B03", "B02"]})
s2z = Dataset.read_file("S2A_MSIL2A.SAFE.zip", open_options={"bands": ["B04"]})
read_file forwards only open_options to a driver, so reader keywords (channel,
bbox, bands, credentials, …) are passed there; options needing a non-string type
(e.g. S2 resolution=10) must be given in dict form, not a KEY=VALUE list. A
bare read_file("…SAFE") on a product directory reads the product: GDAL cannot open
one, so the driver claims it on the fallback. A zipped product reads bare too: the driver
declares preempts = (".zip",), so it is tried before GDAL would return a container.
Narrow a zipped read with bands / resolution — a whole product is ~10 GiB. Which
driver claims a .SAFE is decided by its contents, not its name: ESA shares the suffix
with Sentinel-1, and those products stay with GDAL.
pyramids_eo.drivers
#
Raster-reader drivers for the pyramids.raster_drivers plugin hook.
pyramids-core 0.70 added a pyramids.raster_drivers entry-point group: a third-party package
registers a driver class there, and Dataset.read_file(<source>) routes a source GDAL cannot
open into that driver with no import coupling. This subpackage registers pyramids-eo's readers:
- :class:
~pyramids_eo.drivers.earthengine.EarthEngineDriver—ee://<asset-id>sources. - :class:
~pyramids_eo.drivers.seviri.SeviriDriver— SEVIRI native.natgranules. - :class:
~pyramids_eo.drivers.ahi.AhiDriver— Himawari AHI Himawari Standard Data (.DAT) granules. It is one of two drivers here that declare a suffix and then deliberately narrow it incan_open— Sentinel-2 is the other, inspecting a product's contents to tell the mission apart:.datis too generic, so it matches the HSD file-name convention instead (see its docstring). - :class:
~pyramids_eo.drivers.sentinel2.Sentinel2Driver— Sentinel-2.SAFEproducts. - :class:
~pyramids_eo.drivers.fci.FciDriver— MTG-FCI L1C FDHSI granules (a chunk set named by a directory or glob). - :class:
~pyramids_eo.drivers.olci.OlciDriver— Sentinel-3 OLCI L1B.SEN3granules. - :class:
~pyramids_eo.drivers.slstr.SlstrDriver— Sentinel-3 SLSTR L1 RBT.SEN3granules.
OLCI and SLSTR products share the .SEN3 directory suffix, so both drivers claim it and their
can_open predicates disambiguate on content — an OLCI granule holds Oa*_radiance.nc band
files, an SLSTR one holds S*_radiance_*.nc / *_BT_*.nc. An olci:// or slstr://
prefix (or driver=) names one explicitly. Deciding on content has two consequences worth
stating, since neither is obvious from the claim set:
- A
.SEN3holding both kinds of file is claimed by both drivers, andselect_drivertakes the first claimant in registration order, which is alphabetical — soolciwins. The outcome is stable rather than arbitrary, and a scheme prefix ordriver=overrides it. - An empty or incomplete
.SEN3is claimed by neither, soread_filesurfaces GDAL's own "not recognized" error instead of the readers' more useful "the product looks incomplete or is not the expected Sentinel-3 level/type". Callingread_olci/read_slstrdirectly, or passingdriver=, reaches that better message.
A boolean reader keyword passed through read_file arrives as a string, because
Dataset.read_file normalises open_options to GDAL's KEY=VALUE form. The drivers
translate those spellings (see :func:~pyramids_eo.drivers._base.coerce_booleans) rather than
letting the truthy string "false" switch an option on.
The entry points in pyproject.toml are the whole integration; installing the package is
enough for read_file to find these. Each driver is a thin wrapper over an existing reader
(from_earthengine / read_seviri / read_ahi / from_sentinel2 /
read_fci_l1c / read_olci / read_slstr), which stays the ergonomic public API.
Only a driver's read is reachable this way: Dataset.read_file never dispatches
read_collection, so :meth:~pyramids_eo.drivers.earthengine.EarthEngineDriver.read_collection
is declared and implemented but unreachable through the facade — a temporal stack goes through
collection_from_earthengine.
A single read_file source string can name a set of files — a directory, a glob, or an
fci:// path — which is how a multi-chunk FCI granule is addressed (see
:func:~pyramids_eo.drivers._base.expand_sources). Sentinel-2 reaches this layer on the bare path in both its
forms: a product directory through the post-GDAL can_open fallback (GDAL cannot open one),
and a zipped product through pre-emption — :class:~pyramids_eo.drivers.sentinel2.
Sentinel2Driver declares preempts = (".zip",), the opt-in pyramids-core 0.71 added
(serapeum-org/pyramids-core#1344), because GDAL would otherwise open the archive and return a bare
container. Because ESA shares .SAFE across missions, can_open identifies the mission from
the product's contents rather than its name, so a Sentinel-1 product — zipped or not — is left to
GDAL instead of failing in the Sentinel-2 reader.
AhiDriver
#
Read one Himawari-8/9 AHI band from a Himawari Standard Data granule.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The driver's registry name and the value accepted by |
|
long_name |
Human-readable source name for |
|
api_version |
The driver-contract version (see
:data: |
|
suffixes |
tuple[str, ...]
|
|
schemes |
tuple[str, ...]
|
Empty — an HSD granule is a local file. |
capabilities |
|
|
extra |
str | None
|
|
Examples:
- The driver identifies itself to
describe_driversand reads a single granule: - It claims a granule by its HSD name, so an unrelated
.datis left to GDAL:
Source code in src/pyramids_eo/drivers/ahi.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
can_open(source)
classmethod
#
Return whether source names a Himawari Standard Data granule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The source handed by |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when the base name follows the HSD convention |
bool
|
|
bool
|
Anything that is not a |
bool
|
stringifies the source before it scans, so a path only ever arrives here already |
bool
|
stringified. Cheap: no import, no network, no file access, and safe for a path that |
bool
|
does not exist — matching the name rather than the generic |
bool
|
driver from claiming unrelated files. |
Examples:
- An HSD granule is claimed; a bare
.dator another suffix is not:
Source code in src/pyramids_eo/drivers/ahi.py
read(source, *, bands=None, options=None, **_ignored)
#
Read one AHI band into a :class:~pyramids.dataset.Dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
Path to an HSD |
required |
bands
|
Any
|
Optionally the band to read, as a one-element list (e.g. |
None
|
options
|
Any
|
Extra :func:
|
None
|
**_ignored
|
Any
|
The generic driver-read parameters an AHI read does not use — |
{}
|
Returns:
| Type | Description |
|---|---|
Dataset
|
The calibrated, geolocated band. |
Raises:
| Type | Description |
|---|---|
ValueError
|
|
ReaderError
|
The granule carries a band other than the one requested, or cannot be
decoded (raised by |
Examples:
- An AHI read is one band, so several are refused rather than silently truncated. The check happens before the granule is opened, so no file is needed to see it:
- A bare string would be read one character at a time, so it is refused with the spelling that works:
read_filenormalises options toKEY=VALUEstrings, so a boolean that cannot be read from its spelling is reported instead of being taken as truthy:
Source code in src/pyramids_eo/drivers/ahi.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
EarthEngineDriver
#
Read an Earth Engine Image or ImageCollection via an ee:// source.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The driver's registry name and the value accepted by |
|
long_name |
Human-readable source name for |
|
api_version |
The driver-contract version (see
:data: |
|
suffixes |
tuple[str, ...]
|
Empty — an Earth Engine asset has no file. |
schemes |
tuple[str, ...]
|
|
capabilities |
|
|
extra |
str | None
|
|
Source code in src/pyramids_eo/drivers/earthengine.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
can_open(source)
classmethod
#
Return whether source is an ee:// Earth Engine asset id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The source handed by |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True for a string beginning |
bool
|
import, no network. |
Examples:
- An
ee://source is claimed; a plain path or a bare asset id is not:
Source code in src/pyramids_eo/drivers/earthengine.py
read(source, *, bbox=None, bands=None, crs=None, options=None, auth=None)
#
Read a single Earth Engine image into a :class:~pyramids.dataset.Dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
An |
required |
bbox
|
Any
|
Optional AOI |
None
|
bands
|
Any
|
Optional band subset. |
None
|
crs
|
Any
|
Optional target CRS for the output window. |
None
|
options
|
Any
|
Extra :func: |
None
|
auth
|
Any
|
Credentials for the Earth Engine read, passed as |
None
|
Returns:
| Type | Description |
|---|---|
Dataset
|
The windowed image. |
Source code in src/pyramids_eo/drivers/earthengine.py
read_collection(source, *, time=None, **kwargs)
#
Read an Earth Engine ImageCollection into a temporal DatasetCollection.
pyramids 0.70's :meth:Dataset.read_file dispatches only :meth:read (single image) —
it has no collection path — so this method is reached by a direct call, and is here for
that use and for forward-compatibility if pyramids adds collection dispatch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
An |
required |
time
|
Any
|
Optional |
None
|
**kwargs
|
Any
|
:func: |
{}
|
Returns:
| Type | Description |
|---|---|
DatasetCollection
|
One aligned timestep per scene. |
Raises:
| Type | Description |
|---|---|
ValueError
|
|
Source code in src/pyramids_eo/drivers/earthengine.py
FciDriver
#
Read one or more MTG-FCI L1C FDHSI channels from a granule's chunk set.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The driver's registry name and the value accepted by |
|
long_name |
Human-readable source name for |
|
api_version |
The driver-contract version (see
:data: |
|
suffixes |
tuple[str, ...]
|
Empty — a granule is a directory or glob of chunks, not a single-file suffix. |
schemes |
tuple[str, ...]
|
|
capabilities |
|
|
extra |
str | None
|
|
Source code in src/pyramids_eo/drivers/fci.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
can_open(source)
classmethod
#
Return whether source names a real FCI L1C FDHSI chunk set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The source handed by |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True for an |
bool
|
chunk, or a glob whose matches include one; False for an empty source. It does a |
bool
|
bounded, non-recursive directory listing / glob (no file open, no network) — more than |
bool
|
the string-only |
bool
|
already failed to open the source, a very broad user glob (e.g. |
bool
|
cost, and a filesystem error (e.g. an unreadable directory) is swallowed to False so |
bool
|
the method never raises. |
bool
|
still be read explicitly. |
Examples:
- An
fci://source is always claimed (a cheap string check): - A non-string source is never claimed:
Source code in src/pyramids_eo/drivers/fci.py
read(source, *, bands=None, options=None, **_ignored)
#
Read one or more FCI L1C channels into a :class:~pyramids.dataset.Dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
A directory of FDHSI |
required |
bands
|
Any
|
The channel(s) to read — one name for a single-channel |
None
|
options
|
Any
|
Extra :func: |
None
|
**_ignored
|
Any
|
Any other generic driver-read parameter ( |
{}
|
Returns:
| Type | Description |
|---|---|
Dataset | dict[str, Dataset]
|
A single channel's |
Dataset | dict[str, Dataset]
|
requested. |
Raises:
| Type | Description |
|---|---|
ValueError
|
No channel was given (via |
ReaderError
|
Propagated from :func: |
CalibrationError
|
Propagated when |
Note
A channel set is a direct-call feature only: Dataset.read_file requires a
driver to return one Dataset, so an options={'channels': [...]} read raises
TypeError from pyramids' plugin layer. Use the reader function
(read_fci_l1c(..., channels=[...])) for several channels at once. This is shared
with the other channel-at-a-time drivers.
Source code in src/pyramids_eo/drivers/fci.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
OlciDriver
#
Read one or more Sentinel-3 OLCI L1B radiance bands from a .SEN3 granule.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The driver's registry name and the value accepted by |
|
long_name |
Human-readable source name for |
|
api_version |
The driver-contract version (see
:data: |
|
suffixes |
tuple[str, ...]
|
|
schemes |
tuple[str, ...]
|
|
capabilities |
|
|
extra |
str | None
|
|
Source code in src/pyramids_eo/drivers/olci.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
can_open(source)
classmethod
#
Return whether source names a real OLCI L1B granule.
A .SEN3 directory alone is not enough to claim, because SLSTR granules share that
suffix; the directory must actually hold an Oa*_radiance.nc band file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The source handed by |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True for an |
bool
|
|
bool
|
directory listing short-circuits on the first match but enumerates the whole |
bool
|
directory when nothing matches; it runs only once GDAL has failed to open the |
bool
|
source, and any filesystem error is swallowed to False so the method never raises. |
bool
|
|
Examples:
- An
olci://source is always claimed (a cheap string check): - A non-string source is never claimed:
Source code in src/pyramids_eo/drivers/olci.py
read(source, *, bands=None, options=None, **_ignored)
#
Read one or more OLCI L1B bands into a :class:~pyramids.dataset.Dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
A |
required |
bands
|
Any
|
The band(s) to read — one name for a single-band |
None
|
options
|
Any
|
Extra :func: |
None
|
**_ignored
|
Any
|
Any other generic driver-read parameter ( |
{}
|
Returns:
| Type | Description |
|---|---|
Dataset | dict[str, Dataset]
|
A single band's |
Raises:
| Type | Description |
|---|---|
ValueError
|
No band was given (via |
ReaderError
|
Propagated from :func: |
Note
A channel set is a direct-call feature only: Dataset.read_file requires a
driver to return one Dataset, so an options={'channels': [...]} read raises
TypeError from pyramids' plugin layer. Use the reader function
(read_olci(..., channels=[...])) for several channels at once. This is shared
with the other channel-at-a-time drivers.
Source code in src/pyramids_eo/drivers/olci.py
Sentinel2Driver
#
Read a Sentinel-2 .SAFE product into a :class:~pyramids.dataset.Dataset.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The driver's registry name and the value accepted by |
|
long_name |
Human-readable source name for |
|
api_version |
The driver-contract version (see
:data: |
|
suffixes |
tuple[str, ...]
|
|
schemes |
tuple[str, ...]
|
Empty — a |
preempts |
tuple[str, ...]
|
|
capabilities |
|
|
extra |
str | None
|
|
Source code in src/pyramids_eo/drivers/sentinel2.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | |
can_open(source)
classmethod
#
Return whether source is a Sentinel-2 .SAFE product.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The source handed by |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True for a source this driver should read, which differs by form because the two |
bool
|
forms reach it by different routes. |
bool
|
A zipped product is pre-empted before GDAL, so the claim has to be exact: the |
bool
|
extension must be a lowercase |
bool
|
archive must hold Sentinel-2 metadata (:data: |
bool
|
ESA shares |
bool
|
must never win the claim. |
bool
|
A directory is only reached through the post-GDAL fallback, where GDAL has |
bool
|
already declined the source, so any |
bool
|
which would otherwise turn away a product whose root metadata is a bare |
bool
|
|
bool
|
In both forms a |
bool
|
product and Sentinel-1's entry point. A plain local path that does not exist is |
bool
|
claimed so the reader can report it, but a URL, a GDAL |
bool
|
never is — this driver cannot read one and GDAL often can. |
Note
This is no longer free of I/O: identifying the mission requires reading a directory
listing or a zip's central directory. Pre-emption consults only drivers whose
preempts matches the source's suffix, but the post-GDAL fallback
(select_driver) asks every registered driver, with no suffix filter — so this
runs for any source GDAL failed to open. The cheap string tests come first and return
before any I/O, so the filesystem is touched only for a source actually spelled
*.SAFE or *.SAFE.zip.
Examples:
- A plain raster, a bare archive and a manifest are all rejected without I/O:
- A
.SAFEpath that is not on disk is claimed, so the reader reports the problem:
Source code in src/pyramids_eo/drivers/sentinel2.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
read(source, *, bbox=None, bands=None, crs=None, options=None, auth=None, **_ignored)
#
Read a Sentinel-2 product into a :class:~pyramids.dataset.Dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
Path to a |
required |
bbox
|
Any
|
Optional AOI |
None
|
bands
|
Any
|
Optional band subset (e.g. |
None
|
crs
|
Any
|
Optional target CRS. |
None
|
options
|
Any
|
Extra :func: |
None
|
auth
|
Any
|
Ignored — a local |
None
|
**_ignored
|
Any
|
Any other generic driver-read parameter, accepted and ignored. |
{}
|
Returns:
| Type | Description |
|---|---|
Dataset
|
The read Sentinel-2 dataset. |
Source code in src/pyramids_eo/drivers/sentinel2.py
SeviriDriver
#
Read one MSG SEVIRI channel from a native .nat granule.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The driver's registry name and the value accepted by |
|
long_name |
Human-readable source name for |
|
api_version |
The driver-contract version (see
:data: |
|
suffixes |
tuple[str, ...]
|
|
schemes |
tuple[str, ...]
|
Empty — a |
capabilities |
|
|
extra |
str | None
|
|
Source code in src/pyramids_eo/drivers/seviri.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
can_open(source)
classmethod
#
Return whether source is a SEVIRI native .nat granule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The source handed by |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True for a string ending |
bool
|
no network, no file access — |
bool
|
non-SEVIRI native file also answers True and fails later in |
bool
|
module docstring), which is preferred over opening the file here. |
Examples:
- A
.natgranule is claimed; other suffixes are not:
Source code in src/pyramids_eo/drivers/seviri.py
read(source, *, bands=None, options=None, **_ignored)
#
Read one SEVIRI channel into a :class:~pyramids.dataset.Dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
Path to a SEVIRI native |
required |
bands
|
Any
|
The channel to read, as a one-element list (e.g. |
None
|
options
|
Any
|
Extra :func: |
None
|
**_ignored
|
Any
|
The generic driver-read parameters a SEVIRI read does not use — |
{}
|
Returns:
| Type | Description |
|---|---|
Dataset
|
The calibrated, geolocated channel. |
Raises:
| Type | Description |
|---|---|
ValueError
|
No channel was given (via |
Source code in src/pyramids_eo/drivers/seviri.py
SlstrDriver
#
Read one or more Sentinel-3 SLSTR L1 RBT channels from a .SEN3 granule.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The driver's registry name and the value accepted by |
|
long_name |
Human-readable source name for |
|
api_version |
The driver-contract version (see
:data: |
|
suffixes |
tuple[str, ...]
|
|
schemes |
tuple[str, ...]
|
|
capabilities |
|
|
extra |
str | None
|
|
Source code in src/pyramids_eo/drivers/slstr.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | |
can_open(source)
classmethod
#
Return whether source names a real SLSTR L1 RBT granule.
A .SEN3 directory alone is not enough to claim, because OLCI granules share that
suffix; the directory must actually hold an SLSTR measurement file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
The source handed by |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True for a |
bool
|
file, or a glob whose matches include such a directory; False otherwise. The |
bool
|
directory listing short-circuits on the first match but enumerates the whole |
bool
|
directory when nothing matches; it runs only once GDAL has failed to open the |
bool
|
source, and any filesystem error is swallowed to False so the method never raises. |
bool
|
|
Examples:
- A
slstr://source is always claimed (a cheap string check): - A non-string source is never claimed:
Source code in src/pyramids_eo/drivers/slstr.py
read(source, *, bands=None, options=None, **_ignored)
#
Read one or more SLSTR L1 RBT channels into a :class:~pyramids.dataset.Dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
A |
required |
bands
|
Any
|
The channel(s) to read — one name for a single-channel |
None
|
options
|
Any
|
Extra :func: |
None
|
**_ignored
|
Any
|
Any other generic driver-read parameter ( |
{}
|
Returns:
| Type | Description |
|---|---|
Dataset | dict[str, Dataset]
|
A single channel's |
Dataset | dict[str, Dataset]
|
requested. |
Raises:
| Type | Description |
|---|---|
ValueError
|
No channel was given (via |
ReaderError
|
Propagated from :func: |
Note
A channel set is a direct-call feature only: Dataset.read_file requires a
driver to return one Dataset, so an options={'channels': [...]} read raises
TypeError from pyramids' plugin layer. Use the reader function
(read_slstr(..., channels=[...])) for several channels at once. This is shared
with the other channel-at-a-time drivers.