Skip to content

Commit 0e600b2

Browse files
committed
Example draft
1 parent c7799d2 commit 0e600b2

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"""
2+
Modeling N. Martin and J. Ruiz Spectral Modifiers
3+
=================================================
4+
5+
Mimic Figures 4, 5 & 6 from paper [1]_.
6+
Note raw data is unavailable, so we are only plotting the line given from the
7+
model.
8+
9+
References
10+
----------
11+
.. [1] Martín, N. and Ruiz, J.M. (1999), A new method for the spectral
12+
characterisation of PV modules. Prog. Photovolt: Res. Appl., 7: 299-310.
13+
:doi:10.1002/(SICI)1099-159X(199907/08)7:4<299::AID-PIP260>3.0.CO;2-0
14+
"""
15+
16+
from pvlib.spectrum.mismatch import martin_ruiz_spectral_modifier
17+
from pvlib.location import Location
18+
from pvlib.iotools import get_pvgis_tmy
19+
from pvlib.irradiance import get_extra_radiation, clearness_index
20+
from datetime import datetime, timedelta
21+
import numpy as np
22+
import pandas as pd
23+
import matplotlib.pyplot as plt
24+
25+
# clearness_index = np.linspace(0.56, 0.82, 10)
26+
27+
site = Location(40.4534, -3.7270, altitude=664, name='IES-UPM, Madrid')
28+
29+
time = pd.date_range(start=datetime(2020, 1, 1), end=datetime(2020, 12, 31),
30+
freq=timedelta(hours=1))
31+
32+
tmy_data, _, _, _ = get_pvgis_tmy(site.latitude, site.longitude,
33+
map_variables=True)
34+
tmy_data = tmy_data.shift(freq=timedelta(minutes=-30))
35+
36+
solar_pos = site.get_solarposition(tmy_data.index)
37+
38+
extra_rad = get_extra_radiation(tmy_data.index)
39+
40+
clearness = clearness_index(ghi=tmy_data['ghi'],
41+
solar_zenith=solar_pos['zenith'],
42+
extra_radiation=extra_rad)
43+
44+
print('clearness')
45+
print(clearness)
46+
clearness.plot()
47+
48+
plt.show()
49+
50+
print('pressure')
51+
pressure = site.get_airmass(model='kasten1966')
52+
print(pressure)

0 commit comments

Comments
 (0)