# noaa-owp/ngen architecture

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

- Interactive diagram: https://gitdiagram.com/noaa-owp/ngen
- Repository: https://github.com/noaa-owp/ngen

## Overview

##### Main Components

a. Core Framework Components:
- Catchment System
- Realization System
- BMI (Basic Model Interface) Adapters
- Forcing System
- Routing System
- Hydrofabric Components

b. External Integration Layer:
- Model Interfaces (C++, C, Fortran, Python)
- Data Providers
- Configuration Systems

c. Data Management:
- GeoJSON Processing
- GeoPackage Support
- NetCDF Integration
- CSV Handling

##### Key Relationships

a. Hierarchical Structure:
- Relationship between Catchments and their Realizations
- Complex Realizations containing nested catchments
- Connection between Catchments and Nexus points

b. Data Flow:
- Input data flow through Forcing providers
- Model interaction through BMI adapters
- Inter-catchment communication
- Routing system water movement

**[Configuration Systems] --- [External Model Interfaces] --- [Data Input/Output]**

**[Catchment Manager] --- [Realization Manager] --- [Routing Engine]**

**[BMI Adapters (C/C++/Fortran/Python)] --- [Model Implementations]**

**[GeoJSON/GeoPackage] --- [NetCDF/CSV] --- [Forcing Data]**

##### Implementation Details

- Interface points for external model integration

##### Additional Elements

- Version information
- System requirements
- Key dependencies (Boost, NetCDF, etc.)

- Data-centric approach
- Polymorphic interfaces
- Recursive abstraction capabilities
- Strict API boundaries
- Component orchestration

Remember to maintain a balance between detail and clarity, focusing on the architectural relationships while avoiding overwhelming technical implementation details.

This system design should be created using a professional diagramming tool that supports UML or similar notation, ensuring that the complex relationships between components are clearly visible while maintaining the flexibility to show both high-level architecture and detailed component interactions when needed.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef core fill:#b3d1ff,stroke:#333
    classDef interface fill:#ffd9b3,stroke:#333
    classDef data fill:#b3ffb3,stroke:#333
    classDef model fill:#ffb3d9,stroke:#333
    classDef config fill:#e6b3ff,stroke:#333

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[External Interfaces]:::interface
        L3[Data Management]:::data
        L4[Model Integration]:::model
        L5[Configuration]:::config
    end

    %% Interface Layer
    subgraph InterfaceLayer
        Config[Configuration Systems]:::config
        ExtInt[External Model Interfaces]:::interface
        DataIO[Data Input/Output]:::data
    end

    %% Core Framework Layer
    subgraph CoreFramework
        CatchSys[Catchment System]:::core
        RealSys[Realization System]:::core
        RouteEng[Routing System]:::core
        NexusSys[Nexus System]:::core
        HydroComp[Hydrofabric Components]:::core
    end

    %% Model Integration Layer
    subgraph ModelIntegration
        BMI[BMI Adapters]:::model
        ModelImpl[Model Implementations]:::model
    end

    %% Data Management Layer
    subgraph DataManagement
        GeoData[GeoJSON/GeoPackage]:::data
        NetCDF[NetCDF/CSV]:::data
        ForcingData[Forcing System]:::data
    end

    %% Relationships
    Config --> CatchSys
    Config --> RealSys
    Config --> RouteEng
    
    CatchSys --> NexusSys
    CatchSys --> RealSys
    RealSys --> BMI
    RealSys --> ModelImpl
    
    ForcingData --> CatchSys
    RouteEng --> NexusSys
    
    GeoData --> HydroComp
    NetCDF --> ForcingData
    
    BMI --> ExtInt
    ModelImpl --> ExtInt

    %% Click Events
    click CatchSys "https://github.com/noaa-owp/ngen/tree/master/include/core/catchment/"
    click BMI "https://github.com/noaa-owp/ngen/tree/master/include/bmi/"
    click ForcingData "https://github.com/noaa-owp/ngen/tree/master/include/forcing/"
    click RouteEng "https://github.com/noaa-owp/ngen/tree/master/include/routing/"
    click GeoData "https://github.com/noaa-owp/ngen/tree/master/include/geojson/"
    click ModelImpl "https://github.com/noaa-owp/ngen/tree/master/include/realizations/catchment/"
    click Config "https://github.com/noaa-owp/ngen/tree/master/include/realizations/config/"
    click HydroComp "https://github.com/noaa-owp/ngen/tree/master/include/core/"
    click RealSys "https://github.com/noaa-owp/ngen/tree/master/include/realizations/"
    click NexusSys "https://github.com/noaa-owp/ngen/tree/master/include/core/nexus/"
```
