# leigueed/deteccao-nuvens architecture

> Architecture diagram of the GitHub repository leigueed/deteccao-nuvens, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/leigueed/deteccao-nuvens
- Repository: https://github.com/leigueed/deteccao-nuvens

## Overview

The repository is a Python workflow for estimating cloud cover in AMAZÔNIA-1 scenes with the CSD-SI spectral-index detector. Its principal workflow reads four WFI bands, derives scene-specific CI2 thresholds, tests configurations against INPE catalog cloud-cover values, and ranks the results. A separate CMASK workflow generates a prediction mask and evaluates it pixel by pixel. The graph follows documented and excerpted calls; the two workflows are independent entry points.

Main entry points: [`analise/cobertura.py`](https://github.com/leigueed/deteccao-nuvens/blob/main/analise/cobertura.py) (Coverage calibration), [`analise/validacao_cmask.py`](https://github.com/leigueed/deteccao-nuvens/blob/main/analise/validacao_cmask.py) (Validation workflow), [`main.py`](https://github.com/leigueed/deteccao-nuvens/blob/main/main.py) (Analysis entry), [`csdsi/detector.py`](https://github.com/leigueed/deteccao-nuvens/blob/main/csdsi/detector.py) (CI2 statistics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Analysis workflows"]
  node_main["Analysis entry<br/>[main.py]"]
  node_config["Scene parameters<br/>[config.py]"]
  node_calibration["Coverage calibration<br/>[cobertura.py]"]
  node_ranking["Coefficient ranking<br/>[cobertura.py]"]
end

subgraph group_detector["CSD-SI detector"]
  node_band_lookup["Band lookup<br/>[arquivos.py]"]
  node_ci_indices["CI indices<br/>[indices.py]"]
  node_statistics["CI2 statistics<br/>[detector.py]"]
  node_threshold["T2 threshold<br/>[detector.py]"]
  node_cloud_mask["Cloud classification<br/>[detector.py]"]
  node_coverage["Scene coverage<br/>[detector.py]"]
end

subgraph group_validation["CMASK validation"]
  node_validation_entry["Validation workflow<br/>[validacao_cmask.py]"]
  node_mask_generation["Mask generation<br/>[validacao_cmask.py]"]
  node_mask_comparison["Spatial comparison<br/>[validacao_cmask.py]"]
  node_validation_metrics["Validation metrics<br/>[validacao_cmask.py]"]
end

subgraph group_inputs["Scene inputs"]
  node_scene_bands[("WFI scene bands")]
  node_catalog_values["Catalog cloud cover<br/>[config.py]"]
  node_cmask_data[("CMASK reference")]
  node_mask_output["CSD-SI mask"]
end

node_user(("Analyst"))

node_user -->|"runs analysis"| node_main
node_user -->|"runs validation"| node_validation_entry
node_main -->|"reads parameters"| node_config
node_main -->|"analyzes scenes"| node_calibration
node_calibration -->|"returns results"| node_ranking
node_main -->|"selects scene folders"| node_scene_bands
node_calibration -->|"compares coverage"| node_catalog_values
node_calibration -->|"gets CI2 statistics"| node_statistics
node_calibration -->|"tests coefficients"| node_threshold
node_calibration -->|"calculates coverage"| node_coverage
node_statistics -->|"locates bands"| node_band_lookup
node_coverage -->|"locates bands"| node_band_lookup
node_statistics -->|"calculates CI2"| node_ci_indices
node_coverage -->|"classifies pixels"| node_cloud_mask
node_cloud_mask -->|"calculates indices"| node_ci_indices
node_band_lookup -->|"finds band files"| node_scene_bands
node_validation_entry -->|"reads scene path"| node_config
node_validation_entry -->|"derives threshold"| node_statistics
node_validation_entry -->|"generates prediction"| node_mask_generation
node_validation_entry -->|"compares masks"| node_mask_comparison
node_mask_generation -->|"locates bands"| node_band_lookup
node_mask_generation -->|"classifies blocks"| node_cloud_mask
node_mask_generation -->|"writes mask"| node_mask_output
node_mask_comparison -->|"reads prediction"| node_mask_output
node_mask_comparison -->|"reads reference"| node_cmask_data
node_mask_comparison -->|"computes metrics"| node_validation_metrics

click node_main "https://github.com/leigueed/deteccao-nuvens/blob/main/main.py"
click node_config "https://github.com/leigueed/deteccao-nuvens/blob/main/config.py"
click node_calibration "https://github.com/leigueed/deteccao-nuvens/blob/main/analise/cobertura.py"
click node_ranking "https://github.com/leigueed/deteccao-nuvens/blob/main/analise/cobertura.py"
click node_band_lookup "https://github.com/leigueed/deteccao-nuvens/blob/main/csdsi/arquivos.py"
click node_ci_indices "https://github.com/leigueed/deteccao-nuvens/blob/main/csdsi/indices.py"
click node_statistics "https://github.com/leigueed/deteccao-nuvens/blob/main/csdsi/detector.py"
click node_threshold "https://github.com/leigueed/deteccao-nuvens/blob/main/csdsi/detector.py"
click node_cloud_mask "https://github.com/leigueed/deteccao-nuvens/blob/main/csdsi/detector.py"
click node_coverage "https://github.com/leigueed/deteccao-nuvens/blob/main/csdsi/detector.py"
click node_validation_entry "https://github.com/leigueed/deteccao-nuvens/blob/main/analise/validacao_cmask.py"
click node_mask_generation "https://github.com/leigueed/deteccao-nuvens/blob/main/analise/validacao_cmask.py"
click node_mask_comparison "https://github.com/leigueed/deteccao-nuvens/blob/main/analise/validacao_cmask.py"
click node_validation_metrics "https://github.com/leigueed/deteccao-nuvens/blob/main/analise/validacao_cmask.py"
click node_scene_bands "https://github.com/leigueed/deteccao-nuvens/tree/main/cenas_amazonia1"
click node_catalog_values "https://github.com/leigueed/deteccao-nuvens/blob/main/config.py"
click node_cmask_data "https://github.com/leigueed/deteccao-nuvens/tree/main/cenas_amazonia1"
click node_mask_output "https://github.com/leigueed/deteccao-nuvens/tree/main/cenas_amazonia1"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_config,node_calibration,node_ranking toneBlue
class node_band_lookup,node_ci_indices,node_statistics,node_threshold,node_cloud_mask,node_coverage toneAmber
class node_validation_entry,node_mask_generation,node_mask_comparison,node_validation_metrics toneMint
class node_scene_bands,node_catalog_values,node_cmask_data,node_mask_output toneRose
class node_user toneIndigo
```

## Components

### Analysis workflows

- [Analysis entry](https://github.com/leigueed/deteccao-nuvens/blob/main/main.py): `main.py`
- [Scene parameters](https://github.com/leigueed/deteccao-nuvens/blob/main/config.py): `config.py`
- [Coverage calibration](https://github.com/leigueed/deteccao-nuvens/blob/main/analise/cobertura.py): `analise/cobertura.py`
- [Coefficient ranking](https://github.com/leigueed/deteccao-nuvens/blob/main/analise/cobertura.py): `analise/cobertura.py`

### CSD-SI detector

- [Band lookup](https://github.com/leigueed/deteccao-nuvens/blob/main/csdsi/arquivos.py): `csdsi/arquivos.py`
- [CI indices](https://github.com/leigueed/deteccao-nuvens/blob/main/csdsi/indices.py): `csdsi/indices.py`
- [CI2 statistics](https://github.com/leigueed/deteccao-nuvens/blob/main/csdsi/detector.py): `csdsi/detector.py`
- [T2 threshold](https://github.com/leigueed/deteccao-nuvens/blob/main/csdsi/detector.py): `csdsi/detector.py`
- [Cloud classification](https://github.com/leigueed/deteccao-nuvens/blob/main/csdsi/detector.py): `csdsi/detector.py`
- [Scene coverage](https://github.com/leigueed/deteccao-nuvens/blob/main/csdsi/detector.py): `csdsi/detector.py`

### CMASK validation

- [Validation workflow](https://github.com/leigueed/deteccao-nuvens/blob/main/analise/validacao_cmask.py): `analise/validacao_cmask.py`
- [Mask generation](https://github.com/leigueed/deteccao-nuvens/blob/main/analise/validacao_cmask.py): `analise/validacao_cmask.py`
- [Spatial comparison](https://github.com/leigueed/deteccao-nuvens/blob/main/analise/validacao_cmask.py): `analise/validacao_cmask.py`
- [Validation metrics](https://github.com/leigueed/deteccao-nuvens/blob/main/analise/validacao_cmask.py): `analise/validacao_cmask.py`

### Scene inputs

- [WFI scene bands](https://github.com/leigueed/deteccao-nuvens/tree/main/cenas_amazonia1): `cenas_amazonia1`
- [Catalog cloud cover](https://github.com/leigueed/deteccao-nuvens/blob/main/config.py): `config.py`
- [CMASK reference](https://github.com/leigueed/deteccao-nuvens/tree/main/cenas_amazonia1): `cenas_amazonia1`
- [CSD-SI mask](https://github.com/leigueed/deteccao-nuvens/tree/main/cenas_amazonia1): `cenas_amazonia1`

### Other components

- **Analyst**

## Connections

- Analyst → Analysis entry: runs analysis (evidence: `README.md`)
- Analyst → Validation workflow: runs validation (evidence: `README.md`)
- Analysis entry → Scene parameters: reads parameters (evidence: `main.py`)
- Analysis entry → Coverage calibration: analyzes scenes (evidence: `main.py`)
- Coverage calibration → Coefficient ranking: returns results (evidence: `analise/cobertura.py`)
- Analysis entry → WFI scene bands: selects scene folders (evidence: `main.py`)
- Coverage calibration → Catalog cloud cover: compares coverage (evidence: `analise/cobertura.py`)
- Coverage calibration → CI2 statistics: gets CI2 statistics (evidence: `analise/cobertura.py`)
- Coverage calibration → T2 threshold: tests coefficients (evidence: `analise/cobertura.py`)
- Coverage calibration → Scene coverage: calculates coverage (evidence: `analise/cobertura.py`)
- CI2 statistics → Band lookup: locates bands (evidence: `csdsi/detector.py`)
- Scene coverage → Band lookup: locates bands (evidence: `csdsi/detector.py`)
- CI2 statistics → CI indices: calculates CI2 (evidence: `csdsi/detector.py`)
- Scene coverage → Cloud classification: classifies pixels (evidence: `csdsi/detector.py`)
- Cloud classification → CI indices: calculates indices (evidence: `csdsi/detector.py`)
- Band lookup → WFI scene bands: finds band files (evidence: `README.md`)
- Validation workflow → Scene parameters: reads scene path (evidence: `analise/validacao_cmask.py`)
- Validation workflow → CI2 statistics: derives threshold (evidence: `analise/validacao_cmask.py`)
- Validation workflow → Mask generation: generates prediction (evidence: `analise/validacao_cmask.py`)
- Validation workflow → Spatial comparison: compares masks (evidence: `analise/validacao_cmask.py`)
- Mask generation → Band lookup: locates bands (evidence: `analise/validacao_cmask.py`)
- Mask generation → Cloud classification: classifies blocks (evidence: `analise/validacao_cmask.py`)
- Mask generation → CSD-SI mask: writes mask (evidence: `analise/validacao_cmask.py`)
- Spatial comparison → CSD-SI mask: reads prediction (evidence: `analise/validacao_cmask.py`)
- Spatial comparison → CMASK reference: reads reference (evidence: `analise/validacao_cmask.py`)
- Spatial comparison → Validation metrics: computes metrics (evidence: `analise/validacao_cmask.py`)
