Skip to content

PUTvision/solar-irradiance

Repository files navigation

A systematic synthesis of sky image enhancement techniques for ground-based solar irradiance forecasting

DOI

A systematic synthesis of sky image enhancement techniques for ground-based solar irradiance forecasting.

Table of Contents

Overview

Requirements

pip install -e .[dev]

Sky image enhancement methods

1. Sun mask

2. Irradiance channel (with Sun mask)

3. Optical flow

Optical flow data generated using DIS method, with ultrafast preset, to enhance the input image at time t as additional channels. (a) history image (at time t − 15); (b) optical flow in the X-axis generated between an input image and previous images (at t − 15, t − 10, t − 5); (c) optical flow in the Y-axis generated between an input image and previous images (at t − 15, t − 10, t − 5); (d) input image (at time t). Red and blue colours represent the direction of pixel displacement, respectively positive and negative, between the initial and the final frame in the x and y directions. Colour saturation stands for shift magnitude.

4. Cloud channel

Visualization of utilized cloud channel methods. For illustration purposes, the output masks were thresholded with hand-picked values to produce binary masks. (a) input image; (b) red-blue ratio (R2B); (c) red-blue difference (R-B); (d) normalized blue-red ratio (Norm. B/R).

Dataset

The dataset used in this study is based on the Folsom dataset. To make the data preparation and follow-up steps easier to reproduce, these steps were described as a directed acyclic graph (DAG) using the DVC package. This pipeline is stored in a dvc.yaml file, while data are stored in the data directory.

For study reproducibility, Zenodo repository with data splits and pretrained models was created and is available at https://zenodo.org/record/15792283.

1. DVC DAG (Directed Acyclic Graph)
dvc dag
                                         +----------+
                                        *| get_data |**
                                   ***** +----------+  ******
                             ******                          *****
                        *****                                     *****
                     ***                                               ******
     +--------------------+                                                  ***
     | convert_timestamps |*****                                               *
     +--------------------+     ***********                                    *
       ***             ***                 ***********                         *
    ***                   ***                         ***********              *
  **                         **                                  ******        *
**                             **                                    +-----------------+
*                               *                                    | clean_dataframe |
*                               *                                    +-----------------+
*                               *                                     ***            ***
*                               *                                   **                  ***
*                               *                                 **                       **
***                             ***                   +----------------+                    ***
   *****                           *****              | export_periods |               *****
        *****                           ******    ****+----------------+          *****
             *****                           ******            *             *****
                  *****                ******      *****        *       *****
                       ***          ***                 ***     *    ***
                   +---------------------+            +------------------+
                   | export_eval_periods |            | train_forecaster |
                   +---------------------+            +------------------+
2. Data structure
data/
├── raw
├── prepared
└── eval
  • raw - raw irradiance CSV and sky images extracted directly from files downloaded from Folsom Zenodo page
  • prepared - processed data (filtered, timestamp moved to local timezone, corrupted images removed, and grouped into periods)
  • eval - small subset extracted for evaluation purposes

Usage

  1. Train
python -m scripts.train_forecaster --data-root data/prepared --periods-filename periods.pickle
  1. Test

Change test_only: True and provide path to checkpoint restore_from_ckpt: path/to/checkpoint. Then call train script.

  1. Evaluate

Firstly export PyTorch checkpoint to ONNX format, for example using test procedure with export_to_onnx: True.

python -m scripts.evaluate \
     --model-path /path/to/model \
     --dataset-path data/eval/images \
     --eval-periods-path data/eval/eval_periods.pickle \
     --provider cpu \
     --add-sun-mask \
     --add-irradiance-channel \
     --cloud-mask-method normalized_blue_red_ratio \
     --optical-flow dis

Results

Image encoder comparison

Qualitative comparison

About

Forecasting of solar irradiance in a short time horizon, based on sky images from fish-eye camera.

Resources

License

Stars

Watchers

Forks

Contributors