pygmi.raster.cooper#
A collection of routines by Gordon Cooper for filtering raster data.
Classes#
Class used to gather information via a GUI, for function gradients. |
|
Class used to gather information via a GUI, for function visibility2d. |
|
Class used to gather information via a GUI, for function AGC. |
Functions#
|
Gradients. |
|
Gradients. |
|
Compute derivative ratio of image data. Based on code by Gordon Cooper. |
|
Compute visibility as a textural measure. |
|
Compute visibility as a textural measure. |
|
Next power of 2. |
|
AGC for map data, based on code by Gordon Cooper. |
Module Contents#
- class pygmi.raster.cooper.Gradients(parent=None)#
Bases:
pygmi.misc.BasicModuleClass used to gather information via a GUI, for function gradients.
- Parameters:
parent – Reference to the parent routine. The default is None.
- azi#
Azimuth/filter direction (degrees)
- Type:
float
- elev#
Elevation (for sunshading, degrees from horizontal)
- Type:
float
- order#
Order of DR filter - see paper. Try 1 first.
- Type:
int
- setupui()#
Set up UI.
- settings(nodialog=False)#
Entry point into item.
- Parameters:
nodialog (bool) – Run settings without a dialog. The default is False.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- saveproj()#
Save project data from class.
- radiochange()#
Check radio button state.
- pygmi.raster.cooper.gradients(data, azi, xint, yint)#
Gradients.
Compute directional derivative of image data. Based on code by Gordon Cooper.
- Parameters:
data (numpy.typing.NDArray) – input numpy data array
azi (float) – Filter direction (degrees)
xint (float) – X interval/distance.
yint (float) – Y interval/distance.
- Returns:
returns directional derivative
- Return type:
float
- pygmi.raster.cooper.thgrad(data, xint, yint)#
Gradients.
Compute total horizontal gradient.
- Parameters:
data (numpy.typing.NDArray) – input numpy data array
xint (float) – X interval/distance.
yint (float) – Y interval/distance.
- Returns:
returns total horizontal gradient.
- Return type:
float
- pygmi.raster.cooper.derivative_ratio(data, azi, order)#
Compute derivative ratio of image data. Based on code by Gordon Cooper.
- Parameters:
data (numpy.typing.NDArray) – input numpy data array
azi (float) – Filter direction (degrees)
order (float) – Order of DR filter - see paper. Try 1 first.
- Returns:
returns derivative ratio
- Return type:
float
- class pygmi.raster.cooper.Visibility2d(parent=None)#
Bases:
pygmi.misc.BasicModuleClass used to gather information via a GUI, for function visibility2d.
- Parameters:
parent – Reference to the parent routine. The default is None.
- wsize#
window size, must be odd
- Type:
int
- dh#
height of observer above surface
- Type:
float
- setupui()#
Set up UI.
- settings(nodialog=False)#
Entry point into item.
- Parameters:
nodialog (bool) – Run settings without a dialog. The default is False.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- saveproj()#
Save project data from class.
- pygmi.raster.cooper.visibility2d(idata, wsize, dh, piter=iter)#
Compute visibility as a textural measure.
Compute vertical derivatives by calculating the visibility at different heights above the surface (see paper)
- Parameters:
data – input dataset - numpy MxN array
wsize (int) – window size, must be odd
dh (float) – height of observer above surface
piter (collections.abc.Iterable) – Progress bar iterable. The default is iter.
idata (numpy.ma.MaskedArray)
- Returns:
vtot (
MaskedArray) – Total visibility.vstd (
MaskedArray) – Visibility variation.vsum (
MaskedArray) – Visibility vector resultant.
- Return type:
tuple[numpy.ma.MaskedArray, numpy.ma.MaskedArray, numpy.ma.MaskedArray]
- pygmi.raster.cooper.visibilitytot(data, wsize, dh)#
Compute visibility as a textural measure.
Compute vertical derivatives by calculating the visibility at different heights above the surface (see paper)
- Parameters:
data (numpy.typing.NDArray) – input dataset - numpy MxN array
wsize (int) – window size, must be odd
dh (float) – height of observer above surface
- Returns:
Total visibility.
- Return type:
ndarray
- pygmi.raster.cooper.nextpow2(n)#
Next power of 2.
- Parameters:
n (float | numpy.typing.NDArray) – Current value, can be float or array.
- Returns:
Output.
- Return type:
floatornumpy array
- class pygmi.raster.cooper.AGC(parent=None)#
Bases:
pygmi.misc.BasicModuleClass used to gather information via a GUI, for function AGC.
- Parameters:
parent – Reference to the parent routine. The default is None.
- wsize#
window size, must be odd
- Type:
int
- setupui()#
Set up UI.
- settings(nodialog=False)#
Entry point into item.
- Parameters:
nodialog (bool) – Run settings without a dialog. The default is False.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- saveproj()#
Save project data from class.
- pygmi.raster.cooper.agc(idata, wsize, atype='mean', nodata=0.0, piter=iter)#
AGC for map data, based on code by Gordon Cooper.
- Parameters:
idata (numpy.ma.MaskedArray) – Raster data.
wsize (int) – Window size, must be odd.
atype (str) – AGC type - can be median, rms or mean, default is ‘mean’.
nodata (float) – no data value, default is 0.
piter (collections.abc.Iterable) – Progress bar iterable. The default is iter.
- Returns:
Output AGC data
- Return type:
MaskedArray