pygmi.vector package¶
Submodules¶
pygmi.vector.dataprep module¶
Data Preparation for Vector Data.
- class pygmi.vector.dataprep.DataGrid(parent=None)¶
Bases:
BasicModule
Grid Point Data.
This class grids point data using a nearest neighbourhood technique.
- acceptall()¶
Accept option.
Updates self.outdata, which is used as input to other modules.
- Return type:
None.
- dxy_change()¶
When dxy is changed on the interface, this updates rows and columns.
- Return type:
None.
- grid_method_change()¶
When grid method is changed, this updated hidden controls.
- Return type:
None.
- saveproj()¶
Save project data from class.
- 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
- setupui()¶
Set up UI.
- Return type:
None.
- class pygmi.vector.dataprep.DataReproj(parent=None)¶
Bases:
BasicModule
Reprojections.
This class reprojects datasets using the rasterio routines.
- acceptall()¶
Accept option.
Updates self.outdata, which is used as input to other modules.
- Return type:
None.
- saveproj()¶
Save project data from class.
- 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
- setupui()¶
Set up UI.
- Return type:
None.
- class pygmi.vector.dataprep.Metadata(parent=None)¶
Bases:
ContextModule
Edit Metadata.
This class allows the editing of the metadata for a vector dataset using a GUI.
- banddata¶
band data
- Type:
dictionary
- bandid¶
dictionary of strings containing band names.
- Type:
dictionary
- acceptall()¶
Accept option.
- Return type:
None.
- run()¶
Entry point to start this routine.
- Returns:
tmp – True if successful, False otherwise.
- Return type:
bool
- setupui()¶
Set up UI.
- Return type:
None.
- class pygmi.vector.dataprep.PointCut(parent=None)¶
Bases:
BasicModule
Cut Data using shapefiles.
This class cuts point datasets using a boundary defined by a polygon shapefile.
- saveproj()¶
Save project data from class.
- 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
- class pygmi.vector.dataprep.TextFileSplit(parent=None)¶
Bases:
BasicModule
Split a text file into smaller text files.
- acceptall()¶
Accept option.
Updates self.outdata, which is used as input to other modules.
- Return type:
None.
- change_method()¶
Update fields when method changes.
- get_ifile()¶
Get input file information.
- Return type:
None.
- saveproj()¶
Save project data from class.
- 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
- setupui()¶
Set up UI.
- Return type:
None.
- pygmi.vector.dataprep.blanking(gdat, x, y, bdist, extent, dxy, nullvalue)¶
Blanks area further than a defined number of cells from input data.
- Parameters:
gdat (numpy array) – grid data to blank.
x (numpy array) – x coordinates.
y (numpy array) – y coordinates.
bdist (int) – Blanking distance in units for cell.
extent (list) – extent of grid.
dxy (float) – Cell size.
Nullvalue (float) – Null or nodata value.
- Returns:
mask – Mask to be used for blanking.
- Return type:
numpy array
- pygmi.vector.dataprep.cut_point(data, ifile, showlog=<built-in function print>)¶
Cuts a point dataset.
Cut a point dataset using a shapefile.
- Parameters:
data (GeoDataFrame) – GeoPandas GeoDataFrame
ifile (str) – shapefile used to cut data
- Returns:
data – GeoPandas GeoDataFrame
- Return type:
GeoDataFrame
- pygmi.vector.dataprep.filesplit(ifile, num, mode='bytes', showlog=<built-in function print>, piter=None)¶
Split an input file into a number of output files.
- Parameters:
ifile (str) – Input filename.
num (int) – Number of bytes or lines to split by.
mode (str, optional) – Can be ‘bytes’, ‘files’ or ‘lines’. The default is ‘bytes’.
showlog (function, optional) – Display information. The default is print.
piter (iter, optional) – Progress iterator. The default is None.
- Return type:
None.
- pygmi.vector.dataprep.gridxyz(x, y, z, dxy, nullvalue=1e+20, method='Nearest Neighbour', bdist=4.0, showlog=<built-in function print>)¶
Grid xyz data.
- Parameters:
x (numpy array) – X coordinate values.
y (numpy array) – Y coordinate values.
z (numpy array) – Z or data values.
dxy (float) – Grid cell size, in distance units.
nullvalue (float, optional) – null or nodata value. The default is 1e+20.
method (str, optional) – Gridding method. The default is ‘Nearest Neighbour’.
bdist (float, optional) – Blanking distance. The default is 4.0.
showlog (function, optional) – Display information. The default is print.
- Returns:
dat – Output raster dataset.
- Return type:
PyGMI Data.
- pygmi.vector.dataprep.lltomap(lat, lon)¶
Convert a latitude and longitude to a 1:50,000 sheet name.
- Parameters:
lat (float) – Latitude.
lon (float) – Longitude.
- Returns:
mapsheet – Map sheet number.
- Return type:
str
- pygmi.vector.dataprep.maptobounds(mapsheet, crs_to=None, showlog=<built-in function print>)¶
Convert a South African map sheet name to bounds.
- Parameters:
mapsheet (str) – Map sheet number. Four numbers and up to two letters denoting NE corner in latitude and longitude and quadrants (A to D). Eg, 2928AB is latitude 29, longitude 28, quadrant B of quadrant A.
crs_to (CRS, optional) – Destination projection. The default is None.
showlog (function, optional) – Display information. The default is print.
- Returns:
bounds – output bounds.
- Return type:
list
- pygmi.vector.dataprep.quickgrid(x, y, z, dxy, numits=4, showlog=<built-in function print>)¶
Do a quick grid.
- Parameters:
x (numpy array) – array of x coordinates
y (numpy array) – array of y coordinates
z (numpy array) – array of z values - this is the column being gridded
dxy (float) – cell size for the grid, in both the x and y direction.
numits (int) – number of iterations. By default its 4. If this is negative, a maximum will be calculated and used.
showlog (function, optional) – Routine to show text messages. The default is print.
- Returns:
newz – M x N array of z values
- Return type:
numpy array
- pygmi.vector.dataprep.reprojxy(x, y, iwkt, owkt, showlog=<built-in function print>)¶
Reproject x and y coordinates.
- Parameters:
x (numpy array or float) – x coordinates
y (numpy array or float) – y coordinates
iwkt (str, int) – Input wkt description or EPSG code (int)
owkt (str, int) – Output wkt description or EPSG code (int)
- Returns:
xout (numpy array) – x coordinates.
yout (numpy array) – y coordinates.
- pygmi.vector.dataprep.txtlinecnt(filename)¶
Count lines in text file.
- Parameters:
filename (str) – filename of text file.
- Returns:
Total number of lines in a file.
- Return type:
int
pygmi.vector.graphs module¶
Plot Vector Data using Matplotlib.
- class pygmi.vector.graphs.GraphWindow(parent=None)¶
Bases:
ContextModule
Graph Window - Main QT Dialog class for graphs.
- change_band()¶
Combo box to choose band.
- Return type:
None.
- class pygmi.vector.graphs.MyMplCanvas(parent=None)¶
Bases:
FigureCanvasQTAgg
MPL Canvas class.
This routine will also allow the picking and movement of nodes of data.
- button_release_callback(event)¶
Mouse button release callback.
- Parameters:
event (matplotlib.backend_bases.MouseEvent) – Button release event.
- Return type:
None.
- format_coord(x, y)¶
Set format coordinate for correlation coefficient plot.
- Parameters:
x (float) – x coordinate.
y (float) – y coordinate.
- Returns:
Output string to display.
- Return type:
str
- motion_notify_callback(event)¶
Move mouse callback.
- Parameters:
event (matplotlib.backend_bases.MouseEvent) – Motion notify event.
- Return type:
None.
- onpick(event)¶
Picker event.
- Parameters:
event (matplotlib.backend_bases.PickEvent) – Pick event.
- Returns:
Return TRUE if pick succeeded, False otherwise.
- Return type:
bool
- resizeline(event)¶
Resize event.
- Parameters:
event (matplotlib.backend_bases.ResizeEvent) – Resize event.
- Return type:
None.
- textresize(axes)¶
Resize the text on a correlation plot when zooming.
- Parameters:
axes (Matplotlib axes) – Current Matplotlib axes.
- Return type:
None.
- update_ccoef(data, style='Normal')¶
Update the plot from point data.
- Parameters:
data (dictionary) – GeoPandas data in a dictionary.
style (str) – Style of colour mapping.
- Return type:
None.
- update_hist(data, col, ylog, iscum)¶
Update the histogram plot.
- Parameters:
data (dictionary) – GeoPandas data in a dictionary.
col (str) – Label for column to extract.
ylog (bool) – Boolean for a log scale on y-axis.
iscum (bool) – Boolean for a cumulative distribution.
- Return type:
None.
- update_lines(r, data)¶
Update the plot from point data.
- Parameters:
r (numpy array) – array of distances, for the x-axis
data (numpy array) – array of data to be plotted on the y-axis
- Return type:
None.
- update_lmap(data, ival, scale, uselabels)¶
Update the plot from line data.
- Parameters:
data (Pandas dataframe) – Line data
ival (dictionary key) – dictionary key representing the line data channel to be plotted.
scale (float) – scale of exaggeration for the profile data on the map.
uselabels (bool) – boolean choice whether to use labels or not.
- Return type:
None.
- update_rose(data, rtype, nbins=8, equal=False)¶
Update the rose diagram plot using vector data.
- Parameters:
data (dictionary) – GeoPandas data in a dictionary. It should be ‘LineString’
rtype (int) – Rose diagram type. Can be either 0 or 1.
nbins (int, optional) – Number of bins used in rose diagram. The default is 8.
equal (bool, optional) – Option for an equal area rose diagram. The default is False.
- Return type:
None.
- update_vector(data, col, style=None)¶
Update the plot from vector data.
- Parameters:
data (dictionary) – GeoPandas data in a dictionary.
col (str) – Label for column to extract.
style (str or None) – Style of colour mapping.
- Return type:
None.
- class pygmi.vector.graphs.PlotCCoef(parent=None)¶
Bases:
GraphWindow
Plot Correlation Coefficients.
- change_band()¶
Combo box to choose band.
- Return type:
None.
- run()¶
Entry point to run class.
- Return type:
None.
- class pygmi.vector.graphs.PlotHist(parent=None)¶
Bases:
ContextModule
Plot Histogram Class.
- change_band()¶
Combo box to choose band.
- Return type:
None.
- run()¶
Run.
- Return type:
None.
- class pygmi.vector.graphs.PlotLineMap(parent=None)¶
Bases:
GraphWindow
Plot Lines Map Class.
- change_band()¶
Combo box to choose band.
- Return type:
None.
- run()¶
Entry point to run class.
- Return type:
None.
- class pygmi.vector.graphs.PlotLines(parent=None)¶
Bases:
GraphWindow
Plot Lines Class.
- change_band()¶
Combo box to choose band.
- Return type:
None.
- change_line()¶
Combo to change line number.
- Return type:
None.
- run()¶
Entry point to run class.
- Return type:
None.
- class pygmi.vector.graphs.PlotRose(parent=None)¶
Bases:
GraphWindow
Plot Rose Class.
- change_band()¶
Combo box to choose band.
- Return type:
None.
- run()¶
Entry point to run class.
- Return type:
None.
- class pygmi.vector.graphs.PlotVector(parent=None)¶
Bases:
GraphWindow
Plot Vector Class.
- change_band()¶
Combo box to choose band.
- Return type:
None.
- run()¶
Entry point to run class.
- Return type:
None.
- pygmi.vector.graphs.annotate_heatmap(im, data=None, valfmt='{x:.2f}', textcolors=('black', 'white'), threshold=None, **textkw)¶
Annotate a heatmap.
From Matplotlib.org.
- Parameters:
im – The AxesImage to be labelled.
data – Data used to annotate. If None, the image’s data is used. Optional.
valfmt – The format of the annotations inside the heatmap. This should either use the string format method, e.g. “$ {x:.2f}”, or be a matplotlib.ticker.Formatter. Optional.
textcolors – A pair of colours. The first is used for values below a threshold, the second for those above. Optional.
threshold – Value in data units according to which the colours from textcolors are applied. If None (the default) uses the middle of the colormap as separation. Optional.
**kwargs – All other arguments are forwarded to each call to text used to create the text labels.
- pygmi.vector.graphs.heatmap(data, row_labels, col_labels, ax, cbar_kw=None, cbarlabel='', **kwargs)¶
Create a heatmap from a numpy array and two lists of labels.
From Matplotlib.org
- Parameters:
data – A 2D numpy array of shape (M, N).
row_labels – A list or array of length M with the labels for the rows.
col_labels – A list or array of length N with the labels for the columns.
ax – A matplotlib.axes.Axes instance to which the heatmap is plotted.
cbar_kw – A dictionary with arguments to matplotlib.Figure.colorbar. Optional.
cbarlabel – The label for the colorbar. Optional.
**kwargs – All other arguments are forwarded to imshow.
- pygmi.vector.graphs.histogram(x, y=None, xmin=None, xmax=None, bins=10)¶
Histogram.
Calculate histogram of a set of data. It is different from a conventional histogram in that instead of summing elements of specific values, this allows the sum of weights/probabilities on a per element basis.
- Parameters:
x (numpy array) – Input data
y (numpy array) – Input data weights. The default is None.
xmin (float) – Lower value for the bins. The default is None.
xmax (float) – Upper value for the bins. The default is None.
bins (int) – number of bins. The default is 10.
- Returns:
hist (numpy array) – The values of the histogram
bin_edges (numpy array) – bin edges of the histogram
- pygmi.vector.graphs.rotate(origin, point, angle)¶
Rotate a point counterclockwise by a given angle around a given origin.
The angle should be given in radians.
- Parameters:
origin (list) – List containing origin point (ox, oy)
point (list) – List containing point to be rotated (px, py)
angle (float) – Angle in radians.
- Returns:
qx (float) – Rotated x-coordinate.
qy (float) – Rotated y-coordinate.
pygmi.vector.iodefs module¶
Import Data.
- class pygmi.vector.iodefs.ColumnSelect(parent=None)¶
Bases:
BasicModule
A combobox to select vector columns.
- saveproj()¶
Save project data from class.
- 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
- class pygmi.vector.iodefs.ExportVector(parent=None)¶
Bases:
ContextModule
Export Vector Data.
- run()¶
Run routine.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- class pygmi.vector.iodefs.ExportXYZ(parent=None)¶
Bases:
ContextModule
Export XYZ Data.
- run()¶
Run routine.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- class pygmi.vector.iodefs.ImportVector(parent=None)¶
Bases:
BasicModule
Import Vector Data.
- change_bounds()¶
Change the bounds combo.
- get_sfile()¶
Get the filename and crs and bounds.
- saveproj()¶
Save project data from class.
- Return type:
None.
- set_bounds(bounds)¶
Set the bounds.
- Parameters:
bounds (list or numpy array) – Bounds defined as (xmin, ymin, xmax, ymax).
- 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
- setupui()¶
Set up UI.
- Return type:
None.
- class pygmi.vector.iodefs.ImportXYZ(parent=None)¶
Bases:
BasicModule
Import XYZ Data.
This class imports tabular data.
- get_GXYZ()¶
Get Geosoft XYZ.
- Returns:
df – Pandas dataframe.
- Return type:
DataFrame
- get_delimited(delimiter=',')¶
Get a delimited file.
- Parameters:
delimiter (str, optional) – Delimiter type. The default is ‘,’.
- Returns:
gdf – Pandas dataframe.
- Return type:
Dataframe
- get_excel()¶
Get an Excel spreadsheet.
- Returns:
gdf – Pandas dataframe.
- Return type:
Dataframe
- saveproj()¶
Save project data from class.
- 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
- setupui()¶
Set up UI.
- Return type:
None.
- pygmi.vector.iodefs.get_GXYZ(ifile, showlog=<built-in function print>, piter=<built-in function iter>)¶
Get Geosoft XYZ.
- Returns:
df2 – Pandas dataframe.
- Return type:
DataFrame
- pygmi.vector.iodefs.get_intrepid(ifile, showlog=<built-in function print>, piter=<built-in function iter>)¶
Get Intrepid Database.
- Returns:
df – Pandas Dataframe.
- Return type:
DataFrame
pygmi.vector.minc module¶
Minimum Curvature Gridding Routine.
Based on the work by:
Briggs, I. C., 1974, Machine contouring using minimum curvature, Geophysics vol. 39, No. 1, pp. 39-48
- pygmi.vector.minc.get_b(e5, n5)¶
Get b values for input data.
Calculates the b values based on the distance between the data point and the nearest node. Distances are expressed in units of cell.
- Parameters:
e5 (float) – x distance error.
n5 (float) – y distance error.
- Returns:
b1 (float) – b1 value.
b2 (float) – b2 value.
b3 (float) – b3 value.
b4 (float) – b4 value.
b5 (float) – b5 value.
- pygmi.vector.minc.mcurv(u, ufixed)¶
Minimum curvature smoothing.
This routine smooths the data between fixed data nodes.
- Parameters:
u (numpy array) – 2D grid of z values.
ufixed (numpy array) – 2D grid of fixed node values.
- Returns:
u – 2D grid of z values.
- Return type:
numpy array
- pygmi.vector.minc.minc(x, y, z, dxy, showlog=<built-in function print>, extent=None, bdist=None, maxiters=100)¶
Minimum Curvature Gridding.
- Parameters:
x (numpy array) – 1D array with x coordinates.
y (numpy array) – 1D array with y coordinates.
z (numpy array) – 1D array with z coordinates.
dxy (float) – Cell x and y dimension.
showlog (function, optional) – Routine to show text messages. The default is print.
extent (list, optional) – Extent defined as (left, right, bottom, top). The default is None.
bdist (float, optional) – Blanking distance in units of cell. The default is None.
maxiters (int, optional) – Maximum number of iterations. The default is 100.
- Returns:
u – 2D numpy array with gridding z values.
- Return type:
numpy array
- pygmi.vector.minc.morg(x2, y2, z2, extent, dxy, rows, cols)¶
Organise coordinates and calculate b values.
- Parameters:
x2 (numpy array) – 1D array with x coordinates.
y2 (numpy array) – 1D array with y coordinates.
z2 (numpy array) – 1D array with z coordinates.
extent (list) – Extent defined as (left, right, bottom, top).
dxy (float) – Cell x and y dimension.
rows (int) – Number of rows.
cols (int) – Number of columns.
- Returns:
coords (list) – List containing iint, jint, r and zval.
b (list) – List of b values.
- pygmi.vector.minc.off_grid(u, i, j, wn, b)¶
Node value calculation when data value is too far from node.
- Parameters:
u (numpy array) – 2D grid of z values.
i (int) – Current row.
j (int) – Current Column.
wn (float) – Data value.
b (list) – List of b values for calculation.
- Returns:
uij – Output value.
- Return type:
float
- pygmi.vector.minc.u_corner(u)¶
Minimum curvature smoothing for corner point.
It is defined as:
2*u[i, j]+u[i, j+2] + u[i+2, j] - 2*(u[i, j+1] + u[i+1, j] = 0
- Parameters:
u (numpy array) – 2D grid of z values.
- Returns:
uij – Smoothed value to replace in master grid.
- Return type:
float
- pygmi.vector.minc.u_edge(u, i)¶
Minimum curvature smoothing for edges.
It is defined as:
u[i-2, j] + u[i+2, j] + u[i, j+2] + u[i-1, j+1] + u[i+1, j+1] - 4*(u[i-1, j] + u[i, j+1] + u[i+1, j]) + 7*u[i, j] = 0
- Parameters:
u (numpy array) – 2D grid of z values.
i (int) – Current row.
- Returns:
uij – Smoothed value to replace in master grid.
- Return type:
float
- pygmi.vector.minc.u_edge_next_to_corner(u)¶
Minimum curvature smoothing for edge next to corner.
It is defined as:
u[i, j+2] + u[i+1, j+1] + u[i-1, j+1] + u[i+2, j] - 2*u[i-1, j] - 4*(u[i+1, j] + u[i, j+1]) + 6*u[i, j] = 0
- Parameters:
u (numpy array) – 2D grid of z values.
- Returns:
uij – Smoothed value to replace in master grid.
- Return type:
float
- pygmi.vector.minc.u_next_to_corner(u)¶
Minimum curvature smoothing for next to corner.
It is defined as:
u[i, j+2] + u[i+2, j] + u[i-1, j+1] + u[i+1, j-1] + 2*u[i+1, j+1] - 8*(u[i, j+1] + u[i+1, j]) - 4*([i, j-1]+u[i-1, j]) + 18*u[i, j] = 0
- Parameters:
u (numpy array) – 2D grid of z values.
- Returns:
uij – Smoothed value to replace in master grid.
- Return type:
float
- pygmi.vector.minc.u_normal(u, i, j)¶
Minimum curvature smoothing for normal cases.
It is defined as:
u[i+2, j] + u[i, j+2] + u[i-2, j] + u[i, j-2] + 2*(u[i+1, j+1] + u[i-1, j+1] + u[i+1, j-1] + u[i-1, j-1]) - 8*(u[i+1, j]+u[i-1, j]+u[i, j+1]+u[i, j-1]) + 20*u[i, j] = 0
- Parameters:
u (numpy array) – 2D grid of z values.
i (int) – Current row.
j (int) – Current Column.
- Returns:
uij – Smoothed value to replace in master grid.
- Return type:
float
- pygmi.vector.minc.u_one_row_from_edge(u, i)¶
Minimum curvature smoothing for one row from edge.
It is defined as:
u[i-2, j] + u[i+2, j] + u[i, j+2] + 2*(u[i-1, j+1] + u[i+1, j+1]) + u[i-1, j-1]+u[i+1, j-1] - 8*([i-1, j]+u[i, j+1]+u[i+1, j]) - 4*u[i, j-1] + 19*u[i, j] = 0
- Parameters:
u (numpy array) – 2D grid of z values.
i (int) – Current row.
- Returns:
uij – Smoothed value to replace in master grid.
- Return type:
float
pygmi.vector.show_table module¶
Routine which displays a table graphically with various stats.
- class pygmi.vector.show_table.BasicStats(parent=None)¶
Bases:
ContextModule
Show a summary of basic stats.
- run()¶
Run.
- Return type:
None.
- save()¶
Save Table.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- setupui()¶
Set up UI.
- Return type:
None.
pygmi.vector.structure module¶
Structure complexity routines.
- class pygmi.vector.structure.StructComp(parent=None)¶
Bases:
BasicModule
Structure complexity.
- acceptall()¶
Accept option.
Updates self.outdata, which is used as input to other modules.
- Return type:
None.
- method_change()¶
When method is changed, this updated hidden controls.
- Return type:
None.
- saveproj()¶
Save project data from class.
- 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
- setupui()¶
Set up UI.
- Return type:
None.
- pygmi.vector.structure.extendlines(gdf, length=500, piter=<built-in function iter>)¶
Extent lines from GeoPandas dataframe.
- Parameters:
gdf (GeoDataFrame) – A dataframe containing LINESTRINGs.
length (float) – distance in metres to extend the line on either side.
piter (iter) – Progressbar iterable.
- Returns:
gdf2 – A dataframe containing extended LINESTRINGs.
- Return type:
GeoDataFrame
- pygmi.vector.structure.feature_circular_stats(gdf, dxy, wsize=3, piter=<built-in function iter>)¶
Feature circular variance.
- Parameters:
gdf (GeoDataFrame) – GeoDataframe of linear features.
dxy (float) – Raster cell size
wsize (int) – Window size (must be odd)
piter (iter) – Progressbar iterable.
- Returns:
dat – Output raster data
- Return type:
PyGMI Data
- pygmi.vector.structure.feature_fracdim(gdf, dxy, wsize=21, piter=<built-in function iter>)¶
Feature fractal dimension.
- Parameters:
gdf (GeoDataFrame) – GeoDataframe of linear features.
dxy (float) – Raster cell size
wsize (int) – Window size (must be odd)
piter (iter) – Progressbar iterable.
- Returns:
dat – Output raster data
- Return type:
PyGMI Data
- pygmi.vector.structure.feature_intersection_density(gdf, dxy, var, extend=500, piter=<built-in function iter>)¶
Feature intersection density.
- Parameters:
gdf (GeoDataFrame) – GeoDataframe of linear features.
dxy (float) – Raster cell size
var (float) – Variance.
extend (float) – Distance to extend linear features.
piter (iter) – Progressbar iterable.
- Returns:
geom2 (GeoDataFrame) – New geometry with intersection points.
dat (PyGMi Data) – Output raster data
- pygmi.vector.structure.feature_orientation_diversity(gdf, dxy, wsize=3, piter=<built-in function iter>)¶
Feature orientation diversity.
- Parameters:
gdf (GeoDataFrame) – GeoDataframe of linear features.
dxy (float) – Raster cell size
wsize (int) – Window size (must be odd)
piter (iter) – Progressbar iterable.
- Returns:
dat – Output raster data
- Return type:
PyGMI Data
- pygmi.vector.structure.fractal_dimension(warray, max_box_size=None, min_box_size=1, n_samples=20, n_offsets=0)¶
Calculate the fractal dimension of a 3D numpy array.
From: https://github.com/ChatzigeorgiouGroup/FractalDimension
- Parameters:
warray (np.array) – The array to calculate the fractal dimension of.
max_box_size (int, optional) – The largest box size, given as the power of 2 so that 2**max_box_size gives the side length of the largest box. The default is None.
min_box_size (int, optional) – The smallest box size, given as the power of 2 so that 2**min_box_size gives the side length of the smallest box. The default is 1.
n_samples (int, optional) – number of scales to measure over. The default is 20.
n_offsets (int, optional) – number of offsets to search over to find the smallest set N(s) to cover all voxels>0. The default is 0.
- Returns:
coeffs[0] – Fractal dimension
- Return type:
float
- pygmi.vector.structure.linesplit(curve)¶
Split LineString into segments.
- pygmi.vector.structure.segments_to_angles(gdf, piter=<built-in function iter>)¶
Get line segment angles.
- Parameters:
gdf (GeoDataFrame) – GeoDataFrame with line segments.
piter (iter) – Progressbar iterable.
- Returns:
gdf2 – GeoDataFrame with angles added.
- Return type:
GeoDataFrame
Module contents¶
Vector data routines.