fatiando / harmonica

Forward modeling, inversion, and processing gravity and magnetic data
https://www.fatiando.org/harmonica
BSD 3-Clause "New" or "Revised" License
205 stars 66 forks source link

PyGMT figures are not being showed in the latest docs #473

Closed santisoler closed 3 months ago

santisoler commented 4 months ago

Page that contains the error or needs to be improved (paste link):

The PyGMT figures we generate while building the docs are not being correctly added to the dev versions of the Harmonica docs.

For example, compare the Gravity Disturbance page in:

I suspect the issue might come from a combination of PyGMT and jupyter-sphinx.

leouieda commented 4 months ago

Ah yes, I recently came across this and forgot to fix it here. The problem is that PyGMT tries to guess if we're in a notebook and sets the display of images only if it things we're in one. But since we set the external display to off when running the gallery, it turned off all displays. This is the offending line https://github.com/GenericMappingTools/pygmt/blob/main/pygmt/figure.py#L47

santisoler commented 4 months ago

Thanks for pointing to that line @leouieda. I've created a patch for this by explicitly setting method="notebook" in the user guide (#474). But maybe we can set this through a env var? Or maybe this deserves opening an issue in PyGMT adding an envvar to control this.

leouieda commented 4 months ago

I was adding a hidden cell that sets this globally for each page. But this deserves a fix in PyGMT.