Skip to main content

Exploring the multiscale meandering characteristics of river transects

Project description

drawing

WigglyRivers

WigglyRivers is a Python package that builds on existing work using wavelet-based methods to create supervised and unsupervised meander identification tools. This tool allows the characterization of the multiscale nature of river transects and the identification of individual meandering features. The package uses any set of river coordinates and calculates the curvature and direction-angle to perform the characterization, and also leverages the use of the High-Resolution National Hydrography Dataset (NHDPlus HR) to assess river transects at a catchment scale. Additionally, the WigglyRivers package contains a supervised river identification tool that allows the visual selection of individual meandering features with satellite imagery in the background.

Example Workflows

You can find examples of how to use this package as examples workflows for synthetic and natural river transects in the examples/new_user_workflow/ folder.

The synthetic river transect examples are generated using idealized Kinoshita-type curves, implemented in the code, and using the meanderpy package coded by Sylvester, Durkin, and Covault (2019). The natural river transect example uses the information from the High-Resolution National Hydrography Dataset (NHDPlus HR) to extract the river transects and assess the meandering features.

A tutorial on how to use the NHD capability of the package is available in this link

Installation

Core Requirements

This package has a few requirements. I encourage using a virtual environment of Anaconda 3 with Python 3.10 or higher. The virtual environment creation can be seen here. Below, we list the process to create a virtual environment and install the requirements for the package.

conda create -n wigglyrivers_env python=3.XX
conda activate wigglyrivers_env
conda install -c conda-forge geopandas
conda install -c conda-forge h5py

Manual Installation of Requirements

This path is not requiere if you install the package with pip install WigglyRivers. Some incompatible dependencies might arise with older versions of Python. geopandas is installed first because the package generates the most incompatibilities. After that package, we install the other dependencies with pip

pip install simpledbf
pip install statsmodels
pip install seaborn
pip install pyarrow
pip install plotly
pip install salem
pip install anytree
pip install circle-fit

The package uses anytree to store the information of the meanders.

For interactive plots

pip install ipympl

If you are using .env files, remember to also install

pip install python-dotenv

To run one of the synthetic examples, you will need to install the meanderpy package. You can install it using the following command:

pip install meanderpy

Install WigglyRivers

To install the package you need to clone the repository and install it using pip.

pip install WigglyRivers

If you want to install the package manually, you can clone the repository and install it using the following command:

git clone https://github.com/gomezvelezlab/WigglyRivers.git

Then, install the package using the following command:

pip install -e .

Some known incompatible dependencies are addressed in the troubleshooting section. If you have any issues not discussed in the troubleshooting section, please open an issue in the repository.

Troubleshooting Package Installation

  • If you have problems with geopandas look at this website.

  • h5py and fiona might have some issues when importing at the same time. Installing both of them using conda install -c -conda-forge solved the issue for me.

  • If the interactive plot with plotly gives you issues with ipywidgets and jupyterlab-widgets, install the following versions pip install ipywidgets==7.7.1 jupyterlab-widgets==1.1.1

  • There is a known issue with plotly<=5.15 where plotting MAPBOX with the interactive widget will prompt the following error message:

    ValueError:
    Invalid property path 'mapbox._derived' for layout
    

    There is a temporary fix to this issue given in the following GitHub issue webpage that requires the use of the function below and restart the kernel.

    def fix_widget_error():
        """
        Fix FigureWidget - 'mapbox._derived' Value Error.
        Adopted from: https://github.com/plotly/plotly.py/issues/2570#issuecomment-738735816
        """
        import shutil
        import pkg_resources
    
        pkg_dir = os.path.dirname(pkg_resources.resource_filename("plotly", "plotly.py"))
    
        basedatatypesPath = os.path.join(pkg_dir, "basedatatypes.py")
    
        backup_file = basedatatypesPath.replace(".py", "_bk.py")
        shutil.copyfile(basedatatypesPath, backup_file)
    
        # read basedatatypes.py
        with open(basedatatypesPath, "r") as f:
            lines = f.read()
    
        find = "if not BaseFigure._is_key_path_compatible(key_path_str, self.layout):"
    
        replace = """if not BaseFigure._is_key_path_compatible(key_path_str, self.layout):
                    if key_path_str == "mapbox._derived":
                        return"""
    
        # add new text
        lines = lines.replace(find, replace)
    
        # overwrite old 'basedatatypes.py'
        with open(basedatatypesPath, "w") as f:
            f.write(lines)
    
    # Run fix
    fix_widget_error()
    

How to cite

If you use this package, please cite the following paper:

Gonzalez-Duque, D., & Gomez-Velez, J. D. (2025). WigglyRivers: A tool to characterize the multiscale nature of meandering channels. Environmental Modelling & Software, 106423. https://doi.org/10.1016/j.envsoft.2025.106423

Credit and Acknowledgments

The Continous Wavelet Transform (CWT) computation uses an updated version of the code created by Torrence and Compo (1998) brought to Python by Evgeniya Predybaylo. Also, the unsupervised identification algorithm is based on previous work coded in Matlab by Vermeulen et al. (2016). Each code and function is adequately accredited and cited in the code.

References

Sylvester, Z., Durkin, P., & Covault, J. A. (2019). High curvatures drive river meandering. Geology, 47(3), 263–266. https://doi.org/10.1130/G45608.1

Torrence, C., & Compo, G. P. (1998). A Practical Guide to Wavelet Analysis. Bulletin of the American Meteorological Society, 79(1), 61–78. https://doi.org/10.1175/1520-0477(1998)079<0061:APGTWA>2.0.CO;2

Vermeulen, B., Hoitink, A. J. F., Zolezzi, G., Abad, J. D., & Aalto, R. (2016). Multiscale structure of meanders. Geophysical Research Letters, 2016GL068238. https://doi.org/10.1002/2016GL068238

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wigglyrivers-1.1.1.tar.gz (146.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wigglyrivers-1.1.1-py3-none-any.whl (140.6 kB view details)

Uploaded Python 3

File details

Details for the file wigglyrivers-1.1.1.tar.gz.

File metadata

  • Download URL: wigglyrivers-1.1.1.tar.gz
  • Upload date:
  • Size: 146.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for wigglyrivers-1.1.1.tar.gz
Algorithm Hash digest
SHA256 4cadaa27d6c7cc8f539c6991f44b5671ad0f28bd982e4a57828d3f1f16b8b8f3
MD5 528ad9daddb4130e3e3fd21d0f7ac08c
BLAKE2b-256 dd8283774bba05ade54d4b50b1ac5a557fd45558dffeb2e643b7b4351499fcba

See more details on using hashes here.

Provenance

The following attestation bundles were made for wigglyrivers-1.1.1.tar.gz:

Publisher: publish-to-pypi.yml on gomezvelezlab/WigglyRivers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wigglyrivers-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: wigglyrivers-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 140.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for wigglyrivers-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4efd47d95538ab599c6c23d082b2bf230d7f30cc048dd7b714605089ce261177
MD5 54ac4b8183313fb00f5fd678d53e8c5f
BLAKE2b-256 a434f2cc9629c0a84f7ae8b94ebb7e454f23eee28cb46efe715994b5a15fdf1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for wigglyrivers-1.1.1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on gomezvelezlab/WigglyRivers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page