# mchristoffersen/sharad-tools architecture

> Architecture diagram of the GitHub repository mchristoffersen/sharad-tools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mchristoffersen/sharad-tools
- Repository: https://github.com/mchristoffersen/sharad-tools

## Overview

##### Main Components

a) Data Input Layer:
- SHARAD EDR (Experimental Data Record) files
- Auxiliary data files
- Calibration data
- Configuration files

b) Processing Modules:
- Range Compression Module
- Depth Adjustment Module
- Surface Power Analysis Module
- First Return Detection Module
- Navigation Data Processing Module

c) Database Layer:
- PostgreSQL database for EDR navigation data
- Data query interface

**[Raw Data Sources] → [Processing Modules] → [Output Products]**

**Input Layer | Processing Layer | Storage/Output Layer**

##### Specific Component Relationships

- EDR files → Range Compression → Compressed Radargrams
- Compressed Radargrams → Depth Adjustment → Depth-Corrected Radargrams
- Radargrams → Surface Power Analysis → Surface Power Measurements
- EDR Navigation Data → PostgreSQL Database → Query Interface

##### Important Details

a) File Format Handlers:
- Various format readers (.dat, .lbl files)
- Calibration data flow

b) Processing Pipeline Options:
- Parallel paths for MATLAB and Python implementations
- Optional processing steps

##### Technical Elements to Highlight

- Reference chirp processing
- Range compression algorithms
- Navigation data extraction
- Surface power detection
- Database query system

##### Implementation Notes

- Range compression workflow
- Navigation data processing
- Surface power analysis

Key Considerations:
##### Where calibration data is applied

Remember to maintain a balance between showing the overall system architecture while providing enough detail to understand the data processing workflow. Use UML or similar notation for clarity and consistency.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        EDR[Raw SHARAD EDR Data]:::input
        CAL[Calibration Files]:::input
        click CAL "https://github.com/mchristoffersen/sharad-tools/tree/master/rangeCompress/calib/"
        FMT[Format Definition Files]:::input
        click FMT "https://github.com/mchristoffersen/sharad-tools/tree/master/rangeCompress/format/"
        NAV[Navigation Data]:::input
        CONF[Configuration Files]:::input
        click CONF "https://github.com/mchristoffersen/sharad-tools/blob/master/reflectivity_config.txt"
    end

    subgraph Processing
        RC[Range Compression Module]:::process
        click RC "https://github.com/mchristoffersen/sharad-tools/blob/master/rangeCompress/code/python/range_Compress.py"
        
        RCM[MATLAB Implementation]:::process
        click RCM "https://github.com/mchristoffersen/sharad-tools/blob/master/rangeCompress/code/matlab/edr_Process.m"
        
        EDR_PROC[EDR Processing]:::process
        click EDR_PROC "https://github.com/mchristoffersen/sharad-tools/blob/master/rangeCompress/code/python/read_EDR.py"
        
        DA[Depth Adjustment Module]:::process
        click DA "https://github.com/mchristoffersen/sharad-tools/blob/master/depthAdjust/depthAdj.py"
        
        SPA[Surface Power Analysis]:::process
        click SPA "https://github.com/mchristoffersen/sharad-tools/blob/master/surfPow/surf_Pow.py"
        
        NADIR[Surface Power Nadir Analysis]:::process
        click NADIR "https://github.com/mchristoffersen/sharad-tools/blob/master/surfPow/nadir.py"
        
        FR[First Return Detection]:::process
        click FR "https://github.com/mchristoffersen/sharad-tools/blob/master/firstReturn/fret_edr.py"
        
        NAV_PROC[Navigation Processing]:::process
        click NAV_PROC "https://github.com/mchristoffersen/sharad-tools/blob/master/psql/nav/edrNav_psql_import.py"
    end

    subgraph Database
        DB_NAV[Navigation Schema]:::db
        click DB_NAV "https://github.com/mchristoffersen/sharad-tools/blob/master/psql/nav/edrNav_DB.txt"
        
        DB_RSR[RSR Schema]:::db
        click DB_RSR "https://github.com/mchristoffersen/sharad-tools/blob/master/psql/rsr/rsr_DB.txt"
        
        DB_SREF[SREF Schema]:::db
        click DB_SREF "https://github.com/mchristoffersen/sharad-tools/blob/master/psql/sref/sref_DB.txt"
        
        PSQL[(PostgreSQL DB)]:::db
    end

    EDR --> EDR_PROC
    CAL --> RC
    FMT --> RC
    CONF --> SPA

    EDR_PROC --> RC
    EDR_PROC --> RCM

    RC --> DA
    RCM --> DA
    DA --> SPA
    SPA --> NADIR
    DA --> FR

    NAV --> NAV_PROC
    NAV_PROC --> PSQL

    PSQL --> DB_NAV
    PSQL --> DB_RSR
    PSQL --> DB_SREF

    classDef input fill:#b3d9ff,stroke:#333,stroke-width:2px
    classDef process fill:#98FB98,stroke:#333,stroke-width:2px
    classDef db fill:#FFE4B5,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[Input Components]:::input
        L2[Processing Modules]:::process
        L3[Database Components]:::db
    end
```
