-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace Cartopy with PyGMT #327
Conversation
A change to |
I'm happy to update the User Guide examples as well. I think the ones I've already committed were for the old user guide example in the |
@mdtanker with the new structure @santisoler built, you can edit those directly. The |
@leouieda how can I run the .rst files to see my changes? I'm trying to build the docs with |
I've now updated the |
@mdtanker sorry I forgot to say that sphinx-gallery needs to be configured to capture PyGMT figures. See this line in the There's also an |
@leouieda thanks, I think that's fixed it! I've converted all of the figures in the .rst files in the user guide from matplotlib to pygmt. I skipped I've also converted the gallery examples in Before I realized they aren't being used anymore, I converted the .py files under I'm happy to change the styling of the plots, like projection, font size, frame type, etc. |
Not sure why the documentation build has failed, it built fine on my local machine... |
@mdtanker it looks like it timed out when downloading the sample data. I'm rerunning it to see it was an intermittent problem. Thanks for all of this! |
Found the culprit! PyGMT will open the figure and wait for it to be closed before continuing. It probably does that when you build locally right? That's why it hangs on the CI since the figure never closes. To prevent that, the |
Ah great, thanks for finding that! I'll fix that now and try again. I noticed in the ensaio .yml (link below) that GMT is included, as well as version requirements for both GMT and pyGMT. Should I add GMT specifically to the harmonica .yml? For consistency, should I use the same versions as ensaio?
https:/fatiando/ensaio/blob/24d3910c807e0dc3fa6fd5d356609d97b56cd74c/environment.yml#L28 |
I have not removed cartopy or matplotlib from the following places, but happy to do so if it's appropriate: env/requirements-docs.txt I also noticed in init.py there is a test for whether generated figures match against baseline figures. Looking at the PyGMT contributors guide looks like it works for comparing PyGMT plots as well. @leouieda do we want to implement these figure tests in Harmonica? |
@santisoler let me know if there's anything else you want me to do for these examples to be able to merge them! |
Hi @mdtanker! Sorry for leaving this PR a little bit behind. I'll take a look at it, try to resolve the conflicts we have now and I'll come back if it needs something else in order to be merged. Do you consider it's ready? Has all the examples been ported to PyGMT? |
No worries and no rush. Yes, I believe all the User Guide and Gallery examples have been converted, except for doc/user_guide/gravity_disturbance.rst since there was discussion of removing it from Harmonica fatiando/boule#31. I think the three conflicts are from #342, but I had already added |
I've resolved the conflicts and I think it's all ready to merge. Here's a pdf of the gallery index page. The docs built fine on my local machine, but I'm not sure how to check if they're built alright in the PR. |
Pin versions of pygmt, gmt and gdal in environment.yml and env/requirements-docs.txt. Also pin `python==3.9.*` to allow installing newer versions that python 3.9.0. The gdal version was pinned based on trial and error after facing issues when trying to build the docs locally in my machine.
I was facing some issues when trying to build the docs locally with the packages installed through the With this environment.yml file it's working. And I've also pinned GMT just in case. @leouieda would you check if it's working locally for you as well? |
@mdtanker I'm merging this. I think this is more than ready. If we spot any detail we want to change, we can do so in another PR. Thank you very much for this, tremendous work! 🏅🚀 |
Thanks @santisoler! I just noticed that even though the Any idea why the Gallery examples have been updated, but the .rst User Guides haven't been updated? Same thing seems to have happened to the install.rst file, where cartopy should have been replaced by pygmt. |
@mdtanker The Forward Modeling - Points page you are looking at corresponds to the docs for the latest version (Harmonica v0.5.1). Although this PR have already been merged, these changes could be seen only in the |
Okay that makes sense, I thought it was part of v.0.5.1 but just wasn't updating 👍 |
Description
Update Gallery and User Guide to use PyGMT for plotting instead of Cartopy.
Ditch Cartopy from the
requirements-*.txt
files and fromenvironment.yml
and add GMT and PyGMT. Pin GMT, PyGMT and gdal versions to avoid failures
during doc building. The versions were obtained from trial and error on local
system, inspired on the versions working on GitHub Actions. Edit
doc/Makefile
to disable PyGMT usage of external display when building the docs. Pin Python
to
3.9.*
to avoid strictly pinning Python3.9.0
.I tried to match the original example plots as best as I could.
Relevant issues/PRs
Fixes #317