GenericMappingTools / pygmt

A Python interface for the Generic Mapping Tools.
https://www.pygmt.org
BSD 3-Clause "New" or "Revised" License
763 stars 219 forks source link

Add private _FocalMechanismConvention class for handling focal mechanism conventions and refactor Figure.meca #3551

Open seisman opened 3 weeks ago

seisman commented 3 weeks ago

Functions convention_code, convention_name, convention_params are defined in meca.py and they can also be used when wrapping coupe (#2019). So it's better to move these shared functions into pygmt/src/_common.py as proposed in #3357.

Instead of simply moving the functions, this PR adds the private _FocalMechanismConvention class which does the same thing as the three functions. With this new class, the Figure.meca source codes can be simplified.

It's likely the Figure.meca method can be further simplified, but will leave it to future PRs to make this PR small for reviewing.