Home

Awesome

<img src="/img/logo.svg" alt="drawing" width="450"/>

Build Status codecov.io license Binder

DescriptionPython Solar Radiation model
Authoraqreed aqreed@protonmail.com
Version0.1.3
Python Version3.6
RequiresNumpy, Matplotlib

This packages aims to provide a reliable solar radiation model, mainly based on the work of Duffie, J.A., and Beckman, W. A., 1974, "Solar energy thermal processes".

The main purpose is to generate a solar beam irradiance (W/m2) prediction on:

Example 1

Solar irradiance on the southern hemisphere on October 17, at sea-level 13.01UTC (plane pointing upwards)?

import numpy as np
from solarpy import irradiance_on_plane
from datetime import datetime

vnorm = np.array([0, 0, -1])  # plane pointing zenith
h = 0  # sea-level
date = datetime(2019, 10, 17, 13, 1)  # year, month, day, hour, minute
lat = -23.5  # southern hemisphere

irradiance_on_plane(vnorm, h, date, lat)

A dedicated Jupyter Notebook on beam irradiance can be found here.

Example 2

Power output (in W) of a solar panel with the following characteristics:

from numpy import array
from solarpy import solar_panel
from datetime import datetime

panel = solar_panel(2.1, 0.2, id_name='NYC_xmas')  # surface, efficiency and name
panel.set_orientation(array([0, 0, -1]))  # upwards
panel.set_position(40.73, -73.93, 0)  # NYC latitude, longitude, altitude
panel.set_datetime(datetime(2019, 12, 25, 16, 15))  # Christmas Day!
panel.power()

Example 3

Solar declination on August 5?

from solarpy import declination
from datetime import datetime

date = datetime(2019, 8, 5)  # August 5

declination(date)

Please find more notebooks on the 'examples' folder that you can open locally, or just try Binder to launch online interactive Jupyter notebooks.


NOTE: solarpy is under development and might change in the near future.


Dependencies

This package depends on Python, NumPy and Matplotlib and is usually tested on Linux with the following versions:

Python 3.6, NumPy 1.16, Matplotlib 3.0

Installation

solarpy has been written in Python3, and its version v0.1 is available in PyPi. It can be installed using:

$ pip install solarpy

To install in development mode:

$ git clone https://github.com/aqreed/solarpy.git
$ cd solarpy
$ pip install -e .

Testing

solarpy recommends py.test for running the test suite. Running from the top directory:

$ pytest

To test coverage (also from the top directory):

$ pytest --cov

Bug reporting

Please feel free to open an issue on GitHub!

License

MIT (see COPYING)