uafgeotools / mtuq

moment tensor uncertainty quantification
BSD 2-Clause "Simplified" License
65 stars 22 forks source link

Replacing GMT/PyGMT backend by pure Matplotlib backend #268

Open thurinj opened 1 month ago

thurinj commented 1 month ago

This PR implements some major changes in MTUQ plotting system. I implemented an equivalent plotting function to all existing visualization methods currently implemented in MTUQ, apart from the attribute-mapping functions, which are still the minimal matplotlib implementation - PyGMT is still preferred for those (until I figure out a clean implementation based on Cartopy eventually, but it is not priority atm).

The significant change here is that I have replaced all the default behavior/default calls from GMT/PyGMT with these new Matplotlib methods.

Here are a few examples of the visualization:

note: For the depth and hypocenter search results, I used a local database, which is not very appropriate for the 2009 event, to avoid having to wait for the Syngine download for all these origins. You should be able to reproduce all these by running the detailed example, depth and hypocenter search from the examples folder on this branch.

All the moment tensors are plotted with a custom method based on the direct computation of the radiation coefficient of the lower half-sphere of the beachball. The values are projected on the 2D plane, and the surface is built on a regular interpolated surface. The method implements a "level of detail" approach for the density of this approximation: a dense grid for the "big beachball" and a coarser grid for the small beachball displayed on the map and depth sections (as otherwise, it could take too long to plot the beachballs based on this direct approximation method).

I'd love to have feedback on this one if you have other events to test it on, etc, but I am confident we can push it as a new visualization backend.