Skip to content

Commit

Permalink
Add a gallery plot and API entrance
Browse files Browse the repository at this point in the history
  • Loading branch information
leouieda committed Feb 18, 2025
1 parent 1120f1d commit 4715581
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ List of functions and classes (API)
ensaio.fetch_earth_gravity
ensaio.fetch_earth_topography
ensaio.fetch_lightning_creek_magnetic
ensaio.fetch_morroco_speleothem_qdm
ensaio.fetch_osborne_magnetic
ensaio.fetch_sierra_negra_topography
ensaio.fetch_southern_africa_gravity
Expand Down
3 changes: 2 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"xarray": ("https://docs.xarray.dev/en/stable/", None),
"pooch": ("https://www.fatiando.org/pooch/latest/", None),
"pygmt": ("https://www.pygmt.org/latest/", None),
"magali": ("https://www.fatiando.org/magali/latest/", None),
}

# Autosummary pages will be generated by sphinx-autogen instead of sphinx-build
Expand Down Expand Up @@ -89,7 +90,7 @@
# Insert links to documentation of objects in the examples
"reference_url": {"ensaio": None},
# Use the PyGMT image scraper
"image_scrapers": (pygmt.sphinx_gallery.PyGMTScraper(),),
"image_scrapers": (pygmt.sphinx_gallery.PyGMTScraper(), "matplotlib"),
}

# HTML output configuration
Expand Down
50 changes: 50 additions & 0 deletions doc/gallery_src/morroco_speleothem_qdm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright (c) 2021 The Ensaio Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#
"""
QDM magnetic microscopy dataset of a speleothem from Morocco
------------------------------------------------------------
High-resolution magnetic map of a stalagmite sample from Wintimdouine Cave,
Morocco, created using Quantum Diamond Microscope (QDM) measurements at Harvard
University. The data were collected to explore the magnetic remanence
properties of hematite and magnetite within the sample, providing insight into
past geomagnetic field variations recorded in cave deposits.
**Original source:** Carmo, Janine; Fu, Roger; Trindade, Ricardo; Piascik,
Samuel (2023). QDM magnetic microscopy dataset of a speleothem from
Morocco. figshare. Dataset.
`10.6084/m9.figshare.22965200.v1 <https://doi.org/10.6084/m9.figshare.22965200.v1>`__
**Pre-processing:** `Source code for preparation of the original dataset for
redistribution in Ensaio
<https://github.com/fatiando-data/morroco-speleothem-qdm>`__
"""
import matplotlib.pyplot as plt
import xarray as xr

import ensaio

###############################################################################
# Download and cache the data and return the path to it on disk. We'll use the
# netCDF version because it's smaller and can be loaded with xarray easily.
fname = ensaio.fetch_morroco_speleothem_qdm(version=1, format="netcdf")
print(fname)

###############################################################################
# Load the netCDF grid with xarray
data = xr.load_dataarray(fname)
data

###############################################################################
# Make a pseudo-color map of the magnetic microscopy data and adjust the scale
# because of some very strong sources.
fig, ax = plt.subplots(1, 1, figsize=(9, 4.8), layout="constrained")
scale = 2500
data.plot.imshow(ax=ax, cmap="RdBu_r", vmin=-scale, vmax=scale)
ax.set_aspect("equal")
plt.show()
2 changes: 1 addition & 1 deletion ensaio/_fetchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ def fetch_morroco_speleothem_qdm(version, format):
**Load with:** :func:`xarray.load_dataarray` (for netCDF; requires the `netcdf4
<https://github.com/Unidata/netcdf4-python>`__ library) or
:func:`magali.read_harvard_qdm` (for Matlab format)
:func:`magali.read_qdm_harvard` (for Matlab format)
**Original source:** Carmo, Janine; Fu, Roger; Trindade, Ricardo; Piascik,
Samuel (2023). QDM magnetic microscopy dataset of a speleothem from
Expand Down

0 comments on commit 4715581

Please sign in to comment.