vtsuperdarn/davitpy — pull request #74 by mrwessel (2014-08-11 23:33:34+00:00)
Title: New and Improved!  It's coord_conv!  Now for only three easy payments of $49.99! (+S&H)

I have re-written coordConv as coord_conv. The structure of the code has been changed to make it easier to understand and to make it _easy to add new coordinate systems_. Also, as hinted by the name change, it is now PEP 8 - compliant. So as not to break any back-compat, the coordUtils module includes a function coordConv that looks the same as the current develop version but just prints a deprecation message and calls coord_conv.

The method of conversion implemented uses "families" of coordinate systems; e.g., MLT and AACGM are in the AACGM family because they are the same thing but with a shift thrown in. It works like this:
1. If start system is in a family (i.e., not geo):
a. Convert to base system of family (e.g., MLT to AACGM).
b. If end system is not in same family, convert to geo.
2. If not in end system by now:
a. If start and end are in same family it's in family base system already, otherwise convert geo to family base system.
b. Convert to end system from family base system.

The code comments describe the operation in detail and provide a how-to for adding new coordinate systems, so they are well worth a read.