SkillAgentSearch skills...

StatisticalClearSky

Statistical estimation of a clear sky signal from PV system power data

Install / Use

/learn @slacgismo/StatisticalClearSky
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

StatisticalClearSky

<table> <tr> <td>Latest Release</td> <td> <a href="https://pypi.org/project/statistical-clear-sky/"> <img src="https://img.shields.io/pypi/v/statistical-clear-sky.svg" alt="latest release" /> </a> <a href="https://anaconda.org/slacgismo/statistical-clear-sky"> <img src="https://anaconda.org/slacgismo/statistical-clear-sky/badges/version.svg" /> </a> <a href="https://anaconda.org/slacgismo/statistical-clear-sky"> <img src="https://anaconda.org/slacgismo/statistical-clear-sky/badges/latest_release_date.svg" /> </a> </tr> <tr> <td>License</td> <td> <a href="https://github.com/slacgismo/statisticalclearsky/blob/master/LICENSE"> <img src="https://img.shields.io/pypi/l/statistical-clear-sky.svg" alt="license" /> </a> </td> </tr> <tr> <td>Build Status</td> <td> <a href="https://statistical-clea-rsky.readthedocs.io/en/stable/"> <img src="https://readthedocs.org/projects/statistical-clear-sky/badge/?version=stable" alt="documentation build status" /> </a> <a href="https://github.com/slacgismo/StatisticalClearSky/actions/workflows/test.yml"> <img src="https://github.com/slacgismo/StatisticalClearSky/actions/workflows/test.yml/badge.svg?branch=master" alt="Actions build status" /> </a> <!-- move to gismo account --> <a href="https://travis-ci.com/tadatoshi/StatisticalClearSky.svg?branch=development"> <img src="https://travis-ci.com/tadatoshi/StatisticalClearSky.svg?branch=development"> </a> </td> </tr> <tr> <td>Code Quality</td> <td> <a href="https://lgtm.com/projects/g/slacgismo/StatisticalClearSky/context:python"> <img alt="Language grade: Python" src="https://img.shields.io/lgtm/grade/python/g/slacgismo/StatisticalClearSky.svg?logo=lgtm&logoWidth=18"/> </a> <a href="https://lgtm.com/projects/g/slacgismo/StatisticalClearSky/alerts/"> <img alt="Total alerts" src="https://img.shields.io/lgtm/alerts/g/slacgismo/StatisticalClearSky.svg?logo=lgtm&logoWidth=18"/> </a> </td> </tr> <tr> <td>Publications</td> <td> <a href="https://zenodo.org/badge/latestdoi/117483201"> <img src="https://zenodo.org/badge/117483201.svg" alt="DOI"> </a> </td> </tr> <tr> <td>PyPI Downloads</td> <td> <a href="https://pepy.tech/project/statistical-clear-sky"> <img src="https://static.pepy.tech/badge/statistical-clear-sky" alt="PyPI downloads" /> </a> </td> </tr> <tr> <td>Conda Downloads</td> <td> <a href="https://anaconda.org/slacgismo/statistical-clear-sky"> <img src="https://anaconda.org/slacgismo/statistical-clear-sky/badges/downloads.svg" alt="conda-forge downloads" /> </a> </td> </tr> <tr> <td>Test-Coverage</td> <td> <img src="https://img.shields.io/badge/test--coverage-39%25-yellowgreen" alt="test-coverage" /> </td> </tr> </table>

Statistical estimation of a clear sky signal from PV system power data

This project implements an algorithm based on Generalized Low Rank Models for estimating the output of a solar PV system under clear sky or "cloudless" conditions, given only measured power as an input. Noteably, no system configuration information, modeling parameters, or correlated environmental data are required. You can read more about this work in these two papers [1, 2].

We actually recommend that users generally not invoke this software directly. Instead, we recommend using the API provided by Solar Data Tools.

Getting Started

You can install pip package or Anaconda package for this project.

Recommended: Set up conda environment with provided .yml file

Updated September 2020

We recommend seting up a fresh Python virutal environment in which to use solar-data-tools. We recommend using the Conda package management system, and creating an environment with the environment configuration file named pvi-user.yml, provided in the top level of this repository. This will install the solar-data-tools package as well.

Please see the Conda documentation page, "Creating an environment from an environment.yml file" for more information.

Installation

If you are using pip:

$ pip install statistical-clear-sky

As of February 11, 2019, it fails because scs package installed as a dependency of cxvpy expects numpy to be already installed. scs issue 85 says, it is fixed. However, it doesn't seem to be reflected in its pip package. Also, cvxpy doesn't work with numpy version less than 1.16. As a work around, install numpy separatly first and then install this package. i.e.

$ pip install 'numpy>=1.16'
$ pip install statistical-clear-sky

If you are using Anaconda, the problem described above doesn't occur since numpy is already installed. And during statistical-clear-sky installation, numpy is upgraded above 1.16:

$ conda install -c slacgismo statistical-clear-sky

Solvers

The default convex solver included with cvxpy is ECOS, which is open source. However this solver tends to fail on problems with >1000 variables, as it does not work for this algorithm.

So, the default behavior of the code is to use the commercial Mosek solver. Thus, we encourage you to install it separately as below and obtain the license on your own.

  • mosek - For using MOSEK solver.

    If you are using pip:

    $ pip install -f https://download.mosek.com/stable/wheel/index.html Mosek
    

    If you are using Anaconda:

    $ conda install -c mosek mosek==8.1.43
    

Academic licenses are available for free here: https://www.mosek.com/products/academic-licenses/

Usage

As a part of Python code or inside Jupyter notebook

Example 1: Simplest example with the fewest number of input parameters.

Using default solver (Open Source solver: ECOS)

import numpy as np
from statistical_clear_sky.algorithm.iterative_fitting import IterativeFitting

# Usually read from a CSV file or a database with more data,
# covering 1 day (column) and a few years (row):
power_signals_d = np.array([[0.0, 0.0, 0.0, 0.0],
                            [1.33389997, 1.40310001, 0.67150003, 0.77249998],
                            [1.42349994, 1.51800001, 1.43809998, 1.20449996],
                            [1.52020001, 1.45150006, 1.84809995, 0.99949998]])

iterative_fitting = IterativeFitting(power_signals_d)

iterative_fitting.execute()

clear_sky_signals = iterative_fitting.clear_sky_signals()
degradation_rate = iterative_fitting.degradation_rate()

Example 2: Estimating clear sky signals without degradation.

You can estimate clear sky signals based on the assumption that there is no year-to-year degradation. In this case, you can set is_degradation_calculated keyword argument to False in execute method. By default, it's set to True.

import numpy as np
from statistical_clear_sky.algorithm.iterative_fitting import IterativeFitting

# Usually read from a CSV file or a database with more data,
# covering 1 day (column) and a few years (row):
power_signals_d = np.array([[0.0, 0.0, 0.0, 0.0],
                            [1.33389997, 1.40310001, 0.67150003, 0.77249998],
                            [1.42349994, 1.51800001, 1.43809998, 1.20449996],
                            [1.52020001, 1.45150006, 1.84809995, 0.99949998]])

iterative_fitting = IterativeFitting(power_signals_d)

iterative_fitting.execute(is_degradation_calculated=False)

clear_sky_signals = iterative_fitting.clear_sky_signals()

Example 3: Using a different solver.

The default solver ECOS is not stable with large set of input data. The following example shows how to specify to use Mosek solver by passing solver_type keyword argument (to the constructor).

import numpy as np
from statistical_clear_sky.algorithm.iterative_fitting import IterativeFitting

# Usually read from a CSV file or a database with more data,
# covering 1 day (column) and a few years (row):
power_signals_d = np.array([[0.0, 0.0, 0.0, 0.0],
                            [1.33389997, 1.40310001, 0.67150003, 0.77249998],
                            [1.42349994, 1.51800001, 1.43809998, 1.20449996],
                            [1.52020001, 1.45150006, 1.84809995, 0.99949998]])

iterative_fitting = IterativeFitting(power_signals_d,
                                     solver_type='MOSEK')

iterative_fitting.execute()

clear_sky_signals = iterative_fitting.clear_sky_signals()
degradation_rate = iterative_fitting.degradation_rate()

Example 4: Setting rank for Generalized Low Rank Modeling.

By default, rank of low rank matrices is specified to be 6. You can change it by specifying rank_k keyword argument (in the constructor).

import numpy as np
from statistical_clear_sky.algorithm.iterative_fitting import IterativeFitting

# Usually read from a CSV file or a database with more data,
# covering 1 day (column) and a few years (row):
power_signals_d = np.array([[0.0, 0.0, 0.0, 0.0],
                            [1.33389997, 1.40310001, 0.67150003, 0.77249998],
                            [1.42349994, 1.51800001, 1.43809998, 1.20449996],
                            [1.52020001, 1.45150006, 1.84809995, 0.99949998]])

iterative_fitting = IterativeFitting(power_signals_d, rank_k=6)

iterative_fitting.execute()

# Get the resulting left 

Related Skills

View on GitHub
GitHub Stars31
CategoryDevelopment
Updated11mo ago
Forks8

Languages

Jupyter Notebook

Security Score

82/100

Audited on May 7, 2025

No findings