pygmi.raster.equation_editor#

Equation editor for raster data.

Classes#

EquationEditor

Equation Editor.

Functions#

eqedit(data, equation[, dtype, showlog, piter])

Use equations on raster data.

eq_fix(indata, equation[, showlog])

Corrects names in equation to variable names.

hmode(data)

Use a histogram to generate a fast mode estimate.

mosaic(eq, localdict)

Mosaics data into a single band dataset.

mean(eq, localdict)

Get mean pixel value of all input bands.

detrend(eq, localdict)

Get mean pixel value of all input bands.

std(eq, localdict)

Get standard deviation pixel value of all input bands.

Module Contents#

class pygmi.raster.equation_editor.EquationEditor(parent=None)#

Bases: pygmi.misc.BasicModule

Equation Editor.

This class allows the input of equations using raster datasets as variables. This is commonly done in remote sensing applications, where there is a requirement for band ratioing etc. It uses the numexpr library.

Parameters:

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

equation#

string with the equation in it

Type:

str

bands#

dictionary of bands

Type:

dictionary

setupui()#

Set up UI.

Return type:

None.

combo()#

Update combo information.

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.

pygmi.raster.equation_editor.eqedit(data, equation, dtype='auto', showlog=print, piter=iter)#

Use equations on raster data.

Parameters:
  • data (list) – List of PyGMI raster data.

  • equation (str) – Equation to compute.

  • dtype (str, optional) – The data type of the output dataset. The default is ‘auto’.

  • showlog (function, optional) – Show information using a function. The default is print.

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

Returns:

List of PyGMI raster data.

Return type:

list

pygmi.raster.equation_editor.eq_fix(indata, equation, showlog=print)#

Corrects names in equation to variable names.

Parameters:
  • indata (list of pygmi.raster.datatypes.Data.) – PyGMI raster dataset.

  • equation (str) – Equation to fix.

  • showlog (function, optional) – Show information using a function. The default is print.

Returns:

neweq – Corrected equation.

Return type:

str

pygmi.raster.equation_editor.hmode(data)#

Use a histogram to generate a fast mode estimate.

Parameters:

data (list) – list of values to generate the mode from.

Returns:

mode2 – mode value.

Return type:

float

pygmi.raster.equation_editor.mosaic(eq, localdict)#

Mosaics data into a single band dataset.

Parameters:
  • eq (str) – Equation with mosaic command.

  • localdict (dictionary) – Dictionary of data.

Returns:

master – Output array.

Return type:

numpy array

pygmi.raster.equation_editor.mean(eq, localdict)#

Get mean pixel value of all input bands.

Parameters:
  • eq (str) – Equation with std command.

  • localdict (dictionary) – Dictionary of data.

Returns:

findat – Output array.

Return type:

numpy array

pygmi.raster.equation_editor.detrend(eq, localdict)#

Get mean pixel value of all input bands.

Parameters:
  • eq (str) – Equation with std command.

  • localdict (dictionary) – Dictionary of data.

Returns:

findat – Output array.

Return type:

numpy array

pygmi.raster.equation_editor.std(eq, localdict)#

Get standard deviation pixel value of all input bands.

Parameters:
  • eq (str) – Equation with std command.

  • localdict (dictionary) – Dictionary of data.

Returns:

findat – Output array.

Return type:

numpy array