eoio.readers.landsat.metadata.ls_mtd_fallback module#
eoio.readers.landsat.metadata.ls_mtd_fallback - MTL.xml + raster-derived fallback for
projection/band metadata, used only when a product has no STAC/MTL JSON sidecar (see
eoio.readers.landsat.layout.LandsatLayout.product_metadata_json()) – most often an
interrupted local extraction (see eoio.utils.read_utils’s extraction-completeness
check, which now detects and heals exactly that) rather than a genuinely stripped-down
delivery, but handled here either way rather than failing outright.
Exposes the same small interface
LSL1ProdJSONReader does – only the methods LSMetadataExtractor actually calls: find_all_band_central_wavelengths,
find_all_band_gsds, find_epsg, find_proj_shape, find_proj_transform – so
LSMetadataExtractor can use either interchangeably without caring which one it got.
- class eoio.readers.landsat.metadata.ls_mtd_fallback.LSMTDFallbackReader(layout: LandsatLayout, xml_reader: LSL1ProdXMLReader)[source]#
Bases:
objectStand-in for
LSL1ProdJSONReaderwhen a product has no STAC/MTL JSON sidecar.Band GSD comes from MTL.xml’s own
GRID_CELL_SIZE_REFLECTIVE/PANCHROMATIC/THERMALfields; EPSG/proj:shape/proj:transformcome from one of the product’s own GeoTIFF band files, read directly via rasterio – arguably more authoritative than the STAC sidecar’s own copy of the same information anyway, since it’s the raster’s own embedded georeferencing, not a separately-maintained record of it. Every band in one Landsat product shares the same CRS (only the pixel grid/resolution differs between the reflective/panchromatic/thermal band groups), so any single band file is representative enough for the product-level EPSG this supplies.- find_all_band_central_wavelengths() Dict[str, float][source]#
- Returns:
{band: wavelength_nm} – see
NOMINAL_BAND_WAVELENGTHS_NM.
- find_all_band_gsds() Dict[str, float][source]#
- Returns:
{band: gsd_m}, from MTL.xml’s GRID_CELL_SIZE_* fields.
- find_epsg(default: int | None = None) int | None[source]#
- Parameters:
default – value to return if the representative band file has no CRS.
- Returns:
EPSG code, read from a representative band GeoTIFF’s own CRS.
- Raises:
ValueError – if unavailable and no default is given – matching
LSL1ProdJSONReader.find_epsg’s own contract.
- eoio.readers.landsat.metadata.ls_mtd_fallback.NOMINAL_BAND_WAVELENGTHS_NM: Dict[str, float] = {'B1': 443.0, 'B10': 10895.0, 'B11': 12005.0, 'B2': 482.0, 'B3': 561.5, 'B4': 654.6, 'B5': 864.7, 'B6': 1608.9, 'B7': 2200.7, 'B8': 589.5, 'B9': 1373.4}#
Nominal OLI/TIRS band centre wavelengths (nm) – identical for Landsat 8 and 9 (same instrument design), per USGS’s published Landsat 8-9 OLI/TIRS band designations. The STAC json’s own “center_wavelength” is this same fixed instrument spec, not a per-scene measurement, so hardcoding it here as a fallback loses no real information.