# ruohan-li/solarcube architecture

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

- Interactive diagram: https://gitdiagram.com/ruohan-li/solarcube
- Repository: https://github.com/ruohan-li/solarcube

## Overview

##### Main Components

a. Data Layer:
- SolarCube Dataset (containing satellite imagery and in-situ data)
- Data Loading/Generation Components
- Data Generator
- DataLoader
- Time Features Processing

b. Model Layer (Multiple Architectures):
- ConvLSTM Model
- Cuboid Transformer
- Informer Transformer
- LSTM Model

c. Utils Layer:
- Metrics and Evaluation
- Configuration Management
- Checkpoint Handling
- Tools and Utilities

**[Data Layer] → [Model Layer] → [Evaluation Layer]**

**[Satellite Images] →\**
- [Data Generator] → [DataLoader] → [Time Features]
**[In-situ Data]    →/**

- /→ [ConvLSTM Branch]
- /→  [Cuboid Transformer Branch]
**[Input] →  →  [Informer Transformer Branch]**
- →  [LSTM Branch]

##### Specific Implementation Details

For each model architecture, show:
- Encoder-Decoder structure (where applicable)
- Attention mechanisms (especially in transformer-based models)
- Configuration files connection
- Training flow

##### Key Relationships to Highlight

- Data preprocessing pipeline
- Model training workflows
- Evaluation metrics flow
- Configuration management system

##### Technical Details

- File formats and data types
- Model architecture specifications
- Training parameters
- Evaluation metrics

##### The configuration management system

Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that make this system unique, particularly the multiple model approaches for solar energy forecasting.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef data fill:#b3d9ff,stroke:#333
    classDef model fill:#90EE90,stroke:#333
    classDef utils fill:#FFB366,stroke:#333
    classDef eval fill:#DDA0DD,stroke:#333
    classDef config fill:#FFE4B5,stroke:#333

    %% Data Layer
    subgraph DataLayer
        SatImages["Satellite Images"]:::data
        InSituData["In-situ Data"]:::data
        DataGen["Data Generator"]:::data
        DataLoad["DataLoader"]:::data
        TimeFeatures["Time Features"]:::data

        SatImages --> DataGen
        InSituData --> DataGen
        DataGen --> DataLoad
        DataLoad --> TimeFeatures
    end

    %% Model Layer
    subgraph ModelLayer
        subgraph ModelArchitectures
            ConvLSTM["ConvLSTM Model"]:::model
            CuboidTF["Cuboid Transformer"]:::model
            InformerTF["Informer Transformer"]:::model
            LSTM["LSTM Model"]:::model
        end

        TimeFeatures --> ConvLSTM
        TimeFeatures --> CuboidTF
        TimeFeatures --> InformerTF
        TimeFeatures --> LSTM
    end

    %% Utils and Config Layer
    subgraph UtilsLayer
        Metrics["Metrics & Evaluation"]:::eval
        CheckPoint["Checkpoint Handler"]:::utils
        Utils["General Utilities"]:::utils
        
        subgraph Configs
            ConvConfig["ConvLSTM Config"]:::config
            CuboidConfig["Cuboid Config"]:::config
            InformerConfig["Informer Config"]:::config
            LSTMConfig["LSTM Config"]:::config
        end
    end

    %% Connections to Utils
    ConvLSTM --> Metrics
    CuboidTF --> Metrics
    InformerTF --> Metrics
    LSTM --> Metrics

    ConvConfig --> ConvLSTM
    CuboidConfig --> CuboidTF
    InformerConfig --> InformerTF
    LSTMConfig --> LSTM

    CheckPoint -.-> ModelArchitectures
    Utils -.-> DataLayer

    %% Click events for component mapping
    click DataGen "https://github.com/Ruohan-Li/SolarCube/blob/master/solarcube/data_generator.py"
    click DataLoad "https://github.com/Ruohan-Li/SolarCube/blob/master/solarcube/solarcube_dataloader.py"
    click TimeFeatures "https://github.com/Ruohan-Li/SolarCube/blob/master/solarcube/timefeatures.py"
    click ConvLSTM "https://github.com/Ruohan-Li/SolarCube/blob/master/model/Convlstm/model.py"
    click CuboidTF "https://github.com/Ruohan-Li/SolarCube/blob/master/model/cuboid_transformer/earthformer/cuboid_transformer/cuboid_transformer.py"
    click InformerTF "https://github.com/Ruohan-Li/SolarCube/blob/master/model/informer_transformer/models/model.py"
    click LSTM "https://github.com/Ruohan-Li/SolarCube/blob/master/model/lstm/solarcube_lstm.py"
    click Metrics "https://github.com/Ruohan-Li/SolarCube/tree/master/model/cuboid_transformer/earthformer/metrics/"
    click ConvConfig "https://github.com/Ruohan-Li/SolarCube/blob/master/model/Convlstm/cfg_solarcube_cl.yaml"
    click CuboidConfig "https://github.com/Ruohan-Li/SolarCube/blob/master/model/cuboid_transformer/cfg_solarcube_tf_axial.yaml"
    click InformerConfig "https://github.com/Ruohan-Li/SolarCube/blob/master/model/informer_transformer/cfg_solarcube_if_data.yaml"
    click LSTMConfig "https://github.com/Ruohan-Li/SolarCube/blob/master/model/lstm/cfg_solarcube_pt_data.yaml"
    click CheckPoint "https://github.com/Ruohan-Li/SolarCube/blob/master/model/cuboid_transformer/earthformer/utils/checkpoint.py"
    click Utils "https://github.com/Ruohan-Li/SolarCube/blob/master/solarcube/utils.py"
```
