Modelling sun and sky irradiance#
This notebook explain how to use astk functions to simulate the natural lighting of a scenesky irradiance for diiferent conditions.
Conventions#
Radiation fluxes are expressed in terms of irradiance of a horizontal unit placed at earth surface(total energetic flux passing through a square meter of ground).
The standard measurement of radiation at earth surface is the global horizontal irradiance (ghi, W.m-2 i.e. J.m-2.s-1), that captures radiations coming from the sun and from the sky in the shortwave domain (visible light)
The sun contribution is called direct normal irradiance (dni), whereas sky contribution is called diffuse horizontal irradiance (dhi)
Imports and setup location#
[1]:
from openalea.astk.data_access import montpellier_spring_2013
from openalea.astk.sky_irradiance import sky_irradiance
Specify a location on earth:
[2]:
Montpellier ={
'longitude': 3.87,
'latitude': 43.61,
'altitude': 56,
'timezone': 'Europe/Paris'}
Simulating clear sky conditions#
[3]:
sky_irr = sky_irradiance(daydate='2000-06-21', **Montpellier)
sky_irr
[3]:
| azimuth | zenith | elevation | ghi | dni | dhi | ppfd | |
|---|---|---|---|---|---|---|---|
| 2000-06-21 07:00:00+02:00 | 65.222522 | 81.781574 | 8.218426 | 69.608228 | 133.668645 | 50.500666 | 167.643135 |
| 2000-06-21 08:00:00+02:00 | 74.723897 | 71.647009 | 18.352991 | 241.741681 | 432.873390 | 105.442654 | 528.836249 |
| 2000-06-21 09:00:00+02:00 | 84.230207 | 61.003100 | 28.996900 | 428.277428 | 708.490643 | 84.827871 | 897.324728 |
| 2000-06-21 10:00:00+02:00 | 94.525066 | 50.169169 | 39.830831 | 603.268306 | 781.227518 | 102.874099 | 1233.792552 |
| 2000-06-21 11:00:00+02:00 | 106.936113 | 39.517644 | 50.482356 | 751.612236 | 811.181337 | 125.843702 | 1515.360865 |
| 2000-06-21 12:00:00+02:00 | 124.101947 | 29.712676 | 60.287324 | 862.071318 | 805.824816 | 162.194835 | 1723.771894 |
| 2000-06-21 13:00:00+02:00 | 150.974668 | 22.305842 | 67.694158 | 926.637555 | 815.663749 | 172.009087 | 1845.290578 |
| 2000-06-21 14:00:00+02:00 | 189.036867 | 20.362593 | 69.637407 | 940.709766 | 813.385068 | 178.153651 | 1871.754717 |
| 2000-06-21 15:00:00+02:00 | 222.847350 | 25.217800 | 64.782200 | 903.290967 | 801.009537 | 178.621855 | 1801.370007 |
| 2000-06-21 16:00:00+02:00 | 244.565120 | 34.007293 | 55.992707 | 817.036014 | 809.396716 | 146.073338 | 1638.894191 |
| 2000-06-21 17:00:00+02:00 | 259.103202 | 44.316289 | 45.683711 | 688.127892 | 792.097153 | 121.387018 | 1395.154930 |
| 2000-06-21 18:00:00+02:00 | 270.327385 | 55.107908 | 34.892092 | 526.051805 | 757.091487 | 92.970738 | 1086.065369 |
| 2000-06-21 19:00:00+02:00 | 280.142111 | 65.894619 | 24.105381 | 343.602529 | 611.132818 | 94.005988 | 731.774188 |
| 2000-06-21 20:00:00+02:00 | 289.566812 | 76.349471 | 13.650529 | 158.912224 | 318.904517 | 83.651016 | 359.130268 |
| 2000-06-21 21:00:00+02:00 | 299.258754 | 86.099097 | 3.900903 | 15.621544 | 0.000000 | 15.621544 | 41.965131 |
Simulating cloudy conditions#
[4]:
sky_irr = sky_irradiance(daydate='2000-06-21', attenuation=0.2,**Montpellier)
sky_irr
[4]:
| azimuth | zenith | elevation | ghi | dni | dhi | ppfd | |
|---|---|---|---|---|---|---|---|
| 2000-06-21 07:00:00+02:00 | 65.222522 | 81.781574 | 8.218426 | 13.921646 | 0.000000 | 13.921646 | 37.808178 |
| 2000-06-21 08:00:00+02:00 | 74.723897 | 71.647009 | 18.352991 | 48.348336 | 0.000000 | 48.348336 | 120.629656 |
| 2000-06-21 09:00:00+02:00 | 84.230207 | 61.003100 | 28.996900 | 85.655486 | 0.000000 | 85.655486 | 205.795668 |
| 2000-06-21 10:00:00+02:00 | 94.525066 | 50.169169 | 39.830831 | 120.653661 | 0.000000 | 120.653661 | 283.847764 |
| 2000-06-21 11:00:00+02:00 | 106.936113 | 39.517644 | 50.482356 | 150.322447 | 0.105614 | 150.240974 | 349.281690 |
| 2000-06-21 12:00:00+02:00 | 124.101947 | 29.712676 | 60.287324 | 172.414264 | 0.618064 | 171.877462 | 397.754979 |
| 2000-06-21 13:00:00+02:00 | 150.974668 | 22.305842 | 67.694158 | 185.327511 | 2.164173 | 183.325281 | 426.028282 |
| 2000-06-21 14:00:00+02:00 | 189.036867 | 20.362593 | 69.637407 | 188.141953 | 2.292383 | 185.992823 | 432.186277 |
| 2000-06-21 15:00:00+02:00 | 222.847350 | 25.217800 | 64.782200 | 180.658193 | 0.783678 | 179.949204 | 415.808807 |
| 2000-06-21 16:00:00+02:00 | 244.565120 | 34.007293 | 55.992707 | 163.407203 | 0.422203 | 163.057211 | 378.010644 |
| 2000-06-21 17:00:00+02:00 | 259.103202 | 44.316289 | 45.683711 | 137.625578 | 0.000000 | 137.625578 | 321.337452 |
| 2000-06-21 18:00:00+02:00 | 270.327385 | 55.107908 | 34.892092 | 105.210361 | 0.000000 | 105.210361 | 249.555017 |
| 2000-06-21 19:00:00+02:00 | 280.142111 | 65.894619 | 24.105381 | 68.720506 | 0.000000 | 68.720506 | 167.479703 |
| 2000-06-21 20:00:00+02:00 | 289.566812 | 76.349471 | 13.650529 | 31.782445 | 0.000000 | 31.782445 | 81.596061 |
| 2000-06-21 21:00:00+02:00 | 299.258754 | 86.099097 | 3.900903 | 3.124309 | 0.000000 | 3.124309 | 9.353447 |
Simulating actual irradiances#
In general, meteorological conditions are between overcast and clear sky conditions. The cursor between theses two extremes is a function of the ratio between actual irradiance (measured) and clear sky irradiance.
get some meteorological data
[5]:
meteo_db = montpellier_spring_2013()
[6]:
import pandas
when = pandas.date_range(start='2013-05-26', freq='h', periods=25,
tz='Europe/Paris')
observed = meteo_db.loc[when,'ghi']
observed
[6]:
2013-05-26 00:00:00+02:00 0.000000
2013-05-26 01:00:00+02:00 0.000000
2013-05-26 02:00:00+02:00 0.000000
2013-05-26 03:00:00+02:00 0.000000
2013-05-26 04:00:00+02:00 0.000000
2013-05-26 05:00:00+02:00 0.000000
2013-05-26 06:00:00+02:00 31.615385
2013-05-26 07:00:00+02:00 166.370370
2013-05-26 08:00:00+02:00 335.425926
2013-05-26 09:00:00+02:00 505.481481
2013-05-26 10:00:00+02:00 660.689655
2013-05-26 11:00:00+02:00 783.516667
2013-05-26 12:00:00+02:00 865.300000
2013-05-26 13:00:00+02:00 887.883333
2013-05-26 14:00:00+02:00 843.233333
2013-05-26 15:00:00+02:00 861.366667
2013-05-26 16:00:00+02:00 700.766667
2013-05-26 17:00:00+02:00 576.966667
2013-05-26 18:00:00+02:00 415.766667
2013-05-26 19:00:00+02:00 241.550000
2013-05-26 20:00:00+02:00 68.566667
2013-05-26 21:00:00+02:00 1.433333
2013-05-26 22:00:00+02:00 0.000000
2013-05-26 23:00:00+02:00 0.000000
2013-05-27 00:00:00+02:00 0.000000
Name: ghi, dtype: float64
[7]:
sky_irr = sky_irradiance(dates=observed.index, ghi=observed)
sky_irr
[7]:
| azimuth | zenith | elevation | ghi | dni | dhi | ppfd | |
|---|---|---|---|---|---|---|---|
| 2013-05-26 07:00:00+02:00 | 67.394678 | 82.902288 | 7.097712 | 166.370370 | 382.539320 | 119.103104 | 372.883646 |
| 2013-05-26 08:00:00+02:00 | 76.998278 | 72.595513 | 17.404487 | 335.425926 | 708.145583 | 123.608595 | 712.692855 |
| 2013-05-26 09:00:00+02:00 | 86.670875 | 61.831377 | 28.168623 | 505.481481 | 756.869728 | 148.187460 | 1043.076789 |
| 2013-05-26 10:00:00+02:00 | 97.240796 | 50.953097 | 39.046903 | 660.689655 | 850.791955 | 124.727856 | 1339.890179 |
| 2013-05-26 11:00:00+02:00 | 110.082221 | 40.367996 | 49.632004 | 783.516667 | 882.613527 | 111.053233 | 1573.703322 |
| 2013-05-26 12:00:00+02:00 | 127.790259 | 30.809505 | 59.190495 | 865.300000 | 820.208961 | 160.843080 | 1729.864628 |
| 2013-05-26 13:00:00+02:00 | 154.619856 | 23.898554 | 66.101446 | 887.883333 | 676.893420 | 269.023929 | 1775.511620 |
| 2013-05-26 14:00:00+02:00 | 190.458560 | 22.437564 | 67.562436 | 843.233333 | 578.462848 | 308.562438 | 1695.371933 |
| 2013-05-26 15:00:00+02:00 | 222.025552 | 27.340165 | 62.659835 | 861.366667 | 669.045851 | 267.056253 | 1725.259707 |
| 2013-05-26 16:00:00+02:00 | 243.129279 | 36.027976 | 53.972024 | 700.766667 | 530.630224 | 271.630139 | 1425.687318 |
| 2013-05-26 17:00:00+02:00 | 257.658296 | 46.287318 | 43.712682 | 576.966667 | 510.687303 | 224.060075 | 1188.519867 |
| 2013-05-26 18:00:00+02:00 | 268.996379 | 57.092156 | 32.907844 | 415.766667 | 402.926728 | 196.860848 | 876.394984 |
| 2013-05-26 19:00:00+02:00 | 278.938942 | 67.937211 | 22.062789 | 241.550000 | 248.774528 | 148.104704 | 530.208075 |
| 2013-05-26 20:00:00+02:00 | 288.494733 | 78.476514 | 11.523486 | 68.566667 | 6.658009 | 67.236599 | 165.803474 |
| 2013-05-26 21:00:00+02:00 | 298.338059 | 88.229752 | 1.770248 | 1.433333 | 0.000000 | 1.433333 | 4.500906 |
[ ]:
[ ]:
[ ]: