Skip to content

Commit

Permalink
Fix missing PyGMT images in user guide (#474)
Browse files Browse the repository at this point in the history
Add hidden cell in user guide examples configuring PyGMT to use
`"notebook"` as display method. This way `jupyter-sphinx` is able to
render the images in the generated HTML files. This issue should be
fixed upstream in PyGMT.
  • Loading branch information
santisoler authored Mar 22, 2024
1 parent 9f7852a commit caf3cc1
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 0 deletions.
13 changes: 13 additions & 0 deletions doc/user_guide/equivalent_sources/block-averaged-eqs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ And project the geographic coordinates to plain Cartesian ones:
coordinates = (easting, northing, data.height_m)
xy_region=vd.get_region(coordinates)


.. jupyter-execute::
:hide-code:

import pygmt

# Needed so that displaying works on jupyter-sphinx and sphinx-gallery at
# the same time. Using PYGMT_USE_EXTERNAL_DISPLAY="false" in the Makefile
# for sphinx-gallery to work means that fig.show won't display anything here
# either.
pygmt.set_display(method="notebook")


.. jupyter-execute::

import pygmt
Expand Down
12 changes: 12 additions & 0 deletions doc/user_guide/equivalent_sources/eq-sources-spherical.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,18 @@ grid points that are too far away from any data point:

Lets plot it:

.. jupyter-execute::
:hide-code:

import pygmt

# Needed so that displaying works on jupyter-sphinx and sphinx-gallery at
# the same time. Using PYGMT_USE_EXTERNAL_DISPLAY="false" in the Makefile
# for sphinx-gallery to work means that fig.show won't display anything here
# either.
pygmt.set_display(method="notebook")


.. jupyter-execute::

import pygmt
Expand Down
12 changes: 12 additions & 0 deletions doc/user_guide/equivalent_sources/eqs-parameters-estimation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,18 @@ And grid the data using the two equivalent sources:

Lets plot it:

.. jupyter-execute::
:hide-code:

import pygmt

# Needed so that displaying works on jupyter-sphinx and sphinx-gallery at
# the same time. Using PYGMT_USE_EXTERNAL_DISPLAY="false" in the Makefile
# for sphinx-gallery to work means that fig.show won't display anything here
# either.
pygmt.set_display(method="notebook")


.. jupyter-execute::

import pygmt
Expand Down
12 changes: 12 additions & 0 deletions doc/user_guide/equivalent_sources/gradient-boosted-eqs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,18 @@ point. We can do so through the :func:`verde.distance_mask` function.

And plot it:

.. jupyter-execute::
:hide-code:

import pygmt

# Needed so that displaying works on jupyter-sphinx and sphinx-gallery at
# the same time. Using PYGMT_USE_EXTERNAL_DISPLAY="false" in the Makefile
# for sphinx-gallery to work means that fig.show won't display anything here
# either.
pygmt.set_display(method="notebook")


.. jupyter-execute::

import pygmt
Expand Down
12 changes: 12 additions & 0 deletions doc/user_guide/equivalent_sources/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ sources are able to reproduce the observed field.

And plot it:

.. jupyter-execute::
:hide-code:

import pygmt

# Needed so that displaying works on jupyter-sphinx and sphinx-gallery at
# the same time. Using PYGMT_USE_EXTERNAL_DISPLAY="false" in the Makefile
# for sphinx-gallery to work means that fig.show won't display anything here
# either.
pygmt.set_display(method="notebook")


.. jupyter-execute::

import pygmt
Expand Down
12 changes: 12 additions & 0 deletions doc/user_guide/forward_modelling/point.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ generated by the whole set of point sources on every computation point:

Lets plot this gravitational field:

.. jupyter-execute::
:hide-code:

import pygmt

# Needed so that displaying works on jupyter-sphinx and sphinx-gallery at
# the same time. Using PYGMT_USE_EXTERNAL_DISPLAY="false" in the Makefile
# for sphinx-gallery to work means that fig.show won't display anything here
# either.
pygmt.set_display(method="notebook")


.. jupyter-execute::

import pygmt
Expand Down
12 changes: 12 additions & 0 deletions doc/user_guide/forward_modelling/prism.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,18 @@ generated by the whole set of prisms on every computation point:

Lets plot this gravitational field:

.. jupyter-execute::
:hide-code:

import pygmt

# Needed so that displaying works on jupyter-sphinx and sphinx-gallery at
# the same time. Using PYGMT_USE_EXTERNAL_DISPLAY="false" in the Makefile
# for sphinx-gallery to work means that fig.show won't display anything here
# either.
pygmt.set_display(method="notebook")


.. jupyter-execute::

import pygmt
Expand Down
12 changes: 12 additions & 0 deletions doc/user_guide/forward_modelling/tesseroid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ generates on the computation point:

And finally plot the computed gravitational field

.. jupyter-execute::
:hide-code:

import pygmt

# Needed so that displaying works on jupyter-sphinx and sphinx-gallery at
# the same time. Using PYGMT_USE_EXTERNAL_DISPLAY="false" in the Makefile
# for sphinx-gallery to work means that fig.show won't display anything here
# either.
pygmt.set_display(method="notebook")


.. jupyter-execute::

import pygmt
Expand Down
12 changes: 12 additions & 0 deletions doc/user_guide/gravity_disturbance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ These observations are located on a regular grid on geodetic coordinates at the
same height of 10 km above the reference ellipsoid.
Lets plot it:

.. jupyter-execute::
:hide-code:

import pygmt

# Needed so that displaying works on jupyter-sphinx and sphinx-gallery at
# the same time. Using PYGMT_USE_EXTERNAL_DISPLAY="false" in the Makefile
# for sphinx-gallery to work means that fig.show won't display anything here
# either.
pygmt.set_display(method="notebook")


.. jupyter-execute::

import pygmt
Expand Down
12 changes: 12 additions & 0 deletions doc/user_guide/topographic_correction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ in Southern Africa.

And plot it:

.. jupyter-execute::
:hide-code:

import pygmt

# Needed so that displaying works on jupyter-sphinx and sphinx-gallery at
# the same time. Using PYGMT_USE_EXTERNAL_DISPLAY="false" in the Makefile
# for sphinx-gallery to work means that fig.show won't display anything here
# either.
pygmt.set_display(method="notebook")


.. jupyter-execute::

import pygmt
Expand Down

0 comments on commit caf3cc1

Please sign in to comment.