Package: pycurious
Magnetic data is one of the most common geophysics datasets available on the surface of the Earth. Curie depth is the depth at which rocks lose their magnetism. The most prevalent magnetic mineral is magnetite, which has a Curie point of 580°C, thus the Curie depth is often interpreted as the 580°C isotherm.Current methods to derive Curie depth first compute the (fast) Fourier transform over a square window of a magnetic anomaly that has been reduced to the pole. The depth and thickness of magnetic sources is estimated from the slope of the radial power spectrum.pycuriousimplements the Tanakaet al.(1999) and Bouligandet al.(2009) methods for computing the thickness of a buried magnetic source.pycuriousingests maps of the magnetic anomaly and distributes the computation of Curie depth across multiple CPUs. Common computational workflows and geospatial manipulation of magnetic data are covered in the Jupyter notebooks bundled with this package.BinderLaunch the demonstration atmybinder.orgCitationMather, B. and Delhaye, R. (2019). PyCurious: A Python module for computing the Curie depth from the magnetic anomaly.Journal of Open Source Software, 4(39), 1544,https://doi.org/10.21105/joss.01544Navigation / NotebooksThere are two matching sets of Jupyter notebooks - one set for theTanakaand one forBouligandimplementations. The Bouligand set of noteboks are a natural choice for Bayesian inference applications.Note, these examples can be installed from the package itself by running:importpycuriouspycurious.install_documentation(path="Notebooks")TanakaEx1-Plot-power-spectrum.ipynbEx2-Compute-Curie-depth.ipynbEx3-Parameter-exploration.ipynbBouligandEx1-Plot-power-spectrum.ipynbEx2-Compute-Curie-depth.ipynbEx3-Posing-the-inverse-problem.ipynbEx4-Spatial-variation-of-Curie-depth.ipynbEx5-Mapping-Curie-depth-EMAG2.ipynbInstallationDependenciesYou will needPython 2.7 or 3.5+.
Also, the following packages are required:numpyscipycythonOptional dependenciesfor mapping module and running the Notebooks:jupytermatplotlibpyprojcartopyInstalling using pipYou can installpycurioususing thepip package managerwith either version of Python:python2-mpipinstallpycurious
python3-mpipinstallpycuriousAll the dependencies will be automatically installed bypip.Installing with condaYou can installpycurioususing theconda package manager.
Its required dependencies can be easily installed with:condainstallnumpyscipycythonAnd the full set of dependencies with:condainstallnumpyscipycythonmatplotlibpyprojcartopyThenpycuriouscan be installed withpip:pipinstallpycuriousConda environmentAlternatively, you can create a customconda environmentwherepycuriouscan be installed along with its dependencies.Clone the repository:gitclonehttps://github.com/brmather/pycuriouscdpycuriousCreate the environment from theenvironment.ymlfile:condaenvcreate-fenvironment.ymlActivate the newly created environment:condaactivatepycuriousAnd installpycuriouswithpip:pipinstallpycuriousIssue with gccIf thepycuriousinstallation fails due toan issue withgccand
Anaconda, you just
need to installgxx_linux-64with conda:condainstallgxx_linux-64And then installpycuriousnormally.Installing using DockerA more straightforward installation forpycuriousand all of its dependencies may be deployed withDocker.
To install the docker image and start the Jupyter notebook examples:dockerrun--namepycurious-p127.0.0.1:8888:8888brmather/pycurious:latestUsagePyCurious consists of 2 classes:CurieGrid: base class that computes radial power spectrum, centroids for processing, decomposition of subgrids.CurieOptimise: optimisation module for fitting the synthetic power spectrum (inherits CurieGrid).Also included is amappingmodule for gridding scattered data points, and converting between coordinate reference systems (CRS).Below is a simple workflow to calculate the radial power spectrum:importpycurious# initialise CurieOptimise object with 2D magnetic anomalygrid=pycurious.CurieOptimise(mag_anomaly,xmin,xmax,ymin,ymax)# extract a square window of the magnetic anomalysubgrid=grid.subgrid(window_size,x,y)# compute the radial power spectrumk,Phi,sigma_Phi=grid.radial_spectrum(subgrid)A series of tests are located in thetestssubdirectory.
In order to perform these tests, clone the repository and runpytest:gitcheckouthttps://github.com/brmather/pycurious.gitcdpycurious
pytest-vAPI DocumentationThe API for all functions and classes inpycuriouscan be accessed fromhttps://brmather.github.io/pycurious/.ReferencesBouligand, C., Glen, J. M. G., & Blakely, R. J. (2009). Mapping Curie temperature depth in the western United States with a fractal model for crustal magnetization. Journal of Geophysical Research, 114(B11104), 1–25.https://doi.org/10.1029/2009JB006494Tanaka, A., Okubo, Y., & Matsubayashi, O. (1999). Curie point depth based on spectrum analysis of the magnetic anomaly data in East and Southeast Asia. Tectonophysics, 306(3–4), 461–470.https://doi.org/10.1016/S0040-1951(99)00072-4