Skip to content

Unresolved attribute used in "SingleAxisTracker" #337

@uvchik

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.

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