@@ -40,11 +40,6 @@ We'll need these imports for the examples below.
40
40
41
41
In [1]: import pandas as pd
42
42
43
- # seaborn makes the plots look nicer
44
- In [1]: import seaborn as sns
45
-
46
- In [1]: sns.set_color_codes()
47
-
48
43
In [1]: import pvlib
49
44
50
45
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.
142
137
143
138
In [1]: filepath = os.path.join(pvlib_path, 'data', 'LinkeTurbidities.h5')
144
139
145
- # data is in units of 20 x turbidity
146
- In [1]: lt_h5_file = tables.open_file(filepath)
147
-
148
140
In [1]: def plot_turbidity_map(month, vmin=1, vmax=100):
149
141
...: 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
151
146
...: plt.title('Linke turbidity x 20, ' + calendar.month_name[month]);
152
147
...: plt.colorbar(shrink=0.5);
153
148
...: plt.tight_layout();
154
149
155
- In [1]: lt_h5_file.close()
156
-
157
150
@savefig turbidity-1.png width=10in
158
151
In [1]: plot_turbidity_map(1)
159
152
@@ -228,7 +221,7 @@ A clear sky time series using only basic pvlib functions.
228
221
229
222
In [1]: linke_turbidity = pvlib.clearsky.lookup_linke_turbidity(times, latitude, longitude)
230
223
231
- In [1]: dni_extra = pvlib.irradiance.extraradiation(times.dayofyear )
224
+ In [1]: dni_extra = pvlib.irradiance.extraradiation(times)
232
225
233
226
# an input is a pandas Series, so solis is a DataFrame
234
227
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.
270
263
271
264
In [1]: print('climatological linke_turbidity = {}'.format(linke_turbidity.mean()))
272
265
273
- In [1]: dni_extra = pvlib.irradiance.extraradiation(times.dayofyear )
266
+ In [1]: dni_extra = pvlib.irradiance.extraradiation(times)
274
267
275
268
In [1]: linke_turbidities = [linke_turbidity.mean(), 2, 4]
276
269
@@ -357,7 +350,7 @@ A clear sky time series using only basic pvlib functions.
357
350
358
351
In [1]: pressure = pvlib.atmosphere.alt2pres(altitude)
359
352
360
- In [1]: dni_extra = pvlib.irradiance.extraradiation(times.dayofyear )
353
+ In [1]: dni_extra = pvlib.irradiance.extraradiation(times)
361
354
362
355
# an input is a Series, so solis is a DataFrame
363
356
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.
419
412
420
413
In [1]: pressure = pvlib.atmosphere.alt2pres(altitude)
421
414
422
- In [1]: dni_extra = pvlib.irradiance.extraradiation(times.dayofyear )
415
+ In [1]: dni_extra = pvlib.irradiance.extraradiation(times)
423
416
424
417
In [1]: aod700 = [0.01, 0.1]
425
418
@@ -457,8 +450,6 @@ Contour plots of irradiance as a function of both PW and AOD.
457
450
...: precipitable_water, pressure,
458
451
...: dni_extra)
459
452
460
- In [1]: cmap = plt.get_cmap('viridis')
461
-
462
453
In [1]: n = 15
463
454
464
455
In [1]: vmin = None
@@ -468,8 +459,8 @@ Contour plots of irradiance as a function of both PW and AOD.
468
459
In [1]: def plot_solis(key):
469
460
...: irrad = solis[key]
470
461
...: 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)
473
464
...: ax.set_xlabel('AOD')
474
465
...: ax.set_ylabel('Precipitable water (cm)')
475
466
...: ax.clabel(im, colors='k', fmt='%.0f')
@@ -566,7 +557,7 @@ Now we run the synthetic data and clear sky estimate through the
566
557
567
558
fig, ax = plt.subplots()
568
559
569
- clear_samples.plot();
560
+ clear_samples.astype( int ). plot();
570
561
571
562
@savefig detect -clear-detected.png width=10in
572
563
ax.set_ylabel(' Clear (1) or Cloudy (0)' );
0 commit comments