Skip to content

Exports Schema Utils

Module: spectralbridge.exports.schema_utils.

Direct-module reference; consult the linked workflow for processing context.

API glossary ยท Workflow / scientific context

Signatures and documentation below are collected from the current source. Advanced objects are not newly declared stable by inclusion here.

Audience: advanced.

infer_stage_from_name

infer_stage_from_name(name: str) -> str

Infer the stage key (column prefix) from a filename.

Files with an _undarkened_envi suffix are treated as convolution-only cubes (no brightness offset). They inherit the base stage key and append _undarkened so they remain distinct from the darkened products.

Audience: advanced.

sort_and_rename_spectral_columns

sort_and_rename_spectral_columns(df: DataFrame, stage_key: str, wavelengths_nm: List[int]) -> pd.DataFrame

Rebuild DataFrame with non-spectral first, then spectral columns sorted by wavelength and renamed as: _b###_wl####nm

Audience: advanced.

parse_envi_wavelengths_nm

parse_envi_wavelengths_nm(hdr_text: str) -> Optional[List[int]]

Parse ENVI header text for numeric wavelengths, return nm ints or None.

Audience: advanced.

compute_lonlat

compute_lonlat(xs: ndarray, ys: ndarray, src_epsg: int | str) -> Tuple[np.ndarray, np.ndarray]

Transform planar x,y to lon,lat. Returns (lon, lat).

Audience: advanced.

ensure_coord_columns

ensure_coord_columns(df: DataFrame, transform, crs_epsg: int | str) -> pd.DataFrame

Make sure df has x, y, lon, lat columns. If missing, compute from row/col with affine transform and the CRS.

Audience: advanced.

write_parquet_standardized

write_parquet_standardized(df: DataFrame, out_path: Path, hdr_path: Path, transform=None, crs_epsg: int | str = 32613)

Standardized Parquet writer: - ensures x,y,lon,lat present - ensures spectral columns sorted and renamed as _b###_wl####nm