Skip to content

Commit f962ab4

Browse files
committed
Merge remote-tracking branch 'pvlib/master' into forecast
2 parents 59fa13f + a6ecb75 commit f962ab4

31 files changed

+2051
-601
lines changed

LICENSE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Copyright (c) 2013, Sandia National Labs
22
All rights reserved.
33

4+
Copyright (c) 2014-2016, PVLIB Python Developers
5+
All rights reserved.
6+
47
Redistribution and use in source and binary forms, with or without modification,
58
are permitted provided that the following conditions are met:
69

README.md

Lines changed: 22 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -8,87 +8,47 @@ pvlib-python
88
[![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.50141.svg)](http://dx.doi.org/10.5281/zenodo.50141)
99

1010

11-
pvlib-python is a community supported tool that provides a set of documented functions for simulating the performance of photovoltaic energy systems. The toolbox was originally developed in MATLAB at Sandia National Laboratories and it implements many of the models and methods developed at the Labs. More information on Sandia Labs PV performance modeling programs can be found at https://pvpmc.sandia.gov/. We collaborate with the PVLIB-MATLAB project, but operate independently of it.
11+
PVLIB Python is a community supported tool that provides a set of
12+
functions and classes for simulating the performance of photovoltaic
13+
energy systems. PVLIB Python was originally ported from the PVLIB MATLAB
14+
toolbox developed at Sandia National Laboratories and it implements many
15+
of the models and methods developed at the Labs. More information on
16+
Sandia Labs PV performance modeling programs can be found at
17+
https://pvpmc.sandia.gov/. We collaborate with the PVLIB MATLAB project,
18+
but operate independently of it.
1219

1320

1421
Documentation
1522
=============
1623

17-
Full documentation can be found at [readthedocs](http://pvlib-python.readthedocs.org/en/latest/).
18-
19-
20-
Contributing
21-
============
22-
23-
We need your help to make pvlib-python a great tool! Please see the [Contributing page](http://pvlib-python.readthedocs.org/en/latest/contributing.html) for more on how you can contribute. The long-term success of pvlib-python requires substantial community support.
24+
Full documentation can be found at [readthedocs](http://pvlib-python.readthedocs.io/en/latest/).
2425

2526

2627
Installation
2728
============
2829

29-
To obtain the most recent stable release, just use ``pip`` or ``conda``:
30-
31-
```
32-
pip install pvlib
33-
```
34-
35-
```
36-
conda install -c pvlib pvlib
37-
```
38-
39-
Please see the [Installation page](http://pvlib-python.readthedocs.org/en/latest/installation.html) of the documentation for complete instructions.
40-
41-
42-
NREL SPA algorithm
43-
------------------
44-
pvlib-python is distributed with several validated, high-precision, and high-performance solar position calculators.
45-
It also includes wrappers for the official NREL SPA algorithm.
46-
To use the NREL SPA algorithm, a pip install from the web cannot be used. Instead:
47-
48-
1. Download the pvlib repository from https://github.com/pvlib/pvlib-python.git
49-
2. Download the SPA files from [NREL](http://www.nrel.gov/midc/spa/)
50-
3. Copy the SPA files into ``pvlib-python/pvlib/spa_c_files``
51-
4. From the ``pvlib-python`` directory, run ``pip uninstall pvlib`` followed by ``pip install . ``
30+
pvlib-python releases may be installed using the ``pip`` and ``conda`` tools.
31+
Please see the [Installation page](http://pvlib-python.readthedocs.io/en/latest/installation.html) of the documentation for complete instructions.
5232

33+
pvlib-python is compatible with Python versions 2.7, 3.4, 3.5
5334

54-
Usage
55-
=====
56-
You're now ready to start some version of the Python interpreter and use pvlib. The easiest way to start is with one of our [Jupyter](http://jupyter.org) notebook tutorials:
5735

58-
1. Use the nbviewer website to choose a tutorial to experiment with. Go to our [nbviewer tutorial page](http://nbviewer.jupyter.org/github/pvlib/pvlib-python/tree/master/docs/tutorials/), click on e.g. [``tmy_to_power.ipynb``](http://nbviewer.jupyter.org/github/pvlib/pvlib-python/blob/master/docs/tutorials/tmy_to_power.ipynb), and then click on the download symbol.
59-
1. Start the Jupyter Notebook server: ``jupyter notebook``. This should open a web browser with the Jupyter Notebook's file/folder listing. If not, navigate to the url shown in the command line history, likely ``http://localhost:8888``
60-
2. In Jupyter Notebook, navigate to the file that you downloaded in step one and open it.
61-
2. Use ``shift-enter`` to execute the notebook cell-by-cell. There is also a Play button that will execute all of the cells in the notebook.
62-
63-
You can also use a Jupyter notebook or any other Python interpreter to experiment with the simple code in the [Package overview](http://pvlib-python.readthedocs.org/en/latest/package_overview.html) section of the documentation.
36+
Contributing
37+
============
6438

65-
Many good online resources exist for getting started with scientific Python.
39+
We need your help to make pvlib-python a great tool!
40+
Please see the [Contributing page](http://pvlib-python.readthedocs.io/en/latest/contributing.html) for more on how you can contribute.
41+
The long-term success of pvlib-python requires substantial community support.
6642

6743

6844
License
6945
=======
70-
3 clause BSD.
71-
72-
73-
Compatibility
74-
=============
75-
76-
pvlib-python is compatible with Python versions 2.7, 3.3, 3.4, 3.5 and Pandas versions 0.13.1 through 0.18. Note that our Numba-accelerated solar position algorithms have more specific version requirements that will be resolved by the Numba installer.
77-
78-
For Linux + Python 3 users: Continuum's Python 3.x SciPy conda package is not compiled properly and has a few bugs related to complex arithmetic. The most common place for these bugs to show up when using pvlib-python is in calculating IV curve parameters using the ``singlediode`` function. We reported [the issue](https://github.com/ContinuumIO/anaconda-issues/issues/425) to Continuum and are waiting for it to be fixed. In the meantime, you can compile your own SciPy distribution, or you can use this trick on Python 3.3 and 3.4 (not 3.5): Downgrade your NumPy to 1.8 and SciPy to 0.14, then install whatever version of pandas you want but without dependencies. The conda commands for this are:
7946

80-
```
81-
conda install numpy=1.8 scipy=0.14
82-
conda install pandas --no-deps
83-
```
47+
BSD 3-clause
8448

85-
For Windows + Python 2.7 users: Continuum's Python 2.7 SciPy 0.16.1 and 0.17.0 packages are not compiled properly and will crash your Python interpreter if you use our Linke turbidity lookup function. See [Anaconda issue 650](https://github.com/ContinuumIO/anaconda-issues/issues/650) for more.
8649

87-
88-
Testing
50+
Contact
8951
=======
90-
Testing can easily be accomplished by running ``nosetests`` on the pvlib directory:
91-
```
92-
nosetests -v pvlib
93-
```
94-
Unit test code should be placed in the corresponding test module in the pvlib/test directory. Use ``pip`` or ``conda`` to install ``nose``. Developers must include comprehensive tests for any additions or modifications to pvlib.
52+
53+
Please use our [issues page](https://github.com/pvlib/pvlib-python/issues)
54+
to contact the developers and pvlib community.

docs/sphinx/source/contributing.rst

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,32 @@ commits to the main repo. Exceptions may be made for extremely minor
8080
changes, such as fixing documentation typos.
8181

8282

83+
Testing
84+
-------
85+
86+
pvlib's unit tests can easily be run by executing ``nosetests`` on the
87+
pvlib directory:
88+
89+
``nosetests -v pvlib``
90+
91+
or, for a single module:
92+
93+
``nosetests -v pvlib/tests/test_clearsky.py``
94+
95+
While copy/paste coding should generally be avoided, it's a great way
96+
to learn how to write unit tests!
97+
98+
Unit test code should be placed in the corresponding test module in the
99+
pvlib/test directory.
100+
101+
Developers **must** include comprehensive tests for any additions or
102+
modifications to pvlib.
103+
104+
83105
This documentation
84106
------------------
107+
85108
If this documentation is unclear, help us improve it! Consider looking
86-
at `IPython <https://github.com/ipython/ipython/wiki/Dev:-Index>`_,
87-
`pandas <https://github.com/pydata/pandas/wiki>`_, and
88-
`Sandia-Labs/PVLIB_Python#33 <https://github.com/Sandia-Labs/
89-
PVLIB_Python/issues/33>`_ for inspiration.
109+
at the `pandas
110+
documentation <http://pandas.pydata.org/pandas-docs/version/0.18.1/
111+
contributing.html>`_ for inspiration.

docs/sphinx/source/index.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
pvlib-python
22
========================================
33

4-
pvlib-python provides a set of documented functions for simulating the
5-
performance of photovoltaic energy systems. The toolbox was originally
6-
developed in MATLAB at Sandia National Laboratories and it implements
7-
many of the models and methods developed at the Labs. More information
8-
on Sandia Labs PV performance modeling programs can be found at
9-
https://pvpmc.sandia.gov/.
4+
PVLIB Python is a community supported tool that provides a set of
5+
functions and classes for simulating the performance of photovoltaic
6+
energy systems. PVLIB Python was originally ported from the PVLIB MATLAB
7+
toolbox developed at Sandia National Laboratories and it implements many
8+
of the models and methods developed at the Labs. More information on
9+
Sandia Labs PV performance modeling programs can be found at
10+
https://pvpmc.sandia.gov/. We collaborate with the PVLIB MATLAB project,
11+
but operate independently of it.
1012

1113
The source code for pvlib-python is hosted on `github
1214
<https://github.com/pvlib/pvlib-python>`_.

docs/sphinx/source/installation.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,50 @@ interpreter will also work.
194194
Remember to ``source activate pvlibdev`` (or whatever you named your
195195
environment) when you start a new shell or terminal.
196196

197+
.. _nrelspa:
198+
199+
NREL SPA algorithm
200+
------------------
201+
202+
pvlib-python is distributed with several validated, high-precision, and
203+
high-performance solar position calculators. We strongly recommend using
204+
the built-in solar position calculators.
205+
206+
pvlib-python also includes unsupported wrappers for the official NREL
207+
SPA algorithm. NREL's license does not allow redistribution of the
208+
source code, so you must jump through some hoops to use it with pvlib.
209+
You will need a C compiler to use this code.
210+
211+
To install the NREL SPA algorithm for use with pvlib:
212+
213+
#. Download the pvlib repository (as described in :ref:`obtainsource`)
214+
#. Download the `SPA files from NREL <http://www.nrel.gov/midc/spa/>`_
215+
#. Copy the SPA files into ``pvlib-python/pvlib/spa_c_files``
216+
#. From the ``pvlib-python`` directory, run ``pip uninstall pvlib``
217+
followed by ``pip install .``
218+
219+
.. _compatibility:
220+
221+
Compatibility
222+
-------------
223+
224+
pvlib-python is compatible with Python versions 2.7, 3.4, 3.5 and Pandas
225+
versions 0.13.1 or newer.
226+
227+
There have been several problems with Continuum's Anaconda packages that
228+
have impacted pvlib users. The current problems that we're aware of are
229+
listed below:
230+
231+
#. For Windows + Python 2.7 users: Continuum's Python 2.7 SciPy 0.16.1,
232+
0.17.0, 0.17.1 packages are not compiled properly and will crash your
233+
Python interpreter if you use our Linke turbidity lookup function. See
234+
`Anaconda issue 650
235+
<https://github.com/ContinuumIO/anaconda-issues/issues/650>`_ for more.
236+
237+
Note that our Numba-accelerated solar position algorithms have more
238+
specific version requirements that will be resolved by the Numba
239+
installer.
240+
197241
.. _references:
198242

199243
References

docs/sphinx/source/package_overview.rst

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ configuration at a handful of sites listed below.
4343
import seaborn as sns
4444
sns.set_color_codes()
4545
46-
times = pd.DatetimeIndex(start='2015', end='2016', freq='1h')
46+
naive_times = pd.DatetimeIndex(start='2015', end='2016', freq='1h')
4747
4848
# very approximate
49-
# latitude, longitude, name, altitude
50-
coordinates = [(30, -110, 'Tucson', 700),
51-
(35, -105, 'Albuquerque', 1500),
52-
(40, -120, 'San Francisco', 10),
53-
(50, 10, 'Berlin', 34)]
49+
# latitude, longitude, name, altitude, timezone
50+
coordinates = [(30, -110, 'Tucson', 700, 'Etc/GMT+7'),
51+
(35, -105, 'Albuquerque', 1500, 'Etc/GMT+7'),
52+
(40, -120, 'San Francisco', 10, 'Etc/GMT+8'),
53+
(50, 10, 'Berlin', 34, 'Etc/GMT-1')]
5454
5555
import pvlib
5656
@@ -80,7 +80,9 @@ to accomplish our system modeling goal:
8080
'surface_azimuth': 180}
8181
8282
energies = {}
83-
for latitude, longitude, name, altitude in coordinates:
83+
# localize datetime indices (pvlib>=0.3.0)
84+
for latitude, longitude, name, altitude, timezone in coordinates:
85+
times = naive_times.tz_localize(timezone)
8486
system['surface_tilt'] = latitude
8587
cs = pvlib.clearsky.ineichen(times, latitude, longitude, altitude=altitude)
8688
solpos = pvlib.solarposition.get_solarposition(times, latitude, longitude)
@@ -125,8 +127,9 @@ a full understanding of what it is doing internally!
125127
from pvlib.modelchain import basic_chain
126128
127129
energies = {}
128-
for latitude, longitude, name, altitude in coordinates:
129-
dc, ac = basic_chain(times, latitude, longitude,
130+
for latitude, longitude, name, altitude, timezone in coordinates:
131+
dc, ac = basic_chain(naive_times.tz_localize(timezone),
132+
latitude, longitude,
130133
module, inverter,
131134
altitude=altitude,
132135
orientation_strategy='south_at_latitude_tilt')
@@ -173,14 +176,15 @@ objects to accomplish our system modeling goal:
173176
inverter_parameters=inverter)
174177
175178
energies = {}
176-
for latitude, longitude, name, altitude in coordinates:
177-
location = Location(latitude, longitude, name=name, altitude=altitude)
179+
for latitude, longitude, name, altitude, timezone in coordinates:
180+
location = Location(latitude, longitude, name=name, altitude=altitude,
181+
tz=timezone)
178182
# very experimental
179183
mc = ModelChain(system, location,
180184
orientation_strategy='south_at_latitude_tilt')
181185
# model results (ac, dc) and intermediates (aoi, temps, etc.)
182186
# assigned as mc object attributes
183-
mc.run_model(times)
187+
mc.run_model(naive_times.tz_localize(timezone))
184188
annual_energy = mc.ac.sum()
185189
energies[name] = annual_energy
186190
@@ -211,15 +215,17 @@ object to accomplish our modeling goal:
211215
from pvlib.pvsystem import LocalizedPVSystem
212216
213217
energies = {}
214-
for latitude, longitude, name, altitude in coordinates:
218+
for latitude, longitude, name, altitude, timezone in coordinates:
215219
localized_system = LocalizedPVSystem(module_parameters=module,
216220
inverter_parameters=inverter,
217221
surface_tilt=latitude,
218222
surface_azimuth=180,
219223
latitude=latitude,
220224
longitude=longitude,
221225
name=name,
222-
altitude=altitude)
226+
altitude=altitude,
227+
tz=timezone)
228+
times = naive_times.tz_localize(timezone)
223229
clearsky = localized_system.get_clearsky(times)
224230
solar_position = localized_system.get_solarposition(times)
225231
total_irrad = localized_system.get_irradiance(solar_position['apparent_zenith'],
@@ -283,4 +289,3 @@ The pvlib-python maintainers thank all of pvlib's contributors of issues
283289
and especially pull requests.
284290
The pvlib-python community thanks all of the
285291
maintainers and contributors to the PyData stack.
286-

docs/sphinx/source/whatsnew.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ What's New
66

77
These are new features and improvements of note in each release.
88

9+
.. include:: whatsnew/v0.4.0.txt
910
.. include:: whatsnew/v0.3.3.txt
1011
.. include:: whatsnew/v0.3.2.txt
1112
.. include:: whatsnew/v0.3.1.txt

docs/sphinx/source/whatsnew/v0.3.2.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. _whatsnew_0320:
22

3-
v0.3.1 (May 3, 2016)
3+
v0.3.2 (May 3, 2016)
44
-----------------------
55

66
This is a minor release from 0.3.1.

0 commit comments

Comments
 (0)