Index
source package isofit.utils
Functions
-
analytical_line — TODO: Description
-
empirical_line — Perform an empirical line interpolation for reflectance and uncertainty extrapolation Args: reference_radiance_file: source file for radiance (interpolation built from this) reference_reflectance_file: source file for reflectance (interpolation built from this) reference_uncertainty_file: source file for uncertainty (interpolation built from this) reference_locations_file: source file for file locations (lon, lat, elev), (interpolation built from this) segmentation_file: input file noting the per-pixel segmentation used input_radiance_file: input radiance file (interpolate over this) input_locations_file: input location file (interpolate over this) output_reflectance_file: location to write output reflectance to output_uncertainty_file: location to write output uncertainty to
-
extractions — ...
-
generate_noise — Add noise to a radiance spectrum or image.
-
instrument_model — .
-
interpolate_spectra — Interpolate wavelength bands that are either no data or Nan. The interpolation will only be applied to pixel-vectors that include partial NaNs. This is meant to be used if the number of wavelengths missing is minor, and has not been widely tested if a large number of wavelength vlues are missing.
-
multicomponent_classification — Classify a radiance file based on a per-pixel prior selection. The classification leverages the same methodology ISOFIT uses to select a prior distribution from an input .json or .mat file.
-
reconstruct_subs — Helper function to take the flat array that the superpixel algorithms work with and turn them into images at the full resolution of the input/output file. They will have the full array-resolution, but appear as coarser pixel-resolution images.
-
remap — .
-
segment — Segment an image using SLIC on a PCA.
-
surface_model — The surface model tool contains everything you need to build basic multicomponent (i.e. colleciton of Gaussian) surface priors for the multicomponent surface model.
source analytical_line(rdn_file: str, loc_file: str, obs_file: str, isofit_dir: str, isofit_config: str = None, segmentation_file: str = None, n_atm_neighbors: list = [20], n_cores: int = -1, num_iter: int = 1, smoothing_sigma: list = [2], output_rfl_file: str = None, output_unc_file: str = None, atm_file: str = None, skyview_factor_file: str = None, loglevel: str = 'INFO', logfile: str = None, initializer: str = 'algebraic', segmentation_size: int = 40) → None
TODO: Description
source empirical_line(reference_radiance_file: str, reference_reflectance_file: str, reference_uncertainty_file: str, reference_locations_file: str, segmentation_file: str, input_radiance_file: str, input_locations_file: str, output_reflectance_file: str, output_uncertainty_file: str, nneighbors: int = 400, nodata_value: float = -9999.0, level: str = 'INFO', logfile: str = None, radiance_factors: np.array = None, isofit_config: str = None, n_cores: int = -1, reference_class_file: str = None, segmentation_size: int = 40) → None
Perform an empirical line interpolation for reflectance and uncertainty extrapolation Args: reference_radiance_file: source file for radiance (interpolation built from this) reference_reflectance_file: source file for reflectance (interpolation built from this) reference_uncertainty_file: source file for uncertainty (interpolation built from this) reference_locations_file: source file for file locations (lon, lat, elev), (interpolation built from this) segmentation_file: input file noting the per-pixel segmentation used input_radiance_file: input radiance file (interpolate over this) input_locations_file: input location file (interpolate over this) output_reflectance_file: location to write output reflectance to output_uncertainty_file: location to write output uncertainty to
nneighbors: number of neighbors to use for interpolation
nodata_value: nodata value of input and output
level: logging level
logfile: logging file
radiance_factors: radiance adjustment factors
isofit_config: path to isofit configuration JSON file
n_cores: number of cores to run on
reference_class_file: optional source file for sub-type-classifications, in order: [base, cloud, water]
segmentation_size: Number of super pixels
Returns: None
Raises
-
IndexError
source extractions(inputfile, labels, output, chunksize, flag, reducer: FunctionType, n_cores: int = 1, ray_address: str = None, ray_redis_password: str = None, ray_temp_dir: str = None, ray_ip_head=None, logfile: str = None, loglevel: str = 'INFO')
...
source generate_noise(config)
Add noise to a radiance spectrum or image.
Raises
-
ValueError
source instrument_model(config)
.
source interpolate_spectra(infile: str, outfile: str = '', inplace: bool = False, nodata_value: float = -9999.0, n_cores: int = -1, ray_address: str = None, ray_redis_password: str = None, ray_temp_dir: str = None, ray_ip_head=None, task_inflation_factor: int = 1, logfile: str = None, loglevel: str = 'INFO')
Interpolate wavelength bands that are either no data or Nan. The interpolation will only be applied to pixel-vectors that include partial NaNs. This is meant to be used if the number of wavelengths missing is minor, and has not been widely tested if a large number of wavelength vlues are missing.
The interpolation will do two checks. One for "nodata values," the other for NaN values. Motivated by some sensor products which have rdn data with both no data, and NaN values.
Parameters
infile: str Input file that contains the wavelengths to be interpolated. inplace: bool Flag to tell algorithm to write to new file (False) or write to input file (True) outfile: str Output lcoation for the interpolated wavelengths nodata_value: float No data value to check against, and interpolate across Flexible typing in numpy boolean operations means this could be float or int n_cores: int Number of cores to run. Substantial parallelism is available Defaults to maxing this out on the available system (-1) logfile: str File path to write logs to loglevel: str Logging level with which to run ISOFIT
Raises
-
ValueError
source multicomponent_classification(rdn_file: str, obs_file: str, loc_file: str, out_file: str, surface_files: str, wavelength_file: std, n_cores: int = -1, dayofyear: int = None, irr_file: str = None, clean: bool = False, thresh: int = 100, ray_address: str = None, ray_redis_password: str = None, ray_temp_dir=None, ray_ip_head=None, loglevel: str = 'INFO', logfile: str = None)
Classify a radiance file based on a per-pixel prior selection. The classification leverages the same methodology ISOFIT uses to select a prior distribution from an input .json or .mat file.
Parameters
rdn_file: str Radiance data cube. Expected to be ENVI format obs_file: str Location data cube of shape (Lon, Lat, Elevation). Expected to be ENVI format loc_file: str Observation data cube of shape: (path length, to-sensor azimuth, to-sensor zenith, to-sun azimuth, to-sun zenith, phase, slope, aspect, cosine i, UTC time) Expected to be ENVI format out_file: str Output path to location where to save output file. surface_files: str or dict CLI entry into the classifier uses a .mat or a .json file Apply OE entry into the classifier uses a dict argument. wavelength_file: str Standard ISOFIT wavelength file n_cores : int, default=1 Number of cores to run classifier with. dayofyear: int Day of year for earth-sun distance calculation irr_file: str Path to irradiance file to use in the classification clean: str Experimental method to filter out noisy classification masks. Creates connected binary components and filters out small features. thresh: int Threshold size to filter out features smaller than this number of pixels. loglevel: str Logging level to use (e.g. DEBUG, INFO, etc.) logfile: str Output location for logging file if writing to disk.
Raises
-
ValueError
source reconstruct_subs(input_subs_path, output_path, lbl_working_path)
Helper function to take the flat array that the superpixel algorithms work with and turn them into images at the full resolution of the input/output file. They will have the full array-resolution, but appear as coarser pixel-resolution images.
args
input_subs_path: Input subs file path.
output_path: Output reconstructed file path.
lbl_working_path: File path to label file for reconstruction.
returns
None
source remap(inputfile, labels, outputfile, flag, chunksize)
.
source segment(spectra: tuple, nodata_value: float, npca: int, segsize: int, nchunk: int, n_cores: int = 1, ray_address: str = None, ray_redis_password: str = None, ray_temp_dir=None, ray_ip_head=None, logfile=None, loglevel='INFO')
Segment an image using SLIC on a PCA.
Parameters
-
spectra : tuple — tuple of filepaths of image to segment and (optionally) output label file
-
nodata_value : float — data to ignore in radiance image
-
npca : int — number of pca components to use
-
segsize : int — mean segmentation size
-
nchunk : int — size of each image chunk
-
n_cores : int — number of cores to use
-
ray_address : str — ray address to connect to (for multinode implementation)
-
ray_redis_password : str — ray password to use (for multinode implementation)
-
ray_temp_dir — ray temp directory to reference
-
ray_ip_head — ray ip head to reference (for multinode use)
-
logfile — logging file to output to
-
loglevel — logging level to use
source surface_model(config_path: str, wavelength_path: str = None, output_path: str = None, seed: int = 13, multisurface: bool = False) → None
The surface model tool contains everything you need to build basic multicomponent (i.e. colleciton of Gaussian) surface priors for the multicomponent surface model.
Parameters
-
config_path : str — path to a JSON formatted surface model configuration wavelength_path: optional path to a three-column wavelength file, overriding the configuration file settings output_path: optional path to the destination .mat file, overriding the configuration file settings seed: seed used for clustering
-
Returns — None
Raises
-
ValueError
-
IndexError
-
AttributeError