pygmi.raster.ginterp#

Plot Raster Data.

This is the raster data interpretation module. This module allows for the display of raster data in a variety of modes, as well as the export of that display to GeoTIFF format.

Currently the following is supported
  • Pseudo Colour - data mapped to a colour map

  • Contours with solid contours

  • RGB ternary images

  • CMYK ternary images

  • Sun shaded or hill shaded images

It can be very effectively used in conjunction with a GIS package which supports GeoTIFF files.

Classes#

MyMplCanvas

Matplotlib canvas widget for the actual plot.

MySunCanvas

Canvas widget for the sunshading tool.

PlotInterp

The primary GUI class for the raster data interpretation module.

Module Contents#

class pygmi.raster.ginterp.MyMplCanvas(parent=None)#

Bases: matplotlib.backends.backend_qtagg.FigureCanvasQTAgg

Matplotlib canvas widget for the actual plot.

Parameters:

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

htype#

string indicating the histogram stretch to apply to the data

Type:

str

hstype#

string indicating the histogram stretch to apply to the sun data

Type:

str

cbar#

colour map to be used for pseudo colour bars

Type:

matplotlib colour map

data#

list of PyGMI raster data objects - used for colour images

Type:

list of pygmi.raster.datatypes.Data

sdata#

list of PyGMI raster data objects - used for shaded images

Type:

list of pygmi.raster.datatypes.Data

gmode#

string containing the graphics mode - Contour, Ternary, Sunshade, Single Colour Map.

Type:

str

argb#

list of matplotlib subplots. There are up to three.

Type:

list

hhist#

matplotlib hist associated with argb

Type:

list

hband#

list of strings containing the band names to be used.

Type:

list

htxt#

list of strings associated with hhist, denoting a raster value (where mouse is currently hovering over on image)

Type:

list

image#

imshow instance - this is the primary way of displaying an image.

Type:

imshow

cnt#

contour instance - used for the contour image

Type:

matplotlib contour

cntf#

contourf instance - used for the contour image

Type:

matplotlib contourf

background#

image bounding box - used in blitting

Type:

matplotlib bounding box

bbox_hist_red#

red histogram bounding box

Type:

matplotlib bounding box

bbox_hist_green#

green histogram bounding box

Type:

matplotlib bounding box

bbox_hist_blue#

blue histogram bounding box

Type:

matplotlib bounding box

axes#

axes for the plot

Type:

matplotlib axes

pinit#

calculated with aspect - used in sunshading

Type:

numpy array

qinit#

calculated with aspect - used in sunshading

Type:

numpy array

phi#

azimuth (sunshading)

Type:

float

theta#

sun elevation (sunshading)

Type:

float

cell#

between 1 and 100 - controls sunshade detail.

Type:

float

alpha#

how much incident light is reflected (0 to 1)

Type:

float

kval#

k value for CMYK mode

Type:

float

revent(event)#

Resize event.

Parameters:

event (matplotlib.backend_bases.ResizeEvent) – Resize event.

Return type:

None.

init_graph()#

Initialize the graph.

Return type:

None.

move(event)#

Mouse is moving over canvas.

Parameters:

event (matplotlib.backend_bases.MouseEvent) – Mouse event.

Return type:

None.

update_contour()#

Update contours.

Return type:

None.

update_graph()#

Update plot.

Return type:

None.

update_hist_rgb(zval)#

Update the rgb histograms.

Parameters:

zval (numpy array) – Data values.

Returns:

bnum – Bin numbers.

Return type:

list

update_hist_single(zval=None, hno=0)#

Update the colour on a single histogram.

Parameters:
  • zval (float) – Data value.

  • hno (int, optional) – Histogram number. The default is 0.

Returns:

binnum – Number of bins.

Return type:

int

update_hist_text(hst, zval)#

Update the value on the histogram.

Parameters:
  • hst (histogram) – Histogram.

  • zval (float) – Data value.

Return type:

None.

update_rgb()#

Update the RGB Ternary Map.

Return type:

None.

update_single_color_map()#

Update the single colour map.

Return type:

None.

update_shade()#

Update sun shade plot.

Return type:

None.

update_shade_plot()#

Update shade plot for export.

Returns:

Sunshader data.

Return type:

numpy array

class pygmi.raster.ginterp.MySunCanvas(parent=None)#

Bases: matplotlib.backends.backend_qtagg.FigureCanvasQTAgg

Canvas widget for the sunshading tool.

Parameters:

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

sun#

plot of a circle ‘o’ showing where the sun is

Type:

matplotlib plot instance

axes#

axes on which the sun is drawn

Type:

matplotlib axes instance

init_graph()#

Initialise graph.

Return type:

None.

class pygmi.raster.ginterp.PlotInterp(parent=None)#

Bases: pygmi.misc.BasicModule

The primary GUI class for the raster data interpretation module.

The main interface is set up from here, as well as monitoring of the mouse over the sunshading.

The PlotInterp class allows for the display of raster data in a variety of modes, as well as the export of that display to GeoTIFF format.

Parameters:

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

self.mmc#

main canvas containing the image

Type:

pygmi.raster.ginterp.MyMplCanvas, FigureCanvas

self.msc#

small canvas containing the sunshading control

Type:

pygmi.raster.ginterp.MySunCanvas, FigureCanvas

setupui()#

Set up UI.

Return type:

None.

change_allclip()#

Change all clip percentages to the current one.

Return type:

None.

change_blue()#

Change the blue or third display band.

Return type:

None.

change_cbar()#

Change the colour map for the colour bar.

Return type:

None.

change_clipband()#

Change the clip percentage band.

Return type:

None.

change_dtype()#

Change display type.

Return type:

None.

change_green()#

Change the green or second band.

Return type:

None.

change_htype()#

Change the histogram stretch to apply to the normal data.

Return type:

None.

change_kval()#

Change the CMYK K value.

Return type:

None.

change_lclip()#

Change the linear clip percentage.

Return type:

None.

change_red()#

Change the red or first band.

Return type:

None.

change_sun()#

Change the sunshade band.

Return type:

None.

change_sun_checkbox()#

Use when sunshading checkbox is clicked.

Return type:

None.

change_sunsliders()#

Change the sun shading sliders.

Return type:

None.

data_init()#

Initialise Data.

Entry point into routine. This entry point exists for the case where data must be initialised before entering at the standard ‘settings’ sub module.

Return type:

None.

move(event)#

Move event is used to track changes to the sunshading.

Parameters:

event (matplotlib.backend_bases.MouseEvent) – Mouse event.

Return type:

None.

run()#

Entry point into the routine, used to run context menu item.

save_img()#

Save image as a GeoTIFF.

Returns:

True if successful, False otherwise.

Return type:

bool

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.