paudetseis / PlateCurie

Estimating Curie depth from magnetic anomaly data
https://paudetseis.github.io/PlateCurie/
MIT License
14 stars 9 forks source link
bayesian-inference curie-depth geophysics magnetic-field python wavelet-analysis

PlateCurie: Software for mapping Curie depth from a wavelet analysis of magnetic anomaly data

Crustal magnetic anomalies carry information on the source distribution of magnetization in the Earth's crust (Blakely, 1995). The Curie point corresponds to the depth at which crustal rocks loose their magnetization where they reach their Curie temperature, and is obtained by fitting the power spectral density (PSD) of magnetic anomaly data with a model where magnetic anomalies are confined within a layer (Bouligand et al., 2009; Audet and Gosselin, 2019; Mather and Fullea, 2019). Mapping the Curie point provides important information on geothermal gradients in the Earth; however, mapping Curie depth is a spatio-spectral localization problem because the PSD needs to be calculated within moving windows at wavelengths long enough to capture the greatest possible depth to the bottom of the magnetic layer. The wavelet transform is particularly well suited to overcome this problem because it avoids splitting the grids into small windows and can therefore produce PSD functions at each point of the input grid (Gaudreau et al., 2019).

This package extends the package plateflex, which contains python modules to calculate the wavelet transform and scalogram of 2D gridded data, by providing a new class MagGrid that inherits from plateflex.classes.Grid with methods to estimate the properties of the magnetic layer (depth to top of layer (zt), thickness of layer (dz), and power-law exponent of fractal magnetization (β)) using Bayesian inference. Common computational workflows are covered in the Jupyter notebooks bundled with this package. The software contains methods to make beautiful and insightful plots using the seaborn package.

Author: Pascal Audet (Developer and Maintainer)

Installation

Dependencies

The current version was developed using Python3.7 Also, the following packages are required:

NOTE: All dependencies are installed from plateflex

Installing using pip

You can install platecurie using the pip package manager:

pip install platecurie

All the dependencies will be automatically installed by pip.

Installing with conda

You can install platecurie using the conda package manager. Its required dependencies can be easily installed with:

conda install numpy pymc3 matplotlib seaborn -c conda-forge

Then platecurie can be installed with pip:

pip install platecurie

Conda environment

We recommend creating a custom conda environment where platecurie can be installed along with its dependencies.

conda create -n curie python=3.7 numpy pymc3 matplotlib seaborn -c conda-forge
git clone https://github.com/paudetseis/PlateCurie.git
cd PlateCurie
conda env create -f curie_env.yml

Activate the newly created environment:

conda activate curie

Install platecurie with pip:

pip install plateflex
pip install platecurie

Installing from source

Download or clone the repository:

git clone https://github.com/paudetseis/PlateCurie.git
cd PlateCurie

Next we recommend following the steps for creating a conda environment (see above). Then install using pip:

pip install plateflex
pip install .

NOTE:

If you are actively working on the code, or making frequent edits, it is advisable to perform installation from source with the -e flag:

pip install -e .

This enables an editable installation, where symbolic links are used rather than straight copies. This means that any changes made in the local folders will be reflected in the package available on the system.


Usage

Jupyter Notebooks

Included in this package is a set of Jupyter Notebooks, which give examples on how to call the various routines The Notebooks describe how to reproduce published examples of synthetic data from Gaudreau et al., (2019).

After installing platecurie, these notebooks can be locally installed (i.e., in a local folder Notebooks) from the package by running:

from platecurie import doc
doc.install_doc(path='Notebooks')

To run the notebooks you will have to further install jupyter:

conda install jupyter

Then cd Notebooks and type:

jupyter notebook

You can then save the notebooks as python scripts and you should be good to go!

Testing

A series of tests are located in the tests subdirectory. In order to perform these tests, clone the repository and run pytest (conda install pytest if needed):

git checkout https://github.com/paudetseis/PlateCurie.git
cd PlateCurie
pytest -v

Documentation

The documentation for all classes and functions in platecurie can be accessed from https://paudetseis.github.io/PlateCurie/.

References