Skip to main content

Sedimentological data‐analysis tools (grain‐size, XRF, forams, bryozoans)

Project description

grainsize

Sedimentological Data Analysis Made Easy

The grainsize Python package provides a suite of tools for processing, analyzing, and visualizing grain size distributions, elemental data, and micropaleontological proxies (foraminifera and bryozoans) from sediment cores.


Features

  • Grain Size Analysis:

    • Clean and normalize grain size distributions.
    • Calculate statistical parameters (mean, median, mode, std, skewness, kurtosis).
    • Create grain size categories (clay, silt, sand, gravel).
    • Visualize statistics and fine fraction (<63 µm).
  • XRF Data Analysis:

    • Import and clean XRF elemental data.
    • Convert percentages to ppm.
    • Plot elemental abundances and elemental ratios.
  • Cluster Analysis:

    • Perform Bray-Curtis dissimilarity analysis.
    • Create dendrograms for stratigraphic clustering.
  • Foraminifera Data Analysis:

    • Calculate normalized abundance per 1cc.
    • Plot planktic and benthic foraminifera abundance with color scaling.
  • Bryozoans Data Analysis:

    • Compare abundance categories across cores.
    • Perform statistical tests (Chi-square, Mann-Whitney U).
    • Visualize depth distribution of bryozoan types.
  • Integrated Core Analysis:

    • Plot combined grain size and XRF results side-by-side for stratigraphic interpretation.

Installation

Manually clone the repository and install dependencies listed in requirements


Quickstart Example

from grainsize import GrainSize, XRF, Forams, Bryozoans, Stratigraphy, BCD

# Grain Size Example
gs = GrainSize(fname="grainsize_data.xlsx")
gs.clean_data()
stats = gs.create_stats_df()
stats.plot_stats(core_name="Core A")

# XRF Example
xrf = XRF(fname="xrf_data.xlsx")
xrf_clean = xrf.clean_data()
xrf_clean.plot_elements(core_name="Core A")

# Bray-Curtis Clustering
bcd = BCD.from_grain_size(gs)
bcd.plot_dendrogram(core_name="Core A")

# Foraminifera Example
forams = Forams(fname="forams.csv")
forams.plot_forams(core_name="Core A")

# Bryozoans Example
bryo = Bryozoans(fname="bryozoans.xlsx")
bryo.plot_corr_matrix(core_name="Core A")

Main Classes and Functionalities

GrainSize

  • clean_data() → Clean raw MasterSizer data.
  • normalize_gs() → Normalize grain size percentages.
  • create_stats_df() → Calculate median, mode, mean, std, skewness, kurtosis.
  • create_categories() → Create clay, silt, sand, gravel summaries.
  • plot_stats() → Plot statistics.
  • compare_gs() → Compare multiple cores.

XRF

  • clean_data() → Clean depth intervals.
  • to_ppm() → Convert % values to ppm.
  • plot_elements() → Plot elemental concentrations.
  • plot_ratios() → Plot elemental ratios.
  • compare_ratios() → Compare elemental ratios across cores.

Forams

  • Automatically calculates normalized abundance, p/b ratios, and percentages.
  • plot_forams() → Plot total abundance colored by planktic %.
  • compare_forams_plot() → Compare cores.
  • plot_benthic() → Plot benthic abundance.

Bryozoans

  • calc_chi2() → Chi-square test for presence/absence.
  • calc_mann_whitney() → Mann-Whitney U test.
  • calc_corr() + plot_corr_matrix() → Correlation analysis.
  • plot_large_bryo() → Compare large bryozoans categories.
  • plot_depth_bars() → Bryozoan types vs. depth.

BCD (Bray-Curtis Dissimilarity)

  • compute_BCD() → Compute Bray-Curtis distances.
  • plot_dendrogram() → Create a stratigraphic dendrogram.
  • merge_interp() → Merge and interpolate two cores.

Requirements

  • Python 3.8+
  • pandas
  • numpy
  • matplotlib
  • seaborn
  • scipy

License

MIT License


Acknowledgements

Developed to assist sedimentological and micropaleontological research workflows, with a special focus on making complex laboratory datasets ready for visualization and statistical analysis.


Author

Jarden Aaltonen Feel free to report issues or suggest improvements!

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

grainsize-0.2.0.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

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

grainsize-0.2.0-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file grainsize-0.2.0.tar.gz.

File metadata

  • Download URL: grainsize-0.2.0.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for grainsize-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a9a05d96c21cd134c19d92cd36fee876dc039a0e10dc1826f3cdfb773859714b
MD5 448257ba3adf33d359ffabe1b0f61ba6
BLAKE2b-256 3c7b6c27fa2038b0b2a624a5a6cbf046878a9e4037b48fe9355a1da0a10f13ab

See more details on using hashes here.

File details

Details for the file grainsize-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: grainsize-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for grainsize-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 749fb5afb8d7d7f2c7961f15aa83ca4d01c048b236184740970b39f416a3a1b8
MD5 f8837e21eedbb8f133e6f4c8e7084ab4
BLAKE2b-256 f326bba15fe249b9656a5a59d19c05877de686cced63fa8c487cf523d62fae4c

See more details on using hashes here.

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