# laura-guillory/droughtmonitor architecture

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

- Interactive diagram: https://gitdiagram.com/laura-guillory/droughtmonitor
- Repository: https://github.com/laura-guillory/droughtmonitor

## Overview

##### Project type and purpose
- This is a Python-based data-processing pipeline (an open-source scientific tool) for generating the Australian Combined Drought Indicator (CDI).
- It automates four main phases: data ingestion (download), data preparation (pre-processing), indicator calculation (percentile ranking, SPI-3 via external tool, CDI), and visualization (map generation).

##### File structure
- Top-level:
- requirements.txt – Python dependencies
- scripts/ – entry-point scripts (download.py, prep_files.py, calculate_cdi.py, percentile_rank.py, generate_maps.py)
- utils/ – reusable modules (netCDF I/O, logging, array transformations)
- No “frontend” or web server—this is a batch ETL pipeline.
- No database directory—data persists as files (raw and netCDF).
- No container/orchestration manifests—scripts are run manually or via HPC scheduling.

##### README for additional insights
- Confirms four input indices (rainfall, ET, NDVI, soil moisture).
- Describes an external dependency: “standard Climate Indices package” for SPI-3.
- Specifies output artifacts: cdi.nc and PNG maps.
- Mentions large data volumes, optional multiprocessing or HPC use.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Data Sources
    subgraph "External Data Sources"
        SILO["SILO Rainfall & ET"]:::external
        Copernicus["Copernicus NDVI"]:::external
        BOM["BOM Soil Moisture"]:::external
    end

    %% Storage Layers
    subgraph "Local Storage"
        RAW["data/raw/{dataset}"]:::storage
        PROCESSED["data/processed"]:::storage
        MAPDIR["maps/"]:::storage
    end

    %% Pipeline Stages
    DL["download.py"]:::stage
    PP["prep_files.py"]:::stage
    PR["percentile_rank.py"]:::stage
    SPI["SPI-3 (Climate Indices CLI)"]:::external_service
    CDI["calculate_cdi.py"]:::stage
    GM["generate_maps.py"]:::stage

    %% Utilities
    subgraph "Utilities"
        LOG["logger_writer.py"]:::utils
        IO["save_to_netcdf.py"]:::utils
        TRANS["transpose.py"]:::utils
        TRUNC["truncate_time_dim.py"]:::utils
        OTHER["other.py"]:::utils
    end

    %% Documentation
    REQ["requirements.txt"]:::doc
    READ["README.md"]:::doc

    %% Data Flow
    SILO --> DL
    Copernicus --> DL
    BOM --> DL
    DL -->|"raw files"| RAW
    RAW --> PP
    PP -->|"processed .nc"| PROCESSED
    PROCESSED --> PR
    PR -->|"percentile .nc"| PROCESSED
    PROCESSED --> SPI
    SPI -->|"SPI-3 .nc"| PROCESSED
    PROCESSED --> CDI
    CDI -->|"cdi.nc"| PROCESSED
    PROCESSED --> GM
    GM -->|"PNG maps"| MAPDIR

    %% Utilities Calls
    LOG -.-> DL
    LOG -.-> PP
    LOG -.-> PR
    LOG -.-> CDI
    LOG -.-> GM
    IO -.-> DL
    IO -.-> PP
    IO -.-> PR
    IO -.-> CDI
    TRANS -.-> PP
    TRUNC -.-> PP
    OTHER -.-> DL
    OTHER -.-> PP
    OTHER -.-> PR
    OTHER -.-> CDI

    %% Documentation references
    REQ -.-> DL
    REQ -.-> PP
    REQ -.-> PR
    REQ -.-> CDI
    REQ -.-> GM
    READ -.-> DL
    READ -.-> PP
    READ -.-> PR
    READ -.-> CDI
    READ -.-> GM

    %% Click Events
    click DL "https://github.com/laura-guillory/droughtmonitor/blob/main/scripts/download.py"
    click PP "https://github.com/laura-guillory/droughtmonitor/blob/main/scripts/prep_files.py"
    click PR "https://github.com/laura-guillory/droughtmonitor/blob/main/scripts/percentile_rank.py"
    click CDI "https://github.com/laura-guillory/droughtmonitor/blob/main/scripts/calculate_cdi.py"
    click GM "https://github.com/laura-guillory/droughtmonitor/blob/main/scripts/generate_maps.py"
    click LOG "https://github.com/laura-guillory/droughtmonitor/blob/main/utils/logger_writer.py"
    click IO "https://github.com/laura-guillory/droughtmonitor/blob/main/utils/save_to_netcdf.py"
    click TRANS "https://github.com/laura-guillory/droughtmonitor/blob/main/utils/transpose.py"
    click TRUNC "https://github.com/laura-guillory/droughtmonitor/blob/main/utils/truncate_time_dim.py"
    click OTHER "https://github.com/laura-guillory/droughtmonitor/blob/main/utils/other.py"
    click REQ "https://github.com/laura-guillory/droughtmonitor/blob/main/requirements.txt"
    click READ "https://github.com/laura-guillory/droughtmonitor/blob/main/README.md"

    %% Styles
    classDef external fill:#aaddff,stroke:#000,stroke-width:1px
    classDef stage fill:#bbffbb,stroke:#000,stroke-width:1px
    classDef storage fill:#dddddd,stroke:#000,stroke-width:1px,stroke-dasharray: 4 2
    classDef utils fill:#ffcc99,stroke:#000,stroke-width:1px
    classDef external_service fill:#e0b3ff,stroke:#000,stroke-width:1px
    classDef output fill:#ffff99,stroke:#000,stroke-width:1px
    classDef doc fill:#f2f2f2,stroke:#000,stroke-width:1px,stroke-dasharray: 2 2
```
