How jarojuan96/hs_tool works
Purpose and execution
HS_tool is an interactive Python workflow that converts hyperspectral L1 radiance scenes into L2 gas-enhancement maps and L4 plume emission estimates. The likely orchestration entry point is scripts/main.py; it requires GUI-backed user decisions for masking, plume selection, and source localization.
Mission ingestion and scene normalization
Mission-specific readers ingest L1 products from EnMAP, EMIT, Gaofen-5A, PRISMA, and AVIRIS-NG, producing the radiance, spectral, and spatial metadata consumed by shared processing.
• scripts/EnMAP_reader.py
• scripts/EMIT_reader.py
• scripts/AVIRIS_NG_reader.py
Additional mission adapters are scripts/GF_reader.py and scripts/PRISMA_reader.py. ENVI-oriented input/output handling is centralized in scripts/envi_files.py.
Retrieval configuration and physical inputs
Shared variables and paths, including LUT/default-atmosphere locations, are defined in scripts/variable_definition.py. Matched-filter absorption signatures are derived from gas-specific NetCDF lookup tables under lut_nc/, using the default atmospheric profile RFM_midlatitude_summer.dat.
The LUT boundary encapsulates precomputed spectroscopy/radiative-transfer inputs rather than invoking HITRAN, ARTS, or LibRadtran at runtime. Supported retrieval gases include CH4, CO2, H2O, C2H4, C2H2, CO, N2O, and NH3.
L1-to-L2 retrieval pipeline
main.py coordinates scene reuse/reprocessing, interactive radiance screening, and retrieval execution. scripts/radiance_masking.py presents quicklooks and applies user-approved lower/upper radiance masks for water, clouds, shadows, or invalid radiance. scripts/Retrieval_methods.py implements the matched-filter retrieval stage, while scripts/RT_functions.py supports radiative-transfer/spectral calculations.
The output boundary is an L2 concentration-enhancement raster in ppm·m, stored in ENVI format.
Spatial handling and plume delineation
After retrieval, the workflow displays radiance alongside the gas map and requires an operator to confirm detection, zoom to a plume subset, choose one emission-source pixel, and digitize plume extent. Georeferencing and geospatial export are handled by:
• scripts/georreferencing.py
• scripts/hs_tool4_deltaxgas.py
Georeferenced retrievals and plume masks/bands are emitted as TIFFs.
Wind and IME quantification
L4 quantification applies the IME approach to the operator-delineated plume. scripts/wind_v2.py obtains or reuses wind information from GEOS-FP; scripts/quant_func_v2.py calculates emission-related values. Quantification is principally intended for CH4, NH3, C2H4, CO, and C2H2, with documented simplified wind assumptions for AVIRIS-NG and CO2 and EMIT-specific effective-wind handling for some gases.
Persistence and runtime dependencies
L2 products are reusable: existing retrievals can bypass the retrieval path and enter plume quantification. Result serialization is managed by scripts/store_results.py, which writes L4-related values to CSV. The runtime is Python with scientific/geospatial and hyperspectral dependencies, notably GDAL, georasters, and spectral; graphical backend behavior is operationally important because interaction is integral to control flow.
Main entry points: Retrieval_methods.py Matched-filter retrieval · main.py Interactive orchestrator · radiance_masking.py Radiance masking · quant_func_v2.py IME emission estimate
Components 18
Mission ingestion
- Mission readers · Normalize EnMAP, EMIT, AVIRIS-NG, Gaofen-5A, and PRISMA L1 scenes.
- EnMAP reader
scripts/EnMAP_reader.py - EMIT reader
scripts/EMIT_reader.py - AVIRIS-NG reader
scripts/AVIRIS_NG_reader.py - ENVI I/O · Centralizes ENVI-oriented input and output.
scripts/envi_files.py
L2 retrieval
- Interactive orchestrator · Coordinates reusable L2 products and operator-driven workflow.
scripts/main.py - Retrieval settings · Defines shared variables and LUT/default-atmosphere locations.
scripts/variable_definition.py - Gas LUTs · Precomputed absorption and radiative-transfer inputs.
- Default atmosphere
RFM_midlatitude_summer.dat - Radiance masking · Operator approves masks for water, clouds, shadows, and invalid radiance.
scripts/radiance_masking.py - Matched-filter retrieval · Produces concentration enhancement from radiance and gas signatures.
scripts/Retrieval_methods.py - Spectral calculations
scripts/RT_functions.py - L2 enhancement raster · Reusable concentration-enhancement product in ppm·m.
Plume workflow
- Plume delineation · Confirms detection, selects source pixel, and digitizes plume extent.
scripts/hs_tool4_deltaxgas.py - Georeferencing export · Emits georeferenced retrievals and plume masks as TIFFs.
scripts/georreferencing.py
L4 quantification
- GEOS-FP wind · Obtains or reuses wind information.
scripts/wind_v2.py - IME emission estimate · Calculates plume emission-related values from IME and wind.
scripts/quant_func_v2.py - L4 results CSV
scripts/store_results.py
Connections 19
- EnMAP reader → Mission readers
- EMIT reader → Mission readers
- AVIRIS-NG reader → Mission readers
- Mission readers → ENVI I/O: normalized scene I/O
- Interactive orchestrator → Mission readers: selects reader
- Interactive orchestrator → Radiance masking: interactive screening
- ENVI I/O → Radiance masking: radiance scene
- Radiance masking → Matched-filter retrieval: approved radiance
- Retrieval settings → Matched-filter retrieval: retrieval settings
- Gas LUTs → Matched-filter retrieval: gas signature
- Default atmosphere → Spectral calculations: profile
- Spectral calculations → Matched-filter retrieval: spectral support
- Matched-filter retrieval → L2 enhancement raster: ppm·m raster
- Interactive orchestrator → L2 enhancement raster: reuse existing
- L2 enhancement raster → Plume delineation: gas map
- Plume delineation → Georeferencing export: plume mask and source
- Georeferencing export → IME emission estimate: georeferenced plume
- GEOS-FP wind → IME emission estimate: wind input
- IME emission estimate → L4 results CSV: L4 values