- Home
- Documentation
- API reference
- Readers
- hyperproc.readers._common
hyperproc.readers._common¶
Source-derived reference
Generated from the current hyperproc 0.1.2 checkout.
Implementation: hyperproc/readers/_common.py. Signatures, defaults, docstrings, and expandable source are extracted statically; the module is not imported or executed. Names beginning with _ are implementation details, not a stable public API.
Use the function signature as the authority for individual parameter defaults and return annotations. Original docstrings sometimes group parameter names or wrap return descriptions across lines; these descriptions are preserved rather than inferred or rewritten.
Docstring evidence boundary
Original docstrings may contain historical validation claims or simplified scientific explanations. Their presence is not independent verification. Consult the maintained workflow guides and validation page before reusing such claims.
Helpers shared by the readers.
WATER_WINDOWS = ((1350.0, 1440.0), (1800.0, 1960.0))
module-attribute
¶
_ID_PATTERNS = (_re.compile('(?:AV[35]|ang)(\\d{4})(\\d{2})(\\d{2})t(\\d{2})(\\d{2})(\\d{2})'), _re.compile('^(\\d{4})(\\d{2})(\\d{2})_(\\d{2})(\\d{2})(\\d{2})_'))
module-attribute
¶
_CLASSIC = _re.compile('^f(\\d{2})(\\d{2})(\\d{2})t\\d{2}')
module-attribute
¶
_SCALAR_ALIASES = {'sza': ('sun_zenith', 'sza_center', 'solar_zenith'), 'saa': ('sun_azimuth', 'saa_center', 'solar_azimuth'), 'vza': ('view_zenith', 'vza_center', 'sceneIncidenceAngle'), 'vaa': ('view_azimuth', 'vaa_center')}
module-attribute
¶
crs_text(crs) -> str | None
¶
One spelling for attrs["crs"]: "EPSG:<code>" when the CRS has an
EPSG code, WKT otherwise, None when there is no CRS at all.
Readers get their CRS from very different places (rasterio objects, ENVI
map info, netCDF spatial_ref WKT, integer EPSG attributes). Writing them
all through this keeps the attribute comparable across sensors and stops
str(None) from turning into the literal text "None", which the
GeoTIFF writer would then try to use as a projection.
Source code in hyperproc/readers/_common.py
datetime_from_id(granule: str) -> str | None
¶
ISO acquisition time encoded in a granule id, or None.
AV320231005t181518 -> 2023-10-05T18:15:18; ang20220224t210144
likewise; Tanager 20250503_064345_16_4001 -> 2025-05-03T06:43:45;
AVIRIS Classic f201013t01p00r10 carries the date only.
Source code in hyperproc/readers/_common.py
finish_bands(ds: xr.Dataset, *, index=None, good=None, good_source: str | None = None, fill_value=None, stem: str | None = None, datetime: str | None = None) -> None
¶
Complete the band/attribute contract every reader promises.
Sets what is still missing: band_index (0-based position of each band
in the source file - index after any subsetting, else 0..n-1),
good_wavelength (good from the provider, else the package's
water-window default), fill_value (the source no-data value),
stem (defaults to granule) and datetime. Never overwrites a
value a reader already set, so calling it is always safe.
Source code in hyperproc/readers/_common.py
normalise_angles(ds: xr.Dataset) -> None
¶
One angle convention for every reader.
- scene-level scalars become attrs
sza/saa/vza/vaa(the provider's names are kept as well); - a scalar with no matching layer is broadcast lazily to a constant
(y, x)layer, so geometry export anddescribetreat every sensor alike (long_namesays it is scene-level); - azimuths and aspect are wrapped to [0, 360);
raa= (vaa - saa) mod 360 is added when both azimuth layers exist.