From 4a56afcb4d41d45185fab98b80ac69153fd2e5f3 Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Wed, 4 Apr 2018 09:57:32 -0700 Subject: [PATCH 1/3] fix cs docs, update env --- docs/environment.yml | 20 ++++++++++---------- docs/sphinx/source/clearsky.rst | 22 ++++++++++------------ 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/docs/environment.yml b/docs/environment.yml index 4c446addbd..5aa98b05a1 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -3,23 +3,23 @@ channels: - conda-forge - defaults dependencies: - - python=3.5 + - python=3.6 - mock # needed for local python 2.7 builds - - numpy=1.11.2 + - numpy=1.14.2 - scipy - - tables - - pandas=0.19.1 + - pytables + - pandas=0.22.0 - pytz - ephem - numba - - ipython=5.2.2 + - ipython=6.3 - ipywidgets - numpydoc - - matplotlib=2.0.0 - - seaborn=0.7.1 - - siphon=0.4.0 - - sphinx=1.5 - - netCDF4=1.2.5 + - matplotlib=2.2.2 + - seaborn=0.8.1 + - siphon=0.7.0 + - sphinx=1.7.2 + - netCDF4=1.3.1 - hdf4=4.2.12 - sphinx_rtd_theme - docutils diff --git a/docs/sphinx/source/clearsky.rst b/docs/sphinx/source/clearsky.rst index c84cc857b6..aa7bf3ba52 100644 --- a/docs/sphinx/source/clearsky.rst +++ b/docs/sphinx/source/clearsky.rst @@ -147,13 +147,13 @@ the year. You could run it in a loop to create plots for all months. In [1]: def plot_turbidity_map(month, vmin=1, vmax=100): ...: plt.figure(); - ...: plt.imshow(lt_h5_file.root.LinkeTurbidity[:, :, month-1], vmin=vmin, vmax=vmax); + ...: with tables.open_file(filepath) as lt_h5_file: + ...: ltdata = lt_h5_file.root.LinkeTurbidity[:, :, month-1] + ...: plt.imshow(ltdata, vmin=vmin, vmax=vmax); ...: plt.title('Linke turbidity x 20, ' + calendar.month_name[month]); ...: plt.colorbar(shrink=0.5); ...: plt.tight_layout(); - In [1]: lt_h5_file.close() - @savefig turbidity-1.png width=10in In [1]: plot_turbidity_map(1) @@ -228,7 +228,7 @@ A clear sky time series using only basic pvlib functions. In [1]: linke_turbidity = pvlib.clearsky.lookup_linke_turbidity(times, latitude, longitude) - In [1]: dni_extra = pvlib.irradiance.extraradiation(times.dayofyear) + In [1]: dni_extra = pvlib.irradiance.extraradiation(times) # an input is a pandas Series, so solis is a DataFrame In [1]: ineichen = clearsky.ineichen(apparent_zenith, airmass, linke_turbidity, altitude, dni_extra) @@ -270,7 +270,7 @@ Grid with a clear sky irradiance for a few turbidity values. In [1]: print('climatological linke_turbidity = {}'.format(linke_turbidity.mean())) - In [1]: dni_extra = pvlib.irradiance.extraradiation(times.dayofyear) + In [1]: dni_extra = pvlib.irradiance.extraradiation(times) In [1]: linke_turbidities = [linke_turbidity.mean(), 2, 4] @@ -357,7 +357,7 @@ A clear sky time series using only basic pvlib functions. In [1]: pressure = pvlib.atmosphere.alt2pres(altitude) - In [1]: dni_extra = pvlib.irradiance.extraradiation(times.dayofyear) + In [1]: dni_extra = pvlib.irradiance.extraradiation(times) # an input is a Series, so solis is a DataFrame In [1]: solis = clearsky.simplified_solis(apparent_elevation, aod700, precipitable_water, @@ -419,7 +419,7 @@ Grid with a clear sky irradiance for a few PW and AOD values. In [1]: pressure = pvlib.atmosphere.alt2pres(altitude) - In [1]: dni_extra = pvlib.irradiance.extraradiation(times.dayofyear) + In [1]: dni_extra = pvlib.irradiance.extraradiation(times) In [1]: aod700 = [0.01, 0.1] @@ -457,8 +457,6 @@ Contour plots of irradiance as a function of both PW and AOD. ...: precipitable_water, pressure, ...: dni_extra) - In [1]: cmap = plt.get_cmap('viridis') - In [1]: n = 15 In [1]: vmin = None @@ -468,8 +466,8 @@ Contour plots of irradiance as a function of both PW and AOD. In [1]: def plot_solis(key): ...: irrad = solis[key] ...: fig, ax = plt.subplots() - ...: im = ax.contour(aod700, precipitable_water, irrad[:, :], n, cmap=cmap, vmin=vmin, vmax=vmax) - ...: imf = ax.contourf(aod700, precipitable_water, irrad[:, :], n, cmap=cmap, vmin=vmin, vmax=vmax) + ...: im = ax.contour(aod700, precipitable_water, irrad[:, :], n, vmin=vmin, vmax=vmax) + ...: imf = ax.contourf(aod700, precipitable_water, irrad[:, :], n, vmin=vmin, vmax=vmax) ...: ax.set_xlabel('AOD') ...: ax.set_ylabel('Precipitable water (cm)') ...: ax.clabel(im, colors='k', fmt='%.0f') @@ -566,7 +564,7 @@ Now we run the synthetic data and clear sky estimate through the fig, ax = plt.subplots() - clear_samples.plot(); + clear_samples.astype(int).plot(); @savefig detect-clear-detected.png width=10in ax.set_ylabel('Clear (1) or Cloudy (0)'); From 4423a3f88796ca6b206dc381718c2245b220f3b1 Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Wed, 4 Apr 2018 10:22:53 -0700 Subject: [PATCH 2/3] remove seaborn --- docs/environment.yml | 1 - docs/sphinx/source/clearsky.rst | 9 +-------- docs/sphinx/source/forecasts.rst | 3 --- docs/sphinx/source/package_overview.rst | 4 ---- docs/sphinx/source/timetimezones.rst | 6 ------ 5 files changed, 1 insertion(+), 22 deletions(-) diff --git a/docs/environment.yml b/docs/environment.yml index 5aa98b05a1..04c5561e15 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -16,7 +16,6 @@ dependencies: - ipywidgets - numpydoc - matplotlib=2.2.2 - - seaborn=0.8.1 - siphon=0.7.0 - sphinx=1.7.2 - netCDF4=1.3.1 diff --git a/docs/sphinx/source/clearsky.rst b/docs/sphinx/source/clearsky.rst index aa7bf3ba52..e89b3c9d0e 100644 --- a/docs/sphinx/source/clearsky.rst +++ b/docs/sphinx/source/clearsky.rst @@ -40,11 +40,6 @@ We'll need these imports for the examples below. In [1]: import pandas as pd - # seaborn makes the plots look nicer - In [1]: import seaborn as sns - - In [1]: sns.set_color_codes() - In [1]: import pvlib In [1]: from pvlib import clearsky, atmosphere @@ -142,14 +137,12 @@ the year. You could run it in a loop to create plots for all months. In [1]: filepath = os.path.join(pvlib_path, 'data', 'LinkeTurbidities.h5') - # data is in units of 20 x turbidity - In [1]: lt_h5_file = tables.open_file(filepath) - In [1]: def plot_turbidity_map(month, vmin=1, vmax=100): ...: plt.figure(); ...: with tables.open_file(filepath) as lt_h5_file: ...: ltdata = lt_h5_file.root.LinkeTurbidity[:, :, month-1] ...: plt.imshow(ltdata, vmin=vmin, vmax=vmax); + ...: # data is in units of 20 x turbidity ...: plt.title('Linke turbidity x 20, ' + calendar.month_name[month]); ...: plt.colorbar(shrink=0.5); ...: plt.tight_layout(); diff --git a/docs/sphinx/source/forecasts.rst b/docs/sphinx/source/forecasts.rst index f227328f02..5210036208 100644 --- a/docs/sphinx/source/forecasts.rst +++ b/docs/sphinx/source/forecasts.rst @@ -84,9 +84,6 @@ then set the location and time range data. import matplotlib.pyplot as plt import datetime - # seaborn makes the plots look nicer - import seaborn as sns; sns.set_color_codes() - # import pvlib forecast models from pvlib.forecast import GFS, NAM, NDFD, HRRR, RAP diff --git a/docs/sphinx/source/package_overview.rst b/docs/sphinx/source/package_overview.rst index 78738125b2..fab2c0e162 100644 --- a/docs/sphinx/source/package_overview.rst +++ b/docs/sphinx/source/package_overview.rst @@ -39,10 +39,6 @@ configuration at a handful of sites listed below. import pandas as pd import matplotlib.pyplot as plt - # seaborn makes the plots look nicer - import seaborn as sns - sns.set_color_codes() - naive_times = pd.DatetimeIndex(start='2015', end='2016', freq='1h') # very approximate diff --git a/docs/sphinx/source/timetimezones.rst b/docs/sphinx/source/timetimezones.rst index b609220683..a28867cce6 100644 --- a/docs/sphinx/source/timetimezones.rst +++ b/docs/sphinx/source/timetimezones.rst @@ -297,12 +297,6 @@ Solar position The correct solar position can be immediately calculated from the DataFrame's index since the index has been localized. -.. ipython:: python - :suppress: - - import seaborn as sns - sns.set_color_codes() - .. ipython:: python solar_position = pvlib.solarposition.get_solarposition(tmy3_data.index, From 7fa326e56d7809d2be1e57742906c6b0fd8bece0 Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Wed, 4 Apr 2018 10:34:39 -0700 Subject: [PATCH 3/3] minor updates to text --- docs/sphinx/source/forecasts.rst | 12 ++++++------ docs/sphinx/source/package_overview.rst | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/sphinx/source/forecasts.rst b/docs/sphinx/source/forecasts.rst index 5210036208..a07dbb8bac 100644 --- a/docs/sphinx/source/forecasts.rst +++ b/docs/sphinx/source/forecasts.rst @@ -16,12 +16,14 @@ state-of-the-art of solar power forecasting. pvlib-python uses Unidata's `Siphon `_ library to simplify access -to forecast data hosted on the Unidata `THREDDS catalog +to real-time forecast data hosted on the Unidata `THREDDS catalog `_. Siphon is great for programatic access of THREDDS data, but we also recommend using tools such as `Panoply `_ to easily browse the catalog and become more familiar with its contents. +We do not know of a similarly easy way to access archives of forecast data. + This document demonstrates how to use pvlib-python to create a PV power forecast using these tools. The `forecast `_ for more information. Use the HRRR, among others, if you want forecasts for less than 24 hours. The HRRR model covers the continental United States. @@ -351,8 +352,7 @@ RAP The Rapid Refresh (RAP) model is the parent model for the HRRR. It is updated every hour and runs at 40, 20, and 13 km resolutions. Only the 20 and 40 km resolutions are currently available in pvlib. It is also -excels in severe weather situations. A major upgrade to the RAP model is -expected in Spring, 2016. See the `NOAA ESRL HRRR page +excels in severe weather situations. See the `NOAA ESRL HRRR page `_ for more information. Use the RAP, among others, if you want forecasts for less than 24 hours. The RAP model covers most of North America. @@ -468,7 +468,7 @@ Here's the forecast plane of array irradiance... .. ipython:: python - mc.ac.plot(); + mc.ac.fillna(0).plot(); plt.ylim(0, None); @savefig ac_power.png width=6in plt.ylabel('AC Power (W)'); diff --git a/docs/sphinx/source/package_overview.rst b/docs/sphinx/source/package_overview.rst index fab2c0e162..3a245e368d 100644 --- a/docs/sphinx/source/package_overview.rst +++ b/docs/sphinx/source/package_overview.rst @@ -294,7 +294,7 @@ The pvlib-python community thanks Sandia National Lab for developing PVLIB Matlab and for supporting Rob Andrews of Calama Consulting to port the library to Python. Will Holmgren thanks the DOE EERE Postdoctoral Fellowship program -for support. +for support from 2014-2016. The pvlib-python maintainers thank all of pvlib's contributors of issues and especially pull requests. The pvlib-python community thanks all of the