Skip to content

Commit 3e937ca

Browse files
committed
ineichen examples
1 parent 7fe316f commit 3e937ca

File tree

1 file changed

+63
-1
lines changed

1 file changed

+63
-1
lines changed

docs/sphinx/source/clearsky.rst

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,63 @@ the variability of the data set.
159159
Examples
160160
^^^^^^^^
161161

162+
A clear sky time series using basic pvlib functions.
163+
164+
.. ipython:: python
165+
166+
latitude, longitude, tz, altitude, name = 32.2, -111, 'US/Arizona', 700, 'Tucson'
167+
times = pd.date_range(start='2014-01-01', end='2014-01-02', freq='1Min', tz=tz)
168+
solpos = pvlib.solarposition.get_solarposition(times, latitude, longitude)
169+
170+
apparent_zenith = solpos['apparent_zenith']
171+
airmass = pvlib.atmosphere.relativeairmass(apparent_zenith)
172+
pressure = pvlib.atmosphere.alt2pres(altitude)
173+
airmass = pvlib.atmosphere.absoluteairmass(airmass, pressure)
174+
linke_turbidity = pvlib.clearsky.lookup_linke_turbidity(times, latitude, longitude)
175+
dni_extra = pvlib.irradiance.extraradiation(apparent_zenith.index.dayofyear)
176+
177+
# an input is a Series, so solis is a DataFrame
178+
ineichen = clearsky.ineichen(apparent_zenith, airmass, linke_turbidity,
179+
altitude, dni_extra)
180+
ax = ineichen.plot();
181+
ax.set_ylabel('Irradiance $W/m^2$');
182+
ax.legend(loc=2);
183+
@savefig ineichen-vs-time-climo.png width=6in
184+
plt.show();
185+
186+
The function respects the input types. Array input results in an OrderedDict
187+
of array output, and Series input results in a DataFrame output. The keys
188+
are 'ghi', 'dni', and 'dhi'.
189+
190+
Grid with a clear sky irradiance for a few turbidity values.
191+
162192
.. ipython:: python
163193
194+
times = pd.date_range(start='2014-09-01', end='2014-09-02', freq='1Min', tz=tz)
195+
solpos = pvlib.solarposition.get_solarposition(times, latitude, longitude)
196+
197+
apparent_zenith = solpos['apparent_zenith']
198+
airmass = pvlib.atmosphere.relativeairmass(apparent_zenith)
199+
pressure = pvlib.atmosphere.alt2pres(altitude)
200+
airmass = pvlib.atmosphere.absoluteairmass(airmass, pressure)
201+
linke_turbidity = pvlib.clearsky.lookup_linke_turbidity(times, latitude, longitude)
202+
print('climatological linke_turbidity = {}'.format(linke_turbidity.mean()))
203+
dni_extra = pvlib.irradiance.extraradiation(apparent_zenith.index.dayofyear)
204+
205+
linke_turbidities = [linke_turbidity.mean(), 2, 4]
206+
207+
fig, axes = plt.subplots(ncols=3, nrows=1, sharex=True, sharey=True, squeeze=True)
208+
axes = axes.flatten()
209+
210+
for linke_turbidity, ax in zip(linke_turbidities, axes):
211+
ineichen = clearsky.ineichen(apparent_zenith, airmass, linke_turbidity,
212+
altitude, dni_extra)
213+
ineichen.plot(ax=ax, title='Linke turbidity = {:0.1f}'.format(linke_turbidity))
214+
ax.legend(loc=1)
215+
216+
@savefig ineichen-grid.png width=10in
217+
plt.show();
218+
164219
165220
166221
Validation
@@ -198,7 +253,9 @@ from `radiosondes <http://weather.uwyo.edu/upperair/sounding.html>`_,
198253
derived from surface relative humidity using functions such as
199254
:py:func:`pvlib.atmosphere.gueymard94_pw`.
200255
Numerous gridded products from satellites, weather models, and climate models
201-
contain one or both of aerosols and precipitable water.
256+
contain one or both of aerosols and precipitable water. Consider data
257+
from the `ECMWF <https://software.ecmwf.int/wiki/display/WEBAPI/Access+ECMWF+Public+Datasets>`_
258+
and `SoDa <http://www.soda-pro.com/web-services/radiation/cams-mcclear>`_.
202259

203260
Aerosol optical depth is a function of wavelength, and the Simplified
204261
Solis model requires AOD at 700 nm. Models exist to convert AOD between
@@ -223,6 +280,7 @@ A clear sky time series using basic pvlib functions.
223280
pressure = pvlib.atmosphere.alt2pres(altitude)
224281
dni_extra = pvlib.irradiance.extraradiation(apparent_elevation.index.dayofyear)
225282
283+
# an input is a Series, so solis is a DataFrame
226284
solis = clearsky.simplified_solis(apparent_elevation, aod700, precipitable_water,
227285
pressure, dni_extra)
228286
ax = solis.plot();
@@ -231,6 +289,9 @@ A clear sky time series using basic pvlib functions.
231289
@savefig solis-vs-time-0.1-1.png width=6in
232290
plt.show();
233291
292+
The function respects the input types. Array input results in an OrderedDict
293+
of array output, and Series input results in a DataFrame output. The keys
294+
are 'ghi', 'dni', and 'dhi'.
234295

235296
Irradiance as a function of solar elevation.
236297

@@ -288,6 +349,7 @@ Contour plots of irradiance as a function of both PW and AOD.
288349
289350
aod700, precipitable_water = np.meshgrid(aod700, precipitable_water)
290351
352+
# inputs are arrays, so solis is an OrderedDict
291353
solis = clearsky.simplified_solis(apparent_elevation, aod700,
292354
precipitable_water, pressure,
293355
dni_extra)

0 commit comments

Comments
 (0)