pygmi.vector.structure#

Structure complexity routines.

Classes#

StructComp

GUI for structure complexity.

Functions#

extendlines(gdf[, length, piter])

Extent lines from GeoPandas dataframe.

feature_intersection_density(gdf, dxy, var[, extend, ...])

Feature intersection density.

feature_orientation_diversity(gdf, dxy[, wsize, piter])

Feature orientation diversity.

feature_circular_stats(gdf, dxy[, wsize, piter])

Feature circular variance.

feature_fracdim(gdf, dxy[, wsize, piter])

Feature fractal dimension.

fractal_dimension(warray[, max_box_size, ...])

Calculate the fractal dimension of a 3D numpy array.

linesplit(curve)

Split LineString into segments.

segments_to_angles(gdf[, piter])

Get line segment angles.

Module Contents#

class pygmi.vector.structure.StructComp(parent=None)#

Bases: pygmi.misc.BasicModule

GUI for structure complexity.

Parameters:

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

setupui()#

Set up UI.

Return type:

None.

method_change()#

When method is changed, this updated hidden controls.

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

saveproj()#

Save project data from class.

Return type:

None.

acceptall()#

Accept option.

Updates self.outdata, which is used as input to other modules.

Return type:

None.

pygmi.vector.structure.extendlines(gdf, length=500, piter=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_intersection_density(gdf, dxy, var, extend=500, piter=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.raster.datatypes.Data) – Output raster data

pygmi.vector.structure.feature_orientation_diversity(gdf, dxy, wsize=3, piter=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.raster.datatypes.Data

pygmi.vector.structure.feature_circular_stats(gdf, dxy, wsize=3, piter=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.raster.datatypes.Data

pygmi.vector.structure.feature_fracdim(gdf, dxy, wsize=21, piter=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.raster.datatypes.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: 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=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