Skip to main content

pyTopoComplexity

DOI PyPI version PyPI downloads

pyTopoComplexity is an open-source Python package designed to measure the topographic complexity (i.e., surface roughness) of land surfaces using digital elevation model (DEM) data. This package includes modules for four modern methods used to measure topographic complexity in the fields of geology, geomorphology, geography, ecology, and oceanography.

Modules Classes Method Descriptions
pycwtmexhat.py CWTMexHat Quanitfies the wavelet-based curvature of the terrain surface using two-dimensional continuous wavelet transform (2D-CWT) with a Mexican Hat wevalet
pyfracd.py FracD Conducts fractal dimension analysis on the terrain surface using variogram procedure
pyrugostiy.py RugosityIndex Calculates Rugosity Index of the terrain surface
pytpi.py TPI Calculates Terrain Position Index of the topography

Installation

Users can install pyTopoComplexity directly from PyPI with pip command:

pip install pytopocomplexity

or from conda-forge repository with conda:

conda install pytopocomplexity

Modules for Surface Complexity Measurement

1. Two-Dimensional Continuous Wavelet Transform Analysis

from pytopocomplexity import CWTMexHat

The module pycwtmexhat.py uses two-dimensional continuous wavelet transform (2D-CWT) with a Mexican Hat wevalet to measure the topographic complexity (i.e., surface roughness) of a land surface from a Digital Elevation Model (DEM). Such method quanitfy the wavelet-based curvature of the surface, which has been proposed to be a effective geomorphic metric for identifying and estimating the ages of historical deep-seated landslide deposits. The method and early version of the code was developed by Dr. Adam M. Booth (Portland State Univeristy) in 2009, written in MATLAB (source code available from Booth's personal website). This MATLAB code was later revised and adapted by Dr. Sean R. LaHusen (Univeristy of Washington) and Dr. Erich N. Herzig (Univeristy of Washington) in their research (LaHusen et al., 2020; Herzig et al. (2023)). Dr. Larry Syu-Heng Lai (Univeristy of Washington), under the supervision of Dr. Alison R. Duvall (Univeristy of Washington), translated the code into this optimized open-source Python version in 2024.

See Example_pycwtmexhat.ipynb for detailed explanations and usage instructions.

Open In Colab

2. Fractal Dimentsion Analysis

from pytopocomplexity import FracD

The pyfracd.py module calculates local fractal dimensions to assess topographic complexity. It also computes reliability parameters such as the standard error and the coefficient of determination (R²). The development of this module was greatly influenced by the Fortran code shared by Dr. Eulogio Pardo-Igúzquiza from his work in Pardo-Igúzquiza and Dowd (2022). The local fractal dimension is determined by intersecting the surface within a moving window with four vertical planes in principal geographical directions, simplifying the problem to one-dimensional topographic profiles. The fractal dimension of these profiles is estimated using the variogram method, which models the relationship between dissimilarity and distance using a power-law function. While the fractal dimension value does not directly scale with the degree of surface roughness, smoother or more regular surfaces generally have lower fractal dimension values (closer to 2), whereas surfaces with higher fractal dimension values tend to be more complex or irregular. This method has been applied in terrain analysis for understanding spatial variability in surface roughness, classifying geomorphologic features, uncovering hidden spatial structures, and supporting geomorphological and geological mapping on Earth and other planetary bodies.

See Example_pyfracd.ipynb for detailed explanations and usage instructions.

Open In Colab

3. Rugosity Index Calculation

from pytopocomplexity import RugosityIndex

The module pyrugosity.py measure Rugosity Index of the land surface, which is widely used to assess landscape structural complexity. By definition, the Rugosity Index has a minimum value of one, representing a completely flat surface. Typical values of the conventional Rugosity Index without slope correction (Jenness, 2004) range from one to three, although larger values are possible in very steep terrains. The slope-corrected Rugosity Index, also known as the Arc-Chord Ratio (ACR) Rugosity Index (Du Preez, 2015), provides a better representation of local surface complexity. This method has been applied in classifying seafloor types by marine geologists and geomorphologists, studying small-scale hydrodynamics by oceanographers, and assessing available habitats in landscapes by ecologists and coral biologists.

See Example_pyrugosity.ipynb for detailed explanations and usage instructions.

Open In Colab

4. Terrain Position Index Calculation

from pytopocomplexity import TPI

The module pytpi.py calculates the Terrain Position Index (TPI) of the land surface following (Weiss, 2001), which is a measure of the relative topographic position of a point in relation to the surrounding landforms. This metric is useful for determining surface ruggedness, classifying terrain, assessing local hydrodynamics, and identifying habitat hotspots. TPI, also known as the Topographic Position Index in terrestrial studies, distinguishes landscape features such as hilltops, valleys, flat plains, and upper or lower slopes. In oceanography, researchers adapt the Bathymetric Position Index (BPI), which applies the equivalent TPI algorithm to bathymetric data to assess seafloor complexity. Positive TPI values indicate locations that are higher than the average of their surroundings (e.g., ridges), while negative values indicate locations that are lower (e.g., valleys). Values near zero indicate flat areas or areas of constant slope. The module also returns the absolute values of the TPI, which only indicate the magnitude of the vertical position at each grid point relative to its neighbors.

See Example_pytpi.ipynb for detailed explanations and usage instructions.

Open In Colab

Requirements

For pyTopoComplexity package"

  • Python >= 3.10
  • numpy >= 1.20
  • scipy >= 1.5
  • rasterio >= 1.2
  • dask >= 2021.0
  • matplotlib >= 3.3
  • tqdm >= 4.0
  • numba >= 0.50
  • statsmodels >= 0.12

License

pyTopoComplexity is licensed under the Apache License 2.0.

Metadata

Release files for pytopocomplexity 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytopocomplexity 1.1.3
File Size Uploaded Provenance Actions
pytopocomplexity-1.1.3.tar.gz 36.4 kB Without provenance Details for pytopocomplexity-1.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytopocomplexity 1.1.3
File Interpreter ABI Platform Actions
pytopocomplexity-1.1.3-py3-none-any.whl Python 3 none any Details for pytopocomplexity-1.1.3-py3-none-any.whl

Total release size: 72.9 kB

Release files / pytopocomplexity-1.1.3.tar.gz

Download URL pytopocomplexity-1.1.3.tar.gz
Size 36.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d9047dd456c05c9d3285a61f38b74bd0002741f33fa087e1e9c635dd4182ce76
BLAKE2b-256 checksum
How to use checksums
03fd469a93e99b99e05f8d11301f5e6b545b391c112d277b0fad712b4567e84f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / pytopocomplexity-1.1.3-py3-none-any.whl

Download URL pytopocomplexity-1.1.3-py3-none-any.whl
Size 36.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d13aa328e7a8ee6e74502fe0c33ed0cc70d3481c7b4326d635efcfeb40c8452b
BLAKE2b-256 checksum
How to use checksums
87cb2e0435dfa30d0cbd0960058338569963099c131a65f0e999a2ef0bf6570b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for pytopocomplexity 1.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page