How fatiando/harmonica works
Main Components
• Core Libraries:
• The heart of the library resides in the “harmonica” package. Within it, there are several subcomponents:
▪ _equivalent_sources (methods to handle different equivalent source formulations in both cartesian and spherical coordinates)
▪ _forward (forward modeling routines including tesseroids, prisms, dipoles, and additional specialized utilities)
▪ _io (input/output conversion routines that read/write various geophysical data formats)
▪ _gravity_corrections, _isostasy, and _transformations (handling correction computations and transformations)
▪ _spherical_harmonics (Legendre functions and related computations)
▪ filters (digital filtering implementations, e.g. FFT filters)
▪ visualization (basic routines for visual presentation of modeling results)
• Testing Suite:
• Located under “harmonica/tests”, it ensures that each module works as expected. Emphasize its separation to illustrate quality assurance and continuous integration.
• Documentation and Examples:
• “doc” contains Sphinx-based documentation for developer and user guides.
• “examples” provides hands-on scripts demonstrating module usage. This helps users quickly understand how the individual computational routines interconnect.
• CI/CD & Project Infrastructure:
• Files and directories like “.github/workflows”, “Makefile”, and “environment.yml” indicate automated testing, deployment, and documentation builds.
• These components show the project’s commitment to continuous integration, style checks, and deployment automation.
Relationships and Data Flow
• User/Application Code ⟶ calls the functions in the “harmonica” core modules.
• “harmonica” modules interacting with “_io” for file formats when ingesting data.
• Forward modeling routines invoking transformation or filtering utilities.
• Inversion methods (modeled as class-based interfaces) that depend on computed forward responses for solving inverse problems.
• How logging, error correction, or parameter passing occurs between submodules, particularly between core libraries and data input/output.
Architectural Patterns and Design Principles
• Modular design by showing each computational area as a separate module (e.g., forward modeling, equivalent sources, corrections).
• Scikit-learn inspired interface of inversion methods; illustrate this as a design pattern where computational routines are wrapped as classes to allow seamless integration with other Python scientific tools.
• Layered approach: low-level numerical utilities (e.g., filters, _utils) form the base, with higher-level processing, modeling, and I/O modules leveraging those utilities.
Relevant Technologies & Frameworks
• Python is the core language.
• Sphinx (in “doc”) for documentation.
• GitHub Actions (in “.github/workflows”) for continuous integration and testing.
• Community and deployment tools (e.g., PyPI for distribution and various Python dependency managers as seen by “environment.yml” and “requirements-*.txt” files).