Skip to content

Unresolved attribute used in "SingleAxisTracker" #337

Closed

Description

@uvchik

I do not use tracking but working on PR330 it seems to me that there is something wrong.

https://github.com/pvlib/pvlib-python/blob/master/pvlib/tracking.py#L113

try:
   solar_zenith = kwargs['solar_zenith']
except KeyError:
    solar_zenith = self.solar_zenith

First of all one can simply write: solar_zenith = kwargs.get('solar_zenith', self.solar_zenith').

But at the moment the solar_zenith is neither an attribute of the class nor of the parent class. Furthermore the solar_zenith (apparent_zenith) is not obligate, but I should be. So we should change it to something like this:

- def get_irradiance(self, dni, ghi, dhi,
-                    dni_extra=None, airmass=None, model='haydavies',
-                    **kwargs):
+ def get_irradiance(self, dni, ghi, dhi, solar_zenith, solar_azimuth,
+                    dni_extra=None, airmass=None, model='haydavies',
+                    **kwargs):
-    try:
-        solar_zenith = kwargs['solar_zenith']
-    except KeyError:
-        solar_zenith = self.solar_zenith

To me it seems to be some kind of relict because according to the docstrings the zenith parameter is obligate.

You will find the same issue for the azimuth angle.

I think it is not urgent, because most users will understand that they have to pass zenith and azimuth to get the total irradiation and I will not have the time to write the according tests.

Maybe somebody who works with tracking may want to bring that in line.

Activity

  1. added this to the 0.5.0 milestone on Jun 12, 2017
  2. wholmgren commented on Jul 24, 2017

    @wholmgren
    Member

    This is closely related to #351. I think the function signature should include the surface tilt & azimuth and the solar zenith & azimuth angles, then we can get rid of the inappropriate attribute nonsense.

    Yes, it is a relic from when I was trying to figure out the scope and API of these classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions