@@ -40,11 +40,6 @@ We'll need these imports for the examples below.
4040
4141 In [1]: import pandas as pd
4242
43- # seaborn makes the plots look nicer
44- In [1]: import seaborn as sns
45-
46- In [1]: sns.set_color_codes()
47-
4843 In [1]: import pvlib
4944
5045 In [1]: from pvlib import clearsky, atmosphere
@@ -142,18 +137,16 @@ the year. You could run it in a loop to create plots for all months.
142137
143138 In [1]: filepath = os.path.join(pvlib_path, 'data', 'LinkeTurbidities.h5')
144139
145- # data is in units of 20 x turbidity
146- In [1]: lt_h5_file = tables.open_file(filepath)
147-
148140 In [1]: def plot_turbidity_map(month, vmin=1, vmax=100):
149141 ...: plt.figure();
150- ...: plt.imshow(lt_h5_file.root.LinkeTurbidity[:, :, month-1], vmin=vmin, vmax=vmax);
142+ ...: with tables.open_file(filepath) as lt_h5_file:
143+ ...: ltdata = lt_h5_file.root.LinkeTurbidity[:, :, month-1]
144+ ...: plt.imshow(ltdata, vmin=vmin, vmax=vmax);
145+ ...: # data is in units of 20 x turbidity
151146 ...: plt.title('Linke turbidity x 20, ' + calendar.month_name[month]);
152147 ...: plt.colorbar(shrink=0.5);
153148 ...: plt.tight_layout();
154149
155- In [1]: lt_h5_file.close()
156-
157150 @savefig turbidity-1.png width=10in
158151 In [1]: plot_turbidity_map(1)
159152
@@ -228,7 +221,7 @@ A clear sky time series using only basic pvlib functions.
228221
229222 In [1]: linke_turbidity = pvlib.clearsky.lookup_linke_turbidity(times, latitude, longitude)
230223
231- In [1]: dni_extra = pvlib.irradiance.extraradiation(times.dayofyear )
224+ In [1]: dni_extra = pvlib.irradiance.extraradiation(times)
232225
233226 # an input is a pandas Series, so solis is a DataFrame
234227 In [1]: ineichen = clearsky.ineichen(apparent_zenith, airmass, linke_turbidity, altitude, dni_extra)
@@ -270,7 +263,7 @@ Grid with a clear sky irradiance for a few turbidity values.
270263
271264 In [1]: print('climatological linke_turbidity = {}'.format(linke_turbidity.mean()))
272265
273- In [1]: dni_extra = pvlib.irradiance.extraradiation(times.dayofyear )
266+ In [1]: dni_extra = pvlib.irradiance.extraradiation(times)
274267
275268 In [1]: linke_turbidities = [linke_turbidity.mean(), 2, 4]
276269
@@ -357,7 +350,7 @@ A clear sky time series using only basic pvlib functions.
357350
358351 In [1]: pressure = pvlib.atmosphere.alt2pres(altitude)
359352
360- In [1]: dni_extra = pvlib.irradiance.extraradiation(times.dayofyear )
353+ In [1]: dni_extra = pvlib.irradiance.extraradiation(times)
361354
362355 # an input is a Series, so solis is a DataFrame
363356 In [1]: solis = clearsky.simplified_solis(apparent_elevation, aod700, precipitable_water,
@@ -419,7 +412,7 @@ Grid with a clear sky irradiance for a few PW and AOD values.
419412
420413 In [1]: pressure = pvlib.atmosphere.alt2pres(altitude)
421414
422- In [1]: dni_extra = pvlib.irradiance.extraradiation(times.dayofyear )
415+ In [1]: dni_extra = pvlib.irradiance.extraradiation(times)
423416
424417 In [1]: aod700 = [0.01, 0.1]
425418
@@ -457,8 +450,6 @@ Contour plots of irradiance as a function of both PW and AOD.
457450 ...: precipitable_water, pressure,
458451 ...: dni_extra)
459452
460- In [1]: cmap = plt.get_cmap('viridis')
461-
462453 In [1]: n = 15
463454
464455 In [1]: vmin = None
@@ -468,8 +459,8 @@ Contour plots of irradiance as a function of both PW and AOD.
468459 In [1]: def plot_solis(key):
469460 ...: irrad = solis[key]
470461 ...: fig, ax = plt.subplots()
471- ...: im = ax.contour(aod700, precipitable_water, irrad[:, :], n, cmap=cmap, vmin=vmin, vmax=vmax)
472- ...: imf = ax.contourf(aod700, precipitable_water, irrad[:, :], n, cmap=cmap, vmin=vmin, vmax=vmax)
462+ ...: im = ax.contour(aod700, precipitable_water, irrad[:, :], n, vmin=vmin, vmax=vmax)
463+ ...: imf = ax.contourf(aod700, precipitable_water, irrad[:, :], n, vmin=vmin, vmax=vmax)
473464 ...: ax.set_xlabel('AOD')
474465 ...: ax.set_ylabel('Precipitable water (cm)')
475466 ...: ax.clabel(im, colors='k', fmt='%.0f')
@@ -566,7 +557,7 @@ Now we run the synthetic data and clear sky estimate through the
566557
567558 fig, ax = plt.subplots()
568559
569- clear_samples.plot();
560+ clear_samples.astype( int ). plot();
570561
571562 @savefig detect -clear-detected.png width=10in
572563 ax.set_ylabel(' Clear (1) or Cloudy (0)' );
0 commit comments