# bentian/corrdiff_output architecture

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

- Interactive diagram: https://gitdiagram.com/bentian/corrdiff_output
- Repository: https://github.com/bentian/corrdiff_output

## Overview

##### Main Components
- Input Data & Configuration:
- An “Input Data” component representing the user-supplied directory that includes NetCDF datasets, TensorBoard logs (for regression and diffusion), and Hydra configurations. This is passed as the input to the system.
- Data Processing Pipeline:
- Data Masking Module:
- Metrics Computation Module:
- Plotting and Visualization Module:
- Output Generation and Web Display:
- Have a component labeled “Output Generation” which shows that processed plots (PNG), tables (TSV), and masked NetCDF files are saved into directories such as docs/experiments. Also note that the docs folder contains the web presentation features (HTML, CSS, JS) that allow users to browse and view outputs.
- Automation & Refresh:

##### Architectural Patterns & External Dependencies
- That the project uses a clear pipeline architecture where each script/module forms a stage in processing.
- To label external libraries and tools (such as xskillscore for metrics computation and NetCDF libraries for file handling).
- Usage of configuration management (via Hydra configs and YAML files) that control the operation of the pipeline.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Input & Configuration"
        Input["Input Data"]:::data
        Config["Configuration"]:::data
    end

    MainPipeline["corrdiff_plotgen.py (Main Pipeline)"]:::module

    Input -->|"ingests"| MainPipeline
    Config -->|"ingests"| MainPipeline

    subgraph "Processing Modules"
        Mask["mask_samples.py (Masking Module)"]:::module
        Metrics["score_samples_v2.py (Metrics Module)"]:::module
    end

    MainPipeline -->|"routes_to_mask"| Mask
    MainPipeline -->|"routes_to_metrics"| Metrics

    subgraph "Visualization Module"
        PlotHelper["plot_helpers.py"]:::module
        PlotPRCP["plot_prcp_metrics.py"]:::module
    end

    Mask -->|"feeds"| PlotHelper
    Metrics -->|"feeds"| PlotHelper
    Mask -->|"feeds"| PlotPRCP
    Metrics -->|"feeds"| PlotPRCP

    Output["Output Generation (docs/experiments)"]:::output

    PlotHelper -->|"generates"| Output
    PlotPRCP -->|"generates"| Output

    subgraph "Web Display"
        WebHTML["HTML Presentation"]:::web
        WebCSS["CSS Styles"]:::web
        WebJS["JS Scripts"]:::web
    end

    Output -->|"serves"| WebHTML
    Output -->|"serves"| WebCSS
    Output -->|"serves"| WebJS

    Auto["Automation (refresh.zsh)"]:::automation
    Auto -->|"refreshes"| MainPipeline

    %% Click Events
    click Input "https://github.com/bentian/corrdiff_output/tree/main/data/"
    click Config "https://github.com/bentian/corrdiff_output/blob/main/corrdiff.yml"
    click MainPipeline "https://github.com/bentian/corrdiff_output/blob/main/corrdiff_plotgen.py"
    click Mask "https://github.com/bentian/corrdiff_output/blob/main/mask_samples.py"
    click Metrics "https://github.com/bentian/corrdiff_output/blob/main/score_samples_v2.py"
    click PlotHelper "https://github.com/bentian/corrdiff_output/blob/main/plot_helpers.py"
    click PlotPRCP "https://github.com/bentian/corrdiff_output/blob/main/plot_prcp_metrics.py"
    click Output "https://github.com/bentian/corrdiff_output/tree/main/docs/experiments"
    click WebHTML "https://github.com/bentian/corrdiff_output/blob/main/docs/index.html"
    click WebCSS "https://github.com/bentian/corrdiff_output/tree/main/docs/css/"
    click WebJS "https://github.com/bentian/corrdiff_output/tree/main/docs/js/"
    click Auto "https://github.com/bentian/corrdiff_output/blob/main/refresh.zsh"

    %% Styles
    classDef data fill:#bbf,stroke:#333,stroke-width:2px;
    classDef module fill:#f9f,stroke:#333,stroke-width:2px;
    classDef output fill:#dfd,stroke:#333,stroke-width:2px;
    classDef web fill:#ffd,stroke:#333,stroke-width:2px;
    classDef automation fill:#fdd,stroke:#333,stroke-width:2px;
```
