isofit.utils.wavelength_cal

Functions

add_wavelength_elements(config_path[, state_type, ...])

average_columns(input_radiance_file, input_loc_file, ...)

Averages the columns of input radiance, location, and observation files

wavelength_cal(input_radiance, input_loc, input_obs, ...)

Runs a wavelength calibration on an input scene.

get_wavelength_adjustment(config_file[, output_file, ...])

Get the wavelength adjustment based on a previous isofit wavelength_cal run.

cli_get_wavelength_adjustment(debug_args, profile, ...)

cli_wavelength_cal(debug_args, profile, **kwargs)

Module Contents

add_wavelength_elements(config_path, state_type='shift', spline_indices=[])[source]
average_columns(input_radiance_file: str, input_loc_file: str, input_obs_file: str, output_radiance_file: str, output_loc_file: str, output_obs_file: str, start_column: int = None, end_column: int = None, column_interval: int = 1)[source]

Averages the columns of input radiance, location, and observation files and saves the results to output files.

Parameters:
  • input_radiance_file (str) – Path to the input radiance file.

  • input_loc_file (str) – Path to the input location file.

  • input_obs_file (str) – Path to the input observation file.

  • output_radiance_file (str) – Path to the output radiance file.

  • output_loc_file (str) – Path to the output location file.

  • output_obs_file (str) – Path to the output observation file.

  • start_column (int, optional) – Starting column index for averaging. Defaults to None, which means start from the first column.

  • end_column (int, optional) – Ending column index for averaging. Defaults to None, which means average until the last column.

  • column_interval (int, optional) – Step size over columns; skips, doesn’t average. Useful to increase runtime speeds.

Returns:

The number of rows in the averaged output files.

Return type:

rows (int)

wavelength_cal(input_radiance, input_loc, input_obs, working_directory, sensor, surface_path, copy_input_files=False, modtran_path=None, wavelength_path=None, surface_category='multicomponent_surface', rdn_factors_path=None, atmosphere_type='ATM_MIDLAT_SUMMER', channelized_uncertainty_path=None, model_discrepancy_path=None, lut_config_file=None, logging_level='INFO', log_file=None, n_cores=1, ray_temp_dir='/tmp/ray', emulator_base=None, prebuilt_lut=None, inversion_windows=None, wl_state_type='shift', spline_indices=[], force_with_geo=False, start_column=None, end_column=None, column_interval=1)[source]

Runs a wavelength calibration on an input scene.

Observation (obs) and location (loc) files are used to determine appropriate geometry lookup tables and provide a heuristic means of determining atmospheric water ranges.

 :param input_radiance: Radiance data cube. Expected to be ENVI format :type input_radiance: str :param input_loc: Location data cube of shape (Lon, Lat, Elevation). Expected to be ENVI format :type input_loc: str :param input_obs:

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

Parameters:
  • working_directory (str) – Directory to stage multiple outputs, will contain subdirectories

  • sensor (str) – The sensor used for acquisition, will be used to set noise and datetime settings

  • surface_path (str) – Path to surface model or json dict of surface model configuration

  • copy_input_files (bool, default=False) – Flag to choose to copy input_radiance, input_loc, and input_obs locally into the working_directory

  • modtran_path (str, default=None) – Location of MODTRAN utility. Alternately set with MODTRAN_DIR environment variable

  • wavelength_path (str, default=None) – Location to get wavelength information from, if not specified the radiance header will be used

  • surface_category (str, default="multicomponent_surface") – The type of ISOFIT surface priors to use. Default is multicomponent_surface

  • rdn_factors_path (str, default=None) – Specify a radiometric correction factor, if desired

  • atmosphere_type (str, default="ATM_MIDLAT_SUMMER") – Atmospheric profile to be used for MODTRAN simulations. Unused for other radiative transfer models.

  • channelized_uncertainty_path (str, default=None) – Path to a channelized uncertainty file

  • model_discrepancy_path (str, default=None) – Modifies S_eps in the OE formalism as the Gamma additive term, as: S_eps = Sy + Kb.dot(self.Sb).dot(Kb.T) + Gamma

  • lut_config_file (str, default=None) – Path to a look up table configuration file, which will override defaults choices

  • logging_level (str, default="INFO") – Logging level with which to run ISOFIT

  • log_file (str, default=None) – File path to write ISOFIT logs to

  • n_cores (int, default=1) – Number of cores to run ISOFIT with. Substantial parallelism is available, and full runs will be very slow in serial. Suggested to max this out on the available system

  • ray_temp_dir (str, default="/tmp/ray") – Location of temporary directory for ray parallelization engine

  • emulator_base (str, default=None) – Location of emulator base path. Point this at the model folder (or h5 file) of sRTMnet to use the emulator instead of MODTRAN. An additional file with the same basename and the extention _aux.npz must accompany e.g. /path/to/emulator.h5 /path/to/emulator_aux.npz

  • prebuilt_lut (str, default=None) – Use this pre-constructed look up table for all retrievals. Must be an ISOFIT-compatible RTE NetCDF

  • inversion_windows (list[float], default=None) – Override the default inversion windows. Will supercede any sensor specific defaults that are in place. Must be in 2-item tuples

  • force_with_geo (bool, default=False) – If True, will allow the wavelength_cal to run on georeferenced data. Not recommended, unless you really know what you are doing, or know your metadata is odd.

  • start_column (int, default=None) – Starting column index for averaging. Defaults to None, which means start from the first column.

  • end_column (int, default=None) – Ending column index for averaging. Defaults to None, which means average until the last column.

  • column_interval (int, default=1) – Step size over columns; skips, doesn’t average. Useful to increase runtime speeds.

get_wavelength_adjustment(config_file: str, output_file: str = None, filter_edges: int = 0)[source]

Get the wavelength adjustment based on a previous isofit wavelength_cal run.

Parameters:
  • config_file (str) – The configuration file for the wavelength_cal run.

  • output_file (str) – The file to write the wavelength adjustment to.

  • filter_edges (int) – number of edge columns to trim from average

Returns:

None

cli_get_wavelength_adjustment(debug_args, profile, **kwargs)[source]
cli_wavelength_cal(debug_args, profile, **kwargs)[source]