isofit.utils ============ .. py:module:: isofit.utils Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/isofit/utils/add_HRRR_profiles_to_modtran_config/index /autoapi/isofit/utils/algebraic_line/index /autoapi/isofit/utils/analytical_line/index /autoapi/isofit/utils/apply_oe/index /autoapi/isofit/utils/atm_interpolation/index /autoapi/isofit/utils/convert_6s_to_srtmnet/index /autoapi/isofit/utils/empirical_line/index /autoapi/isofit/utils/ewt_from_reflectance/index /autoapi/isofit/utils/extractions/index /autoapi/isofit/utils/generate_noise/index /autoapi/isofit/utils/instrument_model/index /autoapi/isofit/utils/interpolate_spectra/index /autoapi/isofit/utils/multicomponent_classification/index /autoapi/isofit/utils/reconstruct/index /autoapi/isofit/utils/reducers/index /autoapi/isofit/utils/remap/index /autoapi/isofit/utils/segment/index /autoapi/isofit/utils/skyview/index /autoapi/isofit/utils/solar_position/index /autoapi/isofit/utils/surface_model/index /autoapi/isofit/utils/template_construction/index /autoapi/isofit/utils/wavelength_cal/index Functions --------- .. autoapisummary:: isofit.utils.analytical_line isofit.utils.empirical_line isofit.utils.extractions isofit.utils.generate_noise isofit.utils.instrument_model isofit.utils.interpolate_spectra isofit.utils.multicomponent_classification isofit.utils.reconstruct_subs isofit.utils.remap isofit.utils.segment isofit.utils.surface_model Package Contents ---------------- .. py:function:: 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 .. py:function:: 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: numpy.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 :param reference_radiance_file: source file for radiance (interpolation built from this) :param reference_reflectance_file: source file for reflectance (interpolation built from this) :param reference_uncertainty_file: source file for uncertainty (interpolation built from this) :param reference_locations_file: source file for file locations (lon, lat, elev), (interpolation built from this) :param segmentation_file: input file noting the per-pixel segmentation used :param input_radiance_file: input radiance file (interpolate over this) :param input_locations_file: input location file (interpolate over this) :param output_reflectance_file: location to write output reflectance to :param output_uncertainty_file: location to write output uncertainty to :param nneighbors: number of neighbors to use for interpolation :param nodata_value: nodata value of input and output :param level: logging level :param logfile: logging file :param radiance_factors: radiance adjustment factors :param isofit_config: path to isofit configuration JSON file :param n_cores: number of cores to run on :param reference_class_file: optional source file for sub-type-classifications, in order: [base, cloud, water] :param segmentation_size: Number of super pixels :returns: None .. py:function:: 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') ... .. py:function:: generate_noise(config) Add noise to a radiance spectrum or image. .. py:function:: instrument_model(config) . .. py:function:: 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.  :param infile: Input file that contains the wavelengths to be interpolated. :type infile: str :param inplace: Flag to tell algorithm to write to new file (False) or write to input file (True) :type inplace: bool :param outfile: Output lcoation for the interpolated wavelengths :type outfile: str :param nodata_value: No data value to check against, and interpolate across Flexible typing in numpy boolean operations means this could be float or int :type nodata_value: float :param n_cores: Number of cores to run. Substantial parallelism is available Defaults to maxing this out on the available system (-1) :type n_cores: int :param logfile: File path to write logs to :type logfile: str :param loglevel: Logging level with which to run ISOFIT :type loglevel: str .. py:function:: 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.  :param rdn_file: Radiance data cube. Expected to be ENVI format :type rdn_file: str :param obs_file: Location data cube of shape (Lon, Lat, Elevation). Expected to be ENVI format :type obs_file: str :param loc_file: 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 :type loc_file: str :param out_file: Output path to location where to save output file. :type out_file: str :param surface_files: CLI entry into the classifier uses a .mat or a .json file Apply OE entry into the classifier uses a dict argument. :type surface_files: str or dict :param wavelength_file: Standard ISOFIT wavelength file :type wavelength_file: str :param n_cores: Number of cores to run classifier with. :type n_cores: int, default=1 :param dayofyear: Day of year for earth-sun distance calculation :type dayofyear: int :param irr_file: Path to irradiance file to use in the classification :type irr_file: str :param clean: Experimental method to filter out noisy classification masks. Creates connected binary components and filters out small features. :type clean: str :param thresh: Threshold size to filter out features smaller than this number of pixels. :type thresh: int :param loglevel: Logging level to use (e.g. DEBUG, INFO, etc.) :type loglevel: str :param logfile: Output location for logging file if writing to disk. :type logfile: str .. py:function:: 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. :param input_subs_path: Input subs file path. :param output_path: Output reconstructed file path. :param lbl_working_path: File path to label file for reconstruction. :returns: None .. py:function:: remap(inputfile, labels, outputfile, flag, chunksize) . .. py:function:: 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. :param spectra: tuple of filepaths of image to segment and (optionally) output label file :param nodata_value: data to ignore in radiance image :param npca: number of pca components to use :param segsize: mean segmentation size :param nchunk: size of each image chunk :param n_cores: number of cores to use :param ray_address: ray address to connect to (for multinode implementation) :param ray_redis_password: ray password to use (for multinode implementation) :param ray_temp_dir: ray temp directory to reference :param ray_ip_head: ray ip head to reference (for multinode use) :param logfile: logging file to output to :param loglevel: logging level to use .. py:function:: 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. :param config_path: path to a JSON formatted surface model configuration :param wavelength_path: optional path to a three-column wavelength file, overriding the configuration file settings :param output_path: optional path to the destination .mat file, overriding the configuration file settings :param seed: seed used for clustering :returns: None