Skip to content
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

Spider plot update #254

Merged
merged 8 commits into from
Mar 11, 2024
Merged

Spider plot update #254

merged 8 commits into from
Mar 11, 2024

Conversation

thurinj
Copy link
Member

@thurinj thurinj commented Mar 1, 2024

This PR is focused on "spider-plots" improvement. The goal is to provide a solid pygmt 'basic' backend that should adapt to most situations.

It features:

  • Adaptive zone/topography resolution
  • Coastlines
  • Header (different for Rayleigh, Love, and Body waves)
  • Option to plot best fitting moment tensor
  • Ability to plot active and non-active stations but present in the stations list for each component

Most of the processing, setup, adjustments are handled through a pygmt utility function class, so as not to use some of the pygmt specific functions in a matplotlib context, by adding a contextual layer of separation (I don't expect someone to use a PyGMTUtilities.helper_function() into a matplotlib plot for instance).

I also added a high-level function to plot the normalized cross-correlation value on top of others.

Implemented a full "generic" pygmt spider plot, with dynamic topography, coastlines, moment tensor and header option. The backend comes with a utility class where most individual functions are stored.
Added a new plotting function for normalized cross-correlation, working with the default and pygmt backend.
Fixed text placement. Will now be automatically placed based of figure dimensions / latitude extent, and longitude.
Updated cross_correlation docstring.
@thurinj
Copy link
Member Author

thurinj commented Mar 6, 2024

Hey @rmodrak,

Please let me review a few things before going through, there are some minor adjustments I want to make to ensure plotting consistencies regardless of the region of the globe that is plotted (especially the topography amplitude).

In the meantime, here are some of the output of the script from the 2009 example, so you can see where things are headed to:

image

and another result plotted in a different region (without having to tweak any of the plotting parameters):

image

I am foreseeing adjustments on the appearance of the beachball, and improving the topography normalization to ensure the grayscale contrast are always about the same and the topo doesn't seem too exaggerated.

Introduced histogram gaussian normalization for background topo map to avoid too-harsh contrasts. Change moment tensor coloring.
Added complete docstring for the pygmt functions.
Changed the function so that it can handle all combination of text + latex math expressions.
Added a few key functions for the attributes pygmt plotting backend. Compilation was tested with the building script and html renders as expected.
@thurinj
Copy link
Member Author

thurinj commented Mar 7, 2024

I've done some extensive rework on the docstrings which I also included in the autogenerated documentation (after checking). I was not aware of the exact text format that Sphinx expected, but know I know.

All functions, class and methods are now properly documented.

The only piece of the PR I am not too sure about is the "safety" **kwargs I have added to the _default_backend, in order to accommodate the complete stations list that is needed to plot the not-used stations in the pygmt script.

One solution would be to also include these stations as hollow triangles in the default backend, so both standard backend would need this input as argument.

The other solution is to include a check before calling the backend, but I don't want to obfuscate the function with conditional checks at this stage. It would become messy if, say someone use another external plotting backend.

@rmodrak rmodrak merged commit 8199919 into master Mar 11, 2024
1 check passed
@thurinj thurinj deleted the pygmt_spider_plot branch April 3, 2024 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants