Skip to content

Mask Raster

Module: spectralbridge.mask_raster.

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.

mask_raster_with_polygons

mask_raster_with_polygons(envi_file: Union[NEONReflectanceENVIFile, NEONReflectanceBRDFCorrectedENVIFile, NEONReflectanceResampledENVIFile], geojson_path, raster_crs_override=None, polygons_crs_override=None, plot_output=False, plot_filename=None, dpi=300)

Masks an ENVI raster using polygons from a GeoJSON file.

Parameters:

envi_file : DataFile ENVI raster file type object. geojson_path : str Path to the GeoJSON file containing polygons. raster_crs_override : str, optional CRS to assign to the raster if it's undefined (e.g., 'EPSG:4326'). polygons_crs_override : str or CRS, optional CRS to assign to the polygons if they're undefined. output_masked_suffix : str, optional Suffix to append to the masked raster filename. plot_output : bool, optional Whether to generate and save plots of the results. plot_filename : str, optional Filename for the saved plot. dpi : int, optional Resolution of the saved plot in dots per inch.

Raises:

FileNotFoundError If the ENVI raster or GeoJSON file does not exist. ValueError If CRS assignments are needed but not provided.

Returns:

masked_raster_path : str Path to the saved masked raster file.

Audience: advanced.

find_raster_files

find_raster_files(directory)

Finds raster files ending with '_reflectance', '_envi', or '.img' while excluding files ending in '.json', '.hdr', or containing '_mask' or '_ancillary'.