Skip to content
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
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pvlib/version.py export-subst

# reduce the number of merge conflicts
docs/sphinx/source/whatsnew/v*.txt merge=union
docs/sphinx/source/whatsnew/* merge=union
4 changes: 2 additions & 2 deletions docs/sphinx/source/variables_style_rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ There is a convention on consistent variable names throughout the library:
For a definition and further explanation on the variables, common symbols and units refer to the following sources:


* `Reference Variable List by PVPMC <https://pvpmc.sandia.gov/resources/variable-list/>`_
* `IEC 61724:1998 -- Photovoltaic system performance monitoring - Guidelines for measurement, data exchange and analysis <https://webstore.iec.ch/publication/5733>`_ ; the Indian Standard referencing the global IEC standard is available online: `IS/IEC 61724 (1998) <https://law.resource.org/pub/in/bis/S05/is.iec.61724.1998.pdf>`_
* `Reference Variable List by PVPMC <https://pvpmc.sandia.gov/resources-and-events/variable-list/>`_
* `IEC 61724-1:2017 -- Photovoltaic system performance - Part 1: Monitoring <https://webstore.iec.ch/publication/33622>`_ section: 3 -- Terms and definitions; the Indian Standard referencing the withdrawn earlier global IEC standard IEC 61724:1998 is available online: `IS/IEC 61724 (1998) <https://archive.org/details/gov.in.is.iec.61724.1998>`_ and can provide relevant contents.
* Explanation of Solar irradiation and solar geometry by `SoDa Service <http://www.soda-pro.com/home>`_

* `Acronyms, Terminology and Units <http://www.soda-pro.com/help/general/acronyms-terminology-and-units>`_
Expand Down
9 changes: 9 additions & 0 deletions docs/sphinx/source/whatsnew/v0.5.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ Bug fixes
* Remove condition causing Overflow warning from clearsky.haurwitz
* modelchain.basic_chain now correctly passes 'solar_position_method'
arg to solarposition.get_solarposition
* Fixed: `Variables and Symbols extra references not available <https://github.com/pvlib/pvlib-python/issues/380>`_
* Removed unnecessary calculations of alpha_prime in spa.solar_position_numpy
and spa.solar_position_loop
* Fixed args mismatch for solarposition.pyephem call
from solarposition.get_solarposition with method='pyephem'
arg to solarposition.get_solarposition (:issue:`370`)
* ModelChain.prepare_inputs and ModelChain.complete_irradiance now
correctly pass the 'solar_position_method' argument to
solarposition.get_solarposition (:issue:`377`)

Enhancements
~~~~~~~~~~~~
Expand Down
10 changes: 7 additions & 3 deletions pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,8 @@ def complete_irradiance(self, times=None, weather=None):
self.weather = weather
if times is not None:
self.times = times
self.solar_position = self.location.get_solarposition(self.times)
self.solar_position = self.location.get_solarposition(
self.times, method=self.solar_position_method)
icolumns = set(self.weather.columns)
wrn_txt = ("This function is not safe at the moment.\n" +
"Results can be too high or negative.\n" +
Expand All @@ -683,10 +684,12 @@ def complete_irradiance(self, times=None, weather=None):

if {'ghi', 'dhi'} <= icolumns and 'dni' not in icolumns:
logging.debug('Estimate dni from ghi and dhi')
clearsky = self.location.get_clearsky(
times, solar_position=self.solar_position)
self.weather.loc[:, 'dni'] = pvlib.irradiance.dni(
self.weather.loc[:, 'ghi'], self.weather.loc[:, 'dhi'],
self.solar_position.zenith,
clearsky_dni=self.location.get_clearsky(times).dni,
clearsky_dni=clearsky['dni'],
clearsky_tolerance=1.1)
elif {'dni', 'dhi'} <= icolumns and 'ghi' not in icolumns:
warnings.warn(wrn_txt, UserWarning)
Expand Down Expand Up @@ -753,7 +756,8 @@ def prepare_inputs(self, times=None, irradiance=None, weather=None):
if times is not None:
self.times = times

self.solar_position = self.location.get_solarposition(self.times)
self.solar_position = self.location.get_solarposition(
self.times, method=self.solar_position_method)

self.airmass = self.location.get_airmass(
solar_position=self.solar_position, model=self.airmass_model)
Expand Down
6 changes: 4 additions & 2 deletions pvlib/solarposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ def get_solarposition(time, latitude, longitude,
pressure, temperature,
how='numpy', **kwargs)
elif method == 'pyephem':
ephem_df = pyephem(time, latitude, longitude, pressure, temperature,
**kwargs)
ephem_df = pyephem(time, latitude, longitude,
altitude=altitude,
pressure=pressure,
temperature=temperature, **kwargs)
elif method == 'ephemeris':
ephem_df = ephemeris(time, latitude, longitude, pressure, temperature,
**kwargs)
Expand Down
2 changes: 0 additions & 2 deletions pvlib/spa.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,6 @@ def solar_position_loop(unixtime, loc_args, out):
x = xterm(u, lat, elev)
y = yterm(u, lat, elev)
delta_alpha = parallax_sun_right_ascension(x, xi, H, delta)
alpha_prime = topocentric_sun_right_ascension(alpha, delta_alpha)
delta_prime = topocentric_sun_declination(delta, x, y, xi, delta_alpha,
H)
H_prime = topocentric_local_hour_angle(H, delta_alpha)
Expand Down Expand Up @@ -1064,7 +1063,6 @@ def solar_position_numpy(unixtime, lat, lon, elev, pressure, temp, delta_t,
x = xterm(u, lat, elev)
y = yterm(u, lat, elev)
delta_alpha = parallax_sun_right_ascension(x, xi, H, delta)
alpha_prime = topocentric_sun_right_ascension(alpha, delta_alpha)
delta_prime = topocentric_sun_declination(delta, x, y, xi, delta_alpha, H)
H_prime = topocentric_local_hour_angle(H, delta_alpha)
e0 = topocentric_elevation_angle_without_atmosphere(lat, delta_prime,
Expand Down
13 changes: 13 additions & 0 deletions pvlib/test/test_solarposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,19 @@ def test_get_solarposition_no_kwargs(expected_solpos):
assert_frame_equal(expected_solpos, ephem_data[expected_solpos.columns])


@requires_ephem
def test_get_solarposition_method_pyephem(expected_solpos):
times = pd.date_range(datetime.datetime(2003, 10, 17, 13, 30, 30),
periods=1, freq='D', tz=golden.tz)
ephem_data = solarposition.get_solarposition(times, golden.latitude,
golden.longitude,
method='pyephem')
expected_solpos.index = times
expected_solpos = np.round(expected_solpos, 2)
ephem_data = np.round(ephem_data, 2)
assert_frame_equal(expected_solpos, ephem_data[expected_solpos.columns])


def test_nrel_earthsun_distance():
times = pd.DatetimeIndex([datetime.datetime(2015, 1, 2),
datetime.datetime(2015, 8, 2),]
Expand Down