Tools to measure glacier lengths statistically
Project description
glacier_lengths — Statistical glacier length calculations
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
(will soon work)
pip install git+https://github.com/erikmannerfelt/glacier_lengths.git
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_centerlines, 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for glacier_lengths-0.0.1a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08898e90cd2ddcf3c0c3993d7a669a6a0b500a3fcc4b66d453493d7d37b60bd1 |
|
MD5 | 0bf45eb030bd5d6065dd2744a0dd9529 |
|
BLAKE2b-256 | a83e005abff1f8ed79a0b97728e082a3e968ffc5bb876f41ee2c943990345d36 |