pygmi.raster.ginterp#
Raster data display.
This is the raster data display 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#
Matplotlib canvas widget for the actual plot. |
|
Canvas widget for the sunshading tool. |
|
The primary GUI class for the raster data interpretation module. |
Module Contents#
- class pygmi.raster.ginterp.MyMplCanvas#
Bases:
matplotlib.backends.backend_qtagg.FigureCanvasQTAggMatplotlib canvas widget for the actual plot.
- htype#
String indicating the histogram stretch to apply to the 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:
listofData
- sdata#
List of PyGMI raster data objects - used for shaded images
- Type:
listofData
- 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.
- init_graph(interp='auto')#
Initialize the graph.
- move(event)#
Mouse is moving over canvas.
- Parameters:
event (
MouseEvent) – Mouse event.
- update_contour()#
Update contours.
- update_graph()#
Update plot.
- update_hist_rgb(zval)#
Update the rgb histograms.
- Parameters:
zval (numpy.typing.NDArray) – Data values.
- Returns:
List of bin numbers.
- Return type:
list
- update_hist_single(zval=None, hno=0)#
Update the colour on a single histogram.
- Parameters:
zval (float | None) – Data value.
hno (int) – Histogram number. The default is 0.
- Returns:
Number of bins.
- Return type:
int
- update_hist_text(hst, zval)#
Update the value on the histogram.
- Parameters:
hst – Histogram.
zval (float) – Data value.
- update_rgb()#
Update the RGB Ternary Map.
- update_single_color_map()#
Update the single colour map.
- update_shade()#
Update sun shade plot.
- update_shade_plot()#
Update shade plot for export.
- Returns:
Sunshader data, or 1 if nor sun shading.
- Return type:
ndarrayorint
- class pygmi.raster.ginterp.MySunCanvas#
Bases:
matplotlib.backends.backend_qtagg.FigureCanvasQTAggCanvas widget for the sunshading tool.
- init_graph()#
Initialise graph.
- class pygmi.raster.ginterp.PlotInterp(parent=None)#
Bases:
pygmi.misc.BasicModuleThe 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 – Reference to the parent routine. The default is None.
- self.mmc#
Main canvas containing the image.
- Type:
- self.msc#
Small canvas containing the sunshading control.
- Type:
- setupui()#
Set up UI.
- change_allclip()#
Change all clip percentages to the current one.
- change_blue()#
Change the blue or third display band.
- change_cbar()#
Change the colour map for the colour bar.
- change_clipband()#
Change the clip percentage band.
- change_dtype()#
Change display type.
- change_interp()#
Change the interpolation method.
- change_green()#
Change the green or second band.
- change_htype()#
Change the histogram stretch to apply to the normal data.
- change_kval()#
Change the CMYK K value.
- change_lclip()#
Change the linear clip percentage.
- change_red()#
Change the red or first band.
- change_sun()#
Change the sunshade band.
- change_sun_checkbox()#
Use when sunshading checkbox is clicked.
- change_sunsliders()#
Change the sun shading sliders.
- 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.
- set_minmax()#
Get minimum and maximum of histogram band.
- move(event)#
Move event is used to track changes to the sunshading.
- Parameters:
event (matplotlib.backend_bases.MouseEvent) – Mouse event.
- run()#
Entry point into the routine, used to run context menu item.
- save_png()#
Save image as a PNG.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- 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) – Run settings without a dialog. The default is False.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- saveproj()#
Save project data from class.