Skip to content

Commit

Permalink
Replace pvfactors with solarfactors (#1797)
Browse files Browse the repository at this point in the history
* try out solarfactors

* use solarfactosr in conda env files too

* docs and whatsnew

* More documentation

* reword for clarity; add a bit of "why"
  • Loading branch information
kandersolar authored Jul 5, 2023
1 parent 6bf9e07 commit c063992
Show file tree
Hide file tree
Showing 15 changed files with 98 additions and 47 deletions.
2 changes: 1 addition & 1 deletion ci/requirements-py3.10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ dependencies:
- statsmodels
- pip:
- nrel-pysam>=2.0
- pvfactors==1.5.2
- solarfactors
2 changes: 1 addition & 1 deletion ci/requirements-py3.11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ dependencies:
- statsmodels
- pip:
- nrel-pysam>=2.0
- pvfactors==1.5.2
- solarfactors
2 changes: 1 addition & 1 deletion ci/requirements-py3.7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ dependencies:
- statsmodels
- pip:
- nrel-pysam>=2.0
- pvfactors==1.5.2
- solarfactors
2 changes: 1 addition & 1 deletion ci/requirements-py3.8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ dependencies:
- statsmodels
- pip:
- nrel-pysam>=2.0
- pvfactors==1.5.2
- solarfactors
2 changes: 1 addition & 1 deletion ci/requirements-py3.9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ dependencies:
- statsmodels
- pip:
- nrel-pysam>=2.0
- pvfactors==1.5.2
- solarfactors
7 changes: 7 additions & 0 deletions docs/examples/bifacial/plot_bifi_model_mc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
#
# Future versions of pvlib may make it easier to do bifacial modeling
# with ``ModelChain``.
#
# .. attention::
# To run this example, the ``solarfactors`` package (an implementation
# of the pvfactors model) must be installed. It can be installed with
# either ``pip install solarfactors`` or ``pip install pvlib[optional]``,
# which installs all of pvlib's optional dependencies.


import pandas as pd
from pvlib import pvsystem
Expand Down
6 changes: 6 additions & 0 deletions docs/examples/bifacial/plot_bifi_model_pvwatts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
# :py:func:`pvlib.pvsystem.pvwatts_dc` with the
# :py:func:`pvlib.bifacial.pvfactors.pvfactors_timeseries` function to
# transpose GHI data to both front and rear Plane of Array (POA) irradiance.
#
# .. attention::
# To run this example, the ``solarfactors`` package (an implementation
# of the pvfactors model) must be installed. It can be installed with
# either ``pip install solarfactors`` or ``pip install pvlib[optional]``,
# which installs all of pvlib's optional dependencies.

import pandas as pd
from pvlib import location
Expand Down
6 changes: 6 additions & 0 deletions docs/examples/bifacial/plot_pvfactors_fixed_tilt.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
# fixed-tilt systems correctly.
# This example shows how to model rear-side irradiance on a fixed-tilt
# array using :py:func:`pvlib.bifacial.pvfactors.pvfactors_timeseries`.
#
# .. attention::
# To run this example, the ``solarfactors`` package (an implementation
# of the pvfactors model) must be installed. It can be installed with
# either ``pip install solarfactors`` or ``pip install pvlib[optional]``,
# which installs all of pvlib's optional dependencies.

import pandas as pd
from pvlib import location
Expand Down
3 changes: 2 additions & 1 deletion docs/sphinx/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ def setup(app):
'pull': ('https://github.com/pvlib/pvlib-python/pull/%s', 'GH'),
'wiki': ('https://github.com/pvlib/pvlib-python/wiki/%s', 'wiki '),
'doi': ('http://dx.doi.org/%s', 'DOI: '),
'ghuser': ('https://github.com/%s', '@')
'ghuser': ('https://github.com/%s', '@'),
'discuss': ('https://github.com/pvlib/pvlib-python/discussions/%s', 'GH'),
}

# -- Options for manual page output ---------------------------------------
Expand Down
19 changes: 16 additions & 3 deletions docs/sphinx/source/user_guide/bifacial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ surfaces.
pvlib-python provides two groups of functions for estimating front and back
irradiance:

1. a wrapper for convenient use of the pvfactors package:
1. a wrapper for convenient use of the pvfactors model:
:py:func:`~pvlib.bifacial.pvfactors.pvfactors_timeseries`

2. the infinite sheds bifacial model:
Expand All @@ -26,12 +26,25 @@ irradiance:
pvfactors
---------

The `pvfactors <https://sunpower.github.io/pvfactors/>`_ package calculates
The pvfactors model calculates
incident irradiance on the front and back surfaces of an array. pvfactors uses
a 2D geometry which assumes that the array is made up of long, regular rows.
Irradiance is calculated in the middle of a row; end-of-row effects are not
included. pvfactors can model arrays in fixed racking or on single-axis
trackers.
trackers with a user-configurable number of rows.

Prior to pvlib version 0.10.1, pvlib used the original SunPower implementation
of the model via the `pvfactors <https://github.com/sunpower/pvfactors>`_
package. Starting in version 0.10.1, pvlib instead uses
`solarfactors <https://github.com/pvlib/solarfactors>`_, a drop-in
replacement implementation maintained by the pvlib community.
This switch was made when the original ``pvfactors`` package became
difficult to install in modern python environments.
``solarfactors`` implements the same model as ``pvfactors`` and is kept
up to date and working over time. Note that "solarfactors" is only the name
on PyPI (meaning it is installed via ``pip install solarfactors``);
after installation, Python code still accesses it as "pvfactors"
(e.g. ``import pvfactors``).


Infinite Sheds
Expand Down
1 change: 1 addition & 0 deletions docs/sphinx/source/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ What's New

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

.. include:: whatsnew/v0.10.1.rst
.. include:: whatsnew/v0.10.0.rst
.. include:: whatsnew/v0.9.5.rst
.. include:: whatsnew/v0.9.4.rst
Expand Down
38 changes: 8 additions & 30 deletions docs/sphinx/source/whatsnew/v0.10.1.rst
Original file line number Diff line number Diff line change
@@ -1,34 +1,12 @@
.. _whatsnew_01010:


v0.10.1 (Anticipated September, 2023)
-------------------------------------


Deprecations
~~~~~~~~~~~~


Enhancements
~~~~~~~~~~~~


Bug fixes
~~~~~~~~~


Testing
~~~~~~~


Documentation
~~~~~~~~~~~~~


Requirements
~~~~~~~~~~~~


Contributors
~~~~~~~~~~~~
v0.10.1 (July 3, 2023)
----------------------

To resolve an installation issue with ``pvfactors`` and ``shapely``,
this release drops the optional ``pvfactors`` dependency and replaces
it with ``solarfactors``, a fork of ``pvfactors`` maintained by the
pvlib community. This change should not affect any user code.
(:issue:`1796`, :pull:`1797`, :discuss:`1657`)

34 changes: 34 additions & 0 deletions docs/sphinx/source/whatsnew/v0.10.2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.. _whatsnew_01020:


v0.10.2 (Anticipated September, 2023)
-------------------------------------


Deprecations
~~~~~~~~~~~~


Enhancements
~~~~~~~~~~~~


Bug fixes
~~~~~~~~~


Testing
~~~~~~~


Documentation
~~~~~~~~~~~~~


Requirements
~~~~~~~~~~~~


Contributors
~~~~~~~~~~~~

17 changes: 11 additions & 6 deletions pvlib/bifacial/pvfactors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
The ``bifacial.pvfactors`` module contains functions for modeling back surface
plane-of-array irradiance using the pvfactors package.
plane-of-array irradiance using an external implementaton of the pvfactors
model (either ``solarfactors`` or the original ``pvfactors``).
"""

import pandas as pd
Expand All @@ -15,11 +16,15 @@ def pvfactors_timeseries(
horizon_band_angle=15.):
"""
Calculate front and back surface plane-of-array irradiance on
a fixed tilt or single-axis tracker PV array configuration, and using
the open-source "pvfactors" package. pvfactors implements the model
described in [1]_.
Please refer to pvfactors online documentation for more details:
https://sunpower.github.io/pvfactors/
a fixed tilt or single-axis tracker PV array configuration using
the pvfactors model.
The pvfactors bifacial irradiance model is described in [1]_.
.. versionchanged:: 0.10.1
It is now recommended to install the ``solarfactors`` package
(``pip install solarfactors``) instead of ``pvfactors`` for this
function. For more information, see :ref:`bifacial`.
Parameters
----------
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
'pytest-remotedata']
EXTRAS_REQUIRE = {
'optional': ['cython', 'ephem', 'nrel-pysam', 'numba',
'pvfactors', 'statsmodels'],
'solarfactors', 'statsmodels'],
'doc': ['ipython', 'matplotlib', 'sphinx == 4.5.0',
'pydata-sphinx-theme == 0.8.1', 'sphinx-gallery',
'docutils == 0.15.2', 'pillow',
'sphinx-toggleprompt >= 0.0.5', 'pvfactors'],
'sphinx-toggleprompt >= 0.0.5', 'solarfactors'],
'test': TESTS_REQUIRE
}
EXTRAS_REQUIRE['all'] = sorted(set(sum(EXTRAS_REQUIRE.values(), [])))
Expand Down

0 comments on commit c063992

Please sign in to comment.