undo _gettrackerangles comit
so the previous comit failed pytests. I think it's because it's working on the whole trackerlist at the same time, and my procedure assumes item by item. Have to think of a better way to solve
@@ -2181,36 +2181,11 @@ class MetObj:
datetimetz = datetime.tz_convert(pytz.FixedOffset(tz*60))
# get solar position zenith and azimuth based on site metadata
#solpos = pvlib.irradiance.solarposition.get_solarposition(datetimetz,lat,lon,elev)
+ solpos = pvlib.irradiance.solarposition.get_solarposition(datetimetz-pd.Timedelta(minutes = 30),lat,lon,elev)
- #Offset so it matches the single-axis tracking sun position calculation considering use of weather files
- interval = 60 # Using timestamp and metdata from a weather file, so interval is 60 min (1 hour)
- minutedelta = int(interval/2)
- adjusted = False
- # Sunrise/Sunset Check and adjusts position of time for that.
- sunrisesetdata= pvlib.irradiance.solarposition.get_sun_rise_set_transit(datetimetz, lat, lon)
-
- if datetimetz.hour-1 == int(sunrisesetdata['sunrise'].dt.hour):
- minutedelta = int((60-int(sunrisesetdata['sunrise'].dt.minute))/2)
- adjusted = True
- if debug2 is True:
- print("Adjusting solarposition for sunrise hour, %i timeindex" % (timeindex))
-
- if datetimetz.hour-1 == int(sunrisesetdata['sunset'].dt.hour):
- minutedelta = int(60-int(sunrisesetdata['sunset'].dt.minute)/2)
- adjusted = True
- if debug2 is True:
- print("Adjusting solarposition for sunset hour, %i timeindex" % (timeindex))
-
- datetimetz=datetimetz-pd.Timedelta(minutes = minutedelta)
-
- if debug2 is True and adjusted is True:
- print ("Original datetime %s" % (metdata.datetime[timeindex]))
- print ("Localized and adjusted datetime %s \n" % (datetimetz))
# get solar position zenith and azimuth based on site metadata
#solpos = pvlib.irradiance.solarposition.get_solarposition(datetimetz,lat,lon,elev)
- solpos = pvlib.irradiance.solarposition.get_solarposition(datetimetz,lat,lon,elev)
-
self.solpos = solpos # save solar position for each timestamp
# get 1-axis tracker tracker_theta, surface_tilt and surface_azimuth
trackingdata = pvlib.tracking.singleaxis(solpos['zenith'], solpos['azimuth'], axis_tilt, axis_azimuth, limit_angle, backtrack, gcr)
@@ -2219,7 +2194,7 @@ class MetObj:
self.surface_tilt = trackingdata['surface_tilt'].tolist()
self.surface_azimuth = trackingdata['surface_azimuth'].tolist()
# undo the 30 minute timestamp offset put in by solpos
- trackingdata.index = trackingdata.index + pd.Timedelta(minutes = minutedelta)
+ trackingdata.index = trackingdata.index + pd.Timedelta(minutes = 30)
# round tracker_theta to increments of angledelta
