# gns-science/gsolve architecture

> Architecture diagram of the GitHub repository gns-science/gsolve, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gns-science/gsolve
- Repository: https://github.com/gns-science/gsolve

## Overview

gSolve is a Python gravity-survey processing library. Its principal workflow imports meter readings and site metadata, builds a survey, applies meter and time-dependent corrections, adjusts survey loops/networks to estimate absolute gravity, then computes gravity corrections and anomalies for export and plotting. The README also documents terrain correction, residual filtering, and three adjustment algorithms. Groupings reflect these domain stages and shared tabular-data infrastructure; unsampled modules are represented only where their paths and capabilities are supported by the tree and README.

Main entry points: [`src/gsolve/observations.py`](https://github.com/gns-science/gsolve/blob/main/src/gsolve/observations.py) (Survey model), [`src/gsolve/sites.py`](https://github.com/gns-science/gsolve/blob/main/src/gsolve/sites.py) (Sites and ties), [`src/gsolve/reductions/anomalies.py`](https://github.com/gns-science/gsolve/blob/main/src/gsolve/reductions/anomalies.py) (Gravity anomalies), [`src/gsolve/reductions/terrain_corrections.py`](https://github.com/gns-science/gsolve/blob/main/src/gsolve/reductions/terrain_corrections.py) (Terrain correction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Survey input"]
  node_scintrex["Scintrex reader<br/>[scintrex.py]"]
  node_observations["Observations<br/>[observations.py]"]
  node_sites["Sites and ties<br/>[sites.py]"]
  node_excel["Excel I/O<br/>[excel_io.py]"]
end

subgraph group_process["Survey processing"]
  node_survey["Survey model<br/>[observations.py]"]
  node_meter["Meter calibration"]
  node_tide["Earth tide<br/>[earth_tide.py]"]
  node_ocean["Ocean loading<br/>[ocean_load.py]"]
  node_adjust["Network adjustment"]
  node_outputs["Survey results<br/>[gsolve_outputs.py]"]
end

subgraph group_reductions["Gravity reductions"]
  node_corrections["Gravity corrections<br/>[corrections.py]"]
  node_terrain["Terrain correction"]
  node_dem["DEM preparation<br/>[xr_methods.py]"]
  node_accessor["Raster operations<br/>[xr_accessor.py]"]
  node_anomalies["Gravity anomalies<br/>[anomalies.py]"]
end

subgraph group_outputs["Results and data"]
  node_reports["Plots and reports<br/>[reports.py]"]
  node_data["Tabular data model<br/>[data.py]"]
end

node_user(("Survey analyst"))
node_pygtide["pygtide"]
node_pyhardisp["pyhardisp"]

node_user -->|"imports readings"| node_scintrex
node_user -->|"supplies survey data"| node_observations
node_user -->|"supplies site data"| node_sites
node_scintrex -->|"provides readings"| node_observations
node_observations -->|"forms survey"| node_survey
node_sites -->|"provides site metadata"| node_survey
node_survey -->|"calibrates readings"| node_meter
node_survey -->|"corrects earth tide"| node_tide
node_survey -.->|"corrects ocean loading"| node_ocean
node_tide -.->|"uses ETERNA"| node_pygtide
node_ocean -.->|"loads model"| node_pyhardisp
node_survey -->|"adjusts network"| node_adjust
node_adjust -->|"produces results"| node_outputs
node_sites -->|"supplies site heights"| node_corrections
node_outputs -->|"supplies absolute gravity"| node_anomalies
node_corrections -->|"supplies reductions"| node_anomalies
node_dem -->|"prepares elevation data"| node_terrain
node_accessor -->|"supports raster operations"| node_terrain
node_sites -->|"supplies site locations"| node_terrain
node_terrain -->|"supplies terrain values"| node_anomalies
node_anomalies -->|"provides results"| node_reports
node_outputs -->|"provides survey results"| node_reports
node_survey -->|"reads and writes workbooks"| node_excel
node_sites -->|"reads and writes workbooks"| node_excel
node_anomalies -->|"exports results"| node_excel
node_survey -->|"uses tabular structures"| node_data

click node_scintrex "https://github.com/gns-science/gsolve/blob/main/src/gsolve/scintrex.py"
click node_observations "https://github.com/gns-science/gsolve/blob/main/src/gsolve/observations.py"
click node_sites "https://github.com/gns-science/gsolve/blob/main/src/gsolve/sites.py"
click node_excel "https://github.com/gns-science/gsolve/blob/main/src/gsolve/core/excel_io.py"
click node_survey "https://github.com/gns-science/gsolve/blob/main/src/gsolve/observations.py"
click node_meter "https://github.com/gns-science/gsolve/blob/main/src/gsolve/meter_conversion.py"
click node_tide "https://github.com/gns-science/gsolve/blob/main/src/gsolve/tide/earth_tide.py"
click node_ocean "https://github.com/gns-science/gsolve/blob/main/src/gsolve/tide/ocean_load.py"
click node_adjust "https://github.com/gns-science/gsolve/blob/main/src/gsolve/gsolve_algorithms.py"
click node_outputs "https://github.com/gns-science/gsolve/blob/main/src/gsolve/gsolve_outputs.py"
click node_corrections "https://github.com/gns-science/gsolve/blob/main/src/gsolve/reductions/corrections.py"
click node_terrain "https://github.com/gns-science/gsolve/blob/main/src/gsolve/reductions/terrain_corrections.py"
click node_dem "https://github.com/gns-science/gsolve/blob/main/src/gsolve/core/xr_methods.py"
click node_accessor "https://github.com/gns-science/gsolve/blob/main/src/gsolve/core/xr_accessor.py"
click node_anomalies "https://github.com/gns-science/gsolve/blob/main/src/gsolve/reductions/anomalies.py"
click node_reports "https://github.com/gns-science/gsolve/blob/main/src/gsolve/reports.py"
click node_data "https://github.com/gns-science/gsolve/blob/main/src/gsolve/core/data.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_scintrex,node_observations,node_sites,node_excel toneBlue
class node_survey,node_meter,node_tide,node_ocean,node_adjust,node_outputs toneAmber
class node_corrections,node_terrain,node_dem,node_accessor,node_anomalies toneMint
class node_reports,node_data toneRose
class node_user,node_pygtide,node_pyhardisp toneIndigo
```

## Components

### Survey input

- [Scintrex reader](https://github.com/gns-science/gsolve/blob/main/src/gsolve/scintrex.py): `src/gsolve/scintrex.py`
- [Observations](https://github.com/gns-science/gsolve/blob/main/src/gsolve/observations.py): `src/gsolve/observations.py`
- [Sites and ties](https://github.com/gns-science/gsolve/blob/main/src/gsolve/sites.py): `src/gsolve/sites.py`
- [Excel I/O](https://github.com/gns-science/gsolve/blob/main/src/gsolve/core/excel_io.py): `src/gsolve/core/excel_io.py`

### Survey processing

- [Survey model](https://github.com/gns-science/gsolve/blob/main/src/gsolve/observations.py): `src/gsolve/observations.py`
- [Meter calibration](https://github.com/gns-science/gsolve/blob/main/src/gsolve/meter_conversion.py): `src/gsolve/meter_conversion.py`
- [Earth tide](https://github.com/gns-science/gsolve/blob/main/src/gsolve/tide/earth_tide.py): `src/gsolve/tide/earth_tide.py`
- [Ocean loading](https://github.com/gns-science/gsolve/blob/main/src/gsolve/tide/ocean_load.py): `src/gsolve/tide/ocean_load.py`
- [Network adjustment](https://github.com/gns-science/gsolve/blob/main/src/gsolve/gsolve_algorithms.py): `src/gsolve/gsolve_algorithms.py`
- [Survey results](https://github.com/gns-science/gsolve/blob/main/src/gsolve/gsolve_outputs.py): `src/gsolve/gsolve_outputs.py`

### Gravity reductions

- [Gravity corrections](https://github.com/gns-science/gsolve/blob/main/src/gsolve/reductions/corrections.py): `src/gsolve/reductions/corrections.py`
- [Terrain correction](https://github.com/gns-science/gsolve/blob/main/src/gsolve/reductions/terrain_corrections.py): `src/gsolve/reductions/terrain_corrections.py`
- [DEM preparation](https://github.com/gns-science/gsolve/blob/main/src/gsolve/core/xr_methods.py): `src/gsolve/core/xr_methods.py`
- [Raster operations](https://github.com/gns-science/gsolve/blob/main/src/gsolve/core/xr_accessor.py): `src/gsolve/core/xr_accessor.py`
- [Gravity anomalies](https://github.com/gns-science/gsolve/blob/main/src/gsolve/reductions/anomalies.py): `src/gsolve/reductions/anomalies.py`

### Results and data

- [Plots and reports](https://github.com/gns-science/gsolve/blob/main/src/gsolve/reports.py): `src/gsolve/reports.py`
- [Tabular data model](https://github.com/gns-science/gsolve/blob/main/src/gsolve/core/data.py): `src/gsolve/core/data.py`

### Other components

- **Survey analyst**
- **pygtide**
- **pyhardisp**

## Connections

- Survey analyst → Scintrex reader: imports readings
- Survey analyst → Observations: supplies survey data
- Survey analyst → Sites and ties: supplies site data
- Scintrex reader → Observations: provides readings
- Observations → Survey model: forms survey
- Sites and ties → Survey model: provides site metadata
- Survey model → Meter calibration: calibrates readings
- Survey model → Earth tide: corrects earth tide
- Survey model → Ocean loading: corrects ocean loading
- Earth tide → pygtide: uses ETERNA
- Ocean loading → pyhardisp: loads model
- Survey model → Network adjustment: adjusts network
- Network adjustment → Survey results: produces results
- Sites and ties → Gravity corrections: supplies site heights
- Survey results → Gravity anomalies: supplies absolute gravity
- Gravity corrections → Gravity anomalies: supplies reductions
- DEM preparation → Terrain correction: prepares elevation data
- Raster operations → Terrain correction: supports raster operations
- Sites and ties → Terrain correction: supplies site locations
- Terrain correction → Gravity anomalies: supplies terrain values
- Gravity anomalies → Plots and reports: provides results
- Survey results → Plots and reports: provides survey results
- Survey model → Excel I/O: reads and writes workbooks
- Sites and ties → Excel I/O: reads and writes workbooks
- Gravity anomalies → Excel I/O: exports results
- Survey model → Tabular data model: uses tabular structures
