pygmi.rsense.change#

Calculate change detection indices.

Classes#

CalculateChange

GUI to calculate change indices.

Functions#

calc_change(flist[, ilist, showlog, piter])

Calculate Change Indices.

calc_mean(flist[, showlog, piter])

Load data and calculate iterative Mean.

calc_sam(flist[, showlog, piter])

Load data and calculate spectral angle between two times.

coefv(mean, std)

Calculate coefficient of variation.

imean(mean, newdat[, cnt, M])

Calculate mean and variance parameters.

match_data(flist[, showlog, piter])

Match two datasets.

sam(s1, s2)

Calculate Spectral Angle Mapper (SAM).

scm(s1, s2)

SCM or MSAM.

stddev(M, cnt)

Calculate std deviation.

Module Contents#

class pygmi.rsense.change.CalculateChange(parent=None)#

Bases: pygmi.misc.BasicModule

GUI to calculate change indices.

Parameters:

parent (parent, optional) – Reference to the parent routine. The default is None.

setupui()#

Set up UI.

Return type:

None.

settings(nodialog=False)#

Entry point into item.

Parameters:

nodialog (bool, optional) – Run settings without a dialog. The default is False.

Returns:

True if successful, False otherwise.

Return type:

bool

saveproj()#

Save project data from class.

Return type:

None.

acceptall()#

Accept option.

Updates self.outdata, which is used as input to other modules.

Return type:

None.

setindices()#

Set the available indices.

Return type:

None.

invert_selection()#

Invert the selected indices.

Return type:

None.

set_selected_indices()#

Set the selected indices.

Return type:

None.

pygmi.rsense.change.calc_change(flist, ilist=None, showlog=print, piter=iter)#

Calculate Change Indices.

Parameters:
  • flist (list of RasterMeta.) – List of batch file list data.

  • ilist (list, optional) – List of strings describing index to calculate.

  • showlog (function, optional) – Display information. The default is print.

  • piter (function, optional) – Progress bar iterator. The default is iter.

Returns:

datfin – List of PyGMI Data.

Return type:

list of pygmi.raster.datatypes.Data

pygmi.rsense.change.calc_mean(flist, showlog=print, piter=iter)#

Load data and calculate iterative Mean.

Parameters:
  • flist (list of RasterMeta) – List of batch file list data.

  • showlog (function, optional) – Display information. The default is print.

  • piter (function, optional) – Progress bar iterator. The default is iter.

Returns:

  • meandat (dictionary of pygmi.raster.datatypes.Data.) – PyGMI Data representing means.

  • cnt (dictionary of numpy arrays) – Count of values which made up mean.

  • M (dictionary of numpy arrays) – Variance parameter, where Variance = M/cnt.

pygmi.rsense.change.calc_sam(flist, showlog=print, piter=iter)#

Load data and calculate spectral angle between two times.

Parameters:
  • flist (list of RasterMeta.) – List of batch file list data.

  • showlog (function, optional) – Display information. The default is print.

  • piter (function, optional) – Progress bar iterator. The default is iter.

Returns:

angle – PyGMI Data of SAM angles.

Return type:

pygmi.raster.datatypes.Data

pygmi.rsense.change.coefv(mean, std)#

Calculate coefficient of variation.

Parameters:
  • mean (numpy array) – numpy array of mean values.

  • std (numpy array) – numpy array of standard deviation values.

Returns:

cv – Array of coefficient of variation values.

Return type:

numpy array

pygmi.rsense.change.imean(mean, newdat, cnt=None, M=None)#

Calculate mean and variance parameters.

Parameters:
  • mean (numpy array) – existing mean values.

  • newdat (numpy array) – new data to be added to mean..

  • cnt (numpy array, optional) – cnt of values which made up mean. The default is None.

  • M (numpy array, optional) – Variance parameter, where Variance = M/cnt. The default is None.

Returns:

  • mean (numpy array) – Updated mean of data.

  • cnt (numpy array) – Updated cnt of values which made up mean.

  • M (numpy array) – Updated variance parameter, where Variance = M/cnt.

pygmi.rsense.change.match_data(flist, showlog=print, piter=iter)#

Match two datasets.

This routine also puts the datasets in order of date.

Parameters:
  • flist (list of RasterMeta or Data lists) – List of batch file list data.

  • showlog (function, optional) – Display information. The default is print.

  • piter (function, optional) – Progress bar iterator. The default is iter.

Returns:

  • dat1 (list of pygmi.raster.datatypes.Data) – First dataset with matched bands only.

  • dat2 (list of pygmi.raster.datatypes.Data) – Second dataset with matched bands only.

pygmi.rsense.change.sam(s1, s2)#

Calculate Spectral Angle Mapper (SAM).

Parameters:
  • s1 (numpy array) – Spectrum 1.

  • s2 (numpy array) – Spectrum 2.

Returns:

result – Output angles.

Return type:

numpy array

pygmi.rsense.change.scm(s1, s2)#

SCM or MSAM.

Parameters:
  • s1 (numpy array) – Spectrum 1.

  • s2 (numpy array) – Spectrum 2.

Returns:

result – Output angles.

Return type:

numpy array

pygmi.rsense.change.stddev(M, cnt)#

Calculate std deviation.

Parameters:
  • M (numpy array) – Variance parameter, where Variance = M/cnt.

  • cnt (numpy array) – cnt of values which made up mean.

Returns:

std – Calculated standard deviation.

Return type:

numpy array