Skip to content

fix and update documentation #446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@ 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
- siphon=0.7.0
- sphinx=1.7.2
- netCDF4=1.3.1
- hdf4=4.2.12
- sphinx_rtd_theme
- docutils
Expand Down
31 changes: 11 additions & 20 deletions docs/sphinx/source/clearsky.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -142,18 +137,16 @@ 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();
...: 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);
...: # 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();

In [1]: lt_h5_file.close()

@savefig turbidity-1.png width=10in
In [1]: plot_turbidity_map(1)

Expand Down Expand Up @@ -228,7 +221,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)
Expand Down Expand Up @@ -270,7 +263,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]

Expand Down Expand Up @@ -357,7 +350,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,
Expand Down Expand Up @@ -419,7 +412,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]

Expand Down Expand Up @@ -457,8 +450,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
Expand All @@ -468,8 +459,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')
Expand Down Expand Up @@ -566,7 +557,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)');
Expand Down
15 changes: 6 additions & 9 deletions docs/sphinx/source/forecasts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ state-of-the-art of solar power forecasting.

pvlib-python uses Unidata's `Siphon
<http://siphon.readthedocs.org/en/latest/>`_ library to simplify access
to forecast data hosted on the Unidata `THREDDS catalog
to real-time forecast data hosted on the Unidata `THREDDS catalog
<http://thredds.ucar.edu/thredds/catalog.html>`_. Siphon is great for
programatic access of THREDDS data, but we also recommend using tools
such as `Panoply <http://www.giss.nasa.gov/tools/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
<http://nbviewer.jupyter.org/github/pvlib/pvlib-python/blob/
Expand Down Expand Up @@ -84,9 +86,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

Expand Down Expand Up @@ -329,8 +328,7 @@ HRRR
The High Resolution Rapid Refresh (HRRR) model is perhaps the most
accurate model, however, it is only available for ~15 hours. It is
updated every hour and runs at 3 km resolution. The HRRR excels in
severe weather situations. A major upgrade to the HRRR model is expected
in Spring, 2016. See the `NOAA ESRL HRRR page
severe weather situations. See the `NOAA ESRL HRRR page
<http://rapidrefresh.noaa.gov/hrrr/>`_ 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.
Expand All @@ -354,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
<http://rapidrefresh.noaa.gov/hrrr/>`_ 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.
Expand Down Expand Up @@ -471,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)');
Expand Down
6 changes: 1 addition & 5 deletions docs/sphinx/source/package_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -298,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
Expand Down
6 changes: 0 additions & 6 deletions docs/sphinx/source/timetimezones.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down