Skip to main content

Tools to measure glacier lengths statistically

Project description

glacier_lengths — Statistical glacier length calculations

build pypi Documentation Status

PyPI version fury.io

Conda Version Conda Downloads Conda Platforms

Often when glacier lengths are calculated, only the glacier centerline is considered. This is arguably not a statistically representative measure for the entire front, as it just considers one point on the glacier outline. The glacier_lengths package aims to simplify length calculations along an arbitrary amount of lines buffered around the glacier centerline.

Installation

pip install glacier_lengths

pip install git+https://github.com/erikmannerfelt/glacier_lengths.git

Documentation

See the documentation at https://glacier-lengths.readthedocs.io

Example

Calculate the length change of Rhonegletscher:

import geopandas as gpd
import glacier_lengths

# Read the example data
outlines = gpd.read_file("examples/rhone/data/outlines.shp").sort_values("year")
old_outline = outlines.iloc[0]
new_outline = outlines.iloc[1]
centerline = gpd.read_file("examples/rhone/data/centerline.shp").iloc[0]

# Generate ~40 buffered lines around the glacier centerline
old_buffered_lines = glacier_lengths.buffer_centerline(centerline.geometry, old_outline.geometry)
# Cut the newly generated lines to the new_outline
new_buffered_lines = glacier_lengths.cut_centerlines(old_buffered_lines, new_outline.geometry)

# Measure the lengths of the old and new glacier centerlines.
old_lengths = glacier_lengths.measure_lengths(old_buffered_lines)
new_lengths = glacier_lengths.measure_lengths(new_buffered_lines)

# Print the results.
print(f"""
{old_outline['year']}: {old_lengths.mean():.1f}±{old_lengths.std():.1f} m
{new_outline['year']}: {new_lengths.mean():.1f}±{new_lengths.std():.1f} m
""")

prints:

1928: 10783.6±38.8 m
2020: 9699.9±7.6 m

Plot a figure

python examples/rhone/plot_rhone.py

Testing

Run python -m pytest in the cloned repo base directory.

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

glacier_lengths-0.1.2.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

glacier_lengths-0.1.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file glacier_lengths-0.1.2.tar.gz.

File metadata

  • Download URL: glacier_lengths-0.1.2.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for glacier_lengths-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f411a296679c98343875480c70b0fbf2c5052dafc264ef6a21d2bc60f82252ec
MD5 7213b3bb2af232287e9054ec6a8b6227
BLAKE2b-256 99eb754af39162d3f8f39b58ad083010717990633946fb1d9aae134a983f389f

See more details on using hashes here.

File details

Details for the file glacier_lengths-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for glacier_lengths-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c254b044abae1283a585c0930577cf9402225eaefadf315ad5cd03e858356fce
MD5 09ebf1d6f7131266e1eb0b1f82ac0598
BLAKE2b-256 530a3050e6c487d44a8b0004e3139a22ce6d15044605b80d74b6dc5e2a6e7a4f

See more details on using hashes here.

Supported by

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