pygmi.maps#
A collection of functions for maps.
Classes#
Custom toolbar. |
|
Canvas Module. |
|
Data Layer Stack GUI. |
Functions#
|
Divides a decimal degree range into neat minute/degree intervals. |
|
Plot colour bar using discrete colours for a small range of values. |
|
Divides a decimal degree range into neat minute/degree intervals. |
|
Set the axes. |
|
Generate labels for x axis in degrees. |
|
Generate labels for x axis in metres. |
|
Generate labels for y axis in degrees. |
|
Generate labels for y axis in metres. |
|
Set the north arrow and the scale bar. |
|
Set the north arrow and the scale bar. |
|
Set the north arrow and the scale bar. |
|
Format thousands separator in ticks for plots. |
Module Contents#
- class pygmi.maps.CustomToolbar(canvas, parent)#
Bases:
matplotlib.backends.backend_qt.NavigationToolbar2QTCustom toolbar.
- add_map_btn(update, crs)#
Add map button.
- Parameters:
update (collections.abc.Callable) – Function which will update the map.
crs (pyproj.crs.CRS) – PyProj crs of data
- change_map()#
Refresh plot.
- class pygmi.maps.CanvasModule(parent=None)#
Bases:
matplotlib.backends.backend_qtagg.FigureCanvasQTAggCanvas Module.
- resizeEvent(event)#
Override Qt’s default resize event to suppress immediate rendering.
- Parameters:
event – Event variable, used to estimate size.
- set_map_axes(axes, crs)#
Set the map axes and north arrow.
- Parameters:
axes (matplotlib.axes.Axes) – Primary Matplotlib axes.
crs (pyproj.crs.CRS) – PyProj crs of data.
- class pygmi.maps.MapSettings(parent=None)#
Bases:
pygmi.misc.BasicModuleData Layer Stack GUI.
This class merges datasets which have different rows and columns. It resamples them so that they have the same rows and columns.
- Parameters:
parent – Reference to the parent routine. The default is None.
- 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
- pygmi.maps.dd2txt(dd, islon=True)#
Divides a decimal degree range into neat minute/degree intervals.
- Parameters:
start_dd – Minimum coordinate in decimal degrees.
end_dd – Maximum coordinate in decimal degrees.
num_intervals – Number of intervals
islon (bool) – Coordinates are longitudes, by default True
dd (float)
- Returns:
intervals (
ndarray) – Tick coordinates.txt (
listofstr) – List of coordinates in degrees and minutes.
- Return type:
str
- pygmi.maps.discrete_colorbar(axes, csp, cdat, lbls=None)#
Plot colour bar using discrete colours for a small range of values.
- Parameters:
axes (matplotlib.axes.Axes) – Current axes.
csp – Handle to Matplotlib plotting routine.
cdat (numpy.ma.MaskedArray | numpy.typing.NDArray) – Array of values.
lbls (list[str] | None) – y tick labels, by default None
- pygmi.maps.get_neat_intervals(start_dd, end_dd, num_intervals, islon=True)#
Divides a decimal degree range into neat minute/degree intervals.
- Parameters:
start_dd (float) – Minimum coordinate in decimal degrees.
end_dd (float) – Maximum coordinate in decimal degrees.
num_intervals (int) – Maximum number of intervals
islon (bool) – Coordinates are longitudes, by default True
- Returns:
intervals (
ndarray) – Tick coordinates.txt (
listofstr) – List of coordinates in degrees and minutes.
- Return type:
tuple[numpy.typing.NDArray, list[str]]
- pygmi.maps.set_axes(ax, crs, showdegrees=True, showmetres=True, xticks=10, yticks=10)#
Set the axes.
- Parameters:
ax (matplotlib.axes.Axes) – Primary Matplotlib axes.
crs (pyproj.crs.CRS | None) – PyProj crs of data.
showdegrees (bool) – Show degrees on the map border.
showmetres (bool) – Show metres on the map border.
xticks (int) – Maximum number of x-ticks, by default 10.
yticks (int) – Maximum number of y-ticks, by default 10.
- pygmi.maps.xlabels_dd(ax, crs, y, pad=15, num=10)#
Generate labels for x axis in degrees.
- pygmi.maps.xlabels_m(ax, pad=15, num=10)#
Generate labels for x axis in metres.
- pygmi.maps.ylabels_dd(ax, crs, x, pad=20, num=10)#
Generate labels for y axis in degrees.
- pygmi.maps.ylabels_m(ax, pad=15, num=10)#
Generate labels for y axis in metres.
- pygmi.maps.set_northscale(ax, crs, showlog=print)#
Set the north arrow and the scale bar.
- Parameters:
ax (matplotlib.axes.Axes) – Primary Matplotlib axes.
crs (pyproj.crs.CRS | None) – PyProj crs of data
showlog (collections.abc.Callable[..., None]) – Show information using a function, by default print
- pygmi.maps.set_north(ax, crs, showlog=print)#
Set the north arrow and the scale bar.
- Parameters:
ax (matplotlib.axes.Axes) – Primary Matplotlib axes.
crs (pyproj.crs.CRS | None) – PyProj crs of data
showlog (collections.abc.Callable[..., None]) – Show information using a function, by default print
- pygmi.maps.set_scale(ax, crs, showlog=print)#
Set the north arrow and the scale bar.
- Parameters:
ax (matplotlib.axes.Axes) – Primary Matplotlib axes.
crs (pyproj.crs.CRS | None) – PyProj crs of data
showlog (collections.abc.Callable[..., None]) – Show information using a function, by default print
- pygmi.maps.tick_formatter(x, pos)#
Format thousands separator in ticks for plots.
- Parameters:
x (float) – Number to be formatted.
pos (int) – Position of tick.
- Returns:
Formatted coordinate.
- Return type:
str