preprocess.atmospheric_correction
vhrharmonize.preprocess.atmospheric_correction
¶
Atmospheric correction step module.
Py6SRunResult
dataclass
¶
Summary of a shared Py6S run.
FLAASHRunResult
dataclass
¶
Summary of a shared FLAASH run.
AtmosphericCorrector
¶
Bases: Protocol
Atmospheric correction adapter interface.
run(input_raster, output_raster, **kwargs)
¶
Run correction and return output path.
Py6SCorrector
¶
Atmospheric correction adapter using Py6S.
run(input_raster, output_raster, **kwargs)
¶
Run block-wise Py6S atmospheric correction for multispectral rasters.
FLAASHCorrector
¶
Adapter around existing ENVI FLAASH execution helper.
run(input_raster, output_raster, **kwargs)
¶
Run FLAASH correction and return the output raster path.
build_py6s_kwargs_from_standardized_metadata(metadata, *, ground_elevation_km, atmosphere_profile, aerosol_profile, aot550, visibility_km, water_vapor, ozone, sixs_executable, output_scale_factor, output_dtype, use_imd_radiance_calibration, use_worldview_gain_offset_adjustment)
¶
Build shared Py6S keyword arguments. Args: metadata: Standardized metadata object. ground_elevation_km: Ground elevation in kilometers. atmosphere_profile: Requested atmosphere profile name. aerosol_profile: Requested aerosol profile name. aot550: Aerosol optical thickness at 550 nm. visibility_km: Optional visibility override in kilometers. water_vapor: Water vapor value in g/cm^2. ozone: Ozone value in cm-atm. sixs_executable: Optional 6S executable path. output_scale_factor: Optional output reflectance scale factor. output_dtype: Output raster dtype. use_imd_radiance_calibration: Whether to use IMD radiance calibration factors. use_worldview_gain_offset_adjustment: Whether to apply WorldView gain and offset adjustment. Returns: Provider-neutral Py6S keyword arguments.
run_py6s(input_raster, output_raster, metadata, *, ground_elevation_km, atmosphere_profile, aerosol_profile, aot550, visibility_km, water_vapor, ozone, sixs_executable, output_scale_factor, output_dtype, use_imd_radiance_calibration, use_worldview_gain_offset_adjustment, auto_atmos_source=None, bbox_wgs84=None, auto_atmos_grid_size=3, auto_atmos_search_days=1, auto_atmos_timeout_s=30.0, auto_atmos_power_endpoint='https://power.larc.nasa.gov/api/temporal/daily/point', log_to_console=False, scene_basename=None)
¶
Run Py6S correction using standardized metadata. Args: input_raster: Input raster path. output_raster: Output raster path. metadata: Standardized metadata object. ground_elevation_km: Ground elevation in kilometers. atmosphere_profile: Requested atmosphere profile name. aerosol_profile: Requested aerosol profile name. aot550: Aerosol optical thickness at 550 nm. visibility_km: Optional visibility override in kilometers. water_vapor: Water vapor value in g/cm^2. ozone: Ozone value in cm-atm. sixs_executable: Optional 6S executable path. output_scale_factor: Optional output reflectance scale factor. output_dtype: Output raster dtype. use_imd_radiance_calibration: Whether to use IMD radiance calibration factors. use_worldview_gain_offset_adjustment: Whether to apply WorldView gain and offset adjustment. auto_atmos_source: Optional automatic atmosphere source. bbox_wgs84: Optional WGS84 bbox used for automatic atmosphere lookup. auto_atmos_grid_size: Grid size used for automatic atmosphere lookup. auto_atmos_search_days: Search window in days for automatic atmosphere lookup. auto_atmos_timeout_s: Timeout in seconds for automatic atmosphere lookup. auto_atmos_power_endpoint: NASA POWER endpoint used for automatic atmosphere lookup. log_to_console: Whether to emit console logs. scene_basename: Optional scene basename for log prefixes. Returns: Py6S run summary.
init_envi_engine(envi_engine_path)
¶
Initialize the ENVI task engine used by FLAASH.
validate_flaash_params(flaash_params)
¶
Validate FLAASH params against the supported parameter list.
build_flaash_kwargs_from_standardized_metadata(input_raster, dem_file_path, footprint_vector_path, metadata, output_raster, *, dem_ground_percentile, modtran_atm, modtran_aer, use_aerosol, default_visibility, custom_params=None)
¶
Build validated shared FLAASH parameters. Args: input_raster: Input raster path. dem_file_path: DEM raster path. footprint_vector_path: Footprint vector path for DEM sampling. metadata: Standardized metadata object. output_raster: Output raster path. dem_ground_percentile: DEM percentile used for ground elevation estimation. modtran_atm: MODTRAN atmosphere profile name. modtran_aer: MODTRAN aerosol profile name. use_aerosol: FLAASH aerosol handling mode. default_visibility: Optional default visibility override. custom_params: Optional custom FLAASH parameter overrides. Returns: Validated FLAASH parameter dictionary.
wsl_path_to_windows_for_envi(path)
¶
Convert /mnt/<drive>/... WSL paths into Windows drive paths for ENVI.
convert_flaash_params_paths_for_windows(flaash_params)
¶
Convert FLAASH path params to Windows form for ENVI-on-Windows execution.
run_flaash_wrapper(args)
¶
Executor wrapper for FLAASH grid runs.
parallel_flaash(test_flaash_params_array, envi_engine, max_workers=4)
¶
Execute run_flaash in parallel on parameterized FLAASH runs.
run_flaash(input_raster, output_raster, *, metadata=None, dem_file_path=None, footprint_vector_path=None, envi_engine_path=None, envi_engine=None, output_params_path=None, convert_paths_for_windows=False, delete_output_before_run=None, params=None, dem_ground_percentile=50.0, modtran_atm='Mid-Latitude Summer', modtran_aer='Rural', use_aerosol='AUTO', default_visibility=None, custom_params=None, log_to_console=False)
¶
Run FLAASH using standardized metadata or explicit params. Args: input_raster: Input raster path. output_raster: Output raster path. metadata: Optional standardized metadata object. dem_file_path: Optional DEM raster path. footprint_vector_path: Optional footprint vector path. envi_engine_path: Optional ENVI engine executable path. envi_engine: Optional initialized ENVI engine. output_params_path: Optional executed-params output path. convert_paths_for_windows: Whether to convert paths for Windows ENVI execution. delete_output_before_run: Optional output path to delete before execution. params: Optional explicit FLAASH parameter dictionary. dem_ground_percentile: DEM percentile used for ground elevation estimation. modtran_atm: MODTRAN atmosphere profile name. modtran_aer: MODTRAN aerosol profile name. use_aerosol: FLAASH aerosol handling mode. default_visibility: Optional default visibility override. custom_params: Optional custom FLAASH parameter overrides. log_to_console: Whether to emit console logs. Returns: FLAASH run summary.
atmospheric_correction(input_raster, output_raster, method='flaash', **kwargs)
¶
Run atmospheric correction using the requested backend.