Newbie with pvlib: doubt about timezone and get_solarposition

104 views
Skip to first unread message

Michele Bertoni

unread,
Nov 24, 2023, 5:53:18 AM11/24/23
to pvlib-python
Hi to all, I am newbie with pvliv and I am starting with some experiments...

I am checking some examples I've found online using pvliv and I am collecting mismatching results:

I set timezone to work with UTC (to avoid misunderstandings about times and timezones) and coordinates but I get wrong results.
Here my code:


import pandas as pd
from pvlib import solarposition, tracking, location
import numpy as np
import matplotlib.pyplot as plt
import sys
import pytz

tz = pytz.timezone('UTC')
# Fednet GPS station UD2
lat = 46.037315
lon = 13.253032
alt = 149.249

times = pd.date_range("2023-11-24", "2023-11-25", freq="30min", tz=tz)
solpos = solarposition.get_solarposition(times, lat, lon)
print(solpos)


At 10:30 (UTC) sun is at azimuth 187° (shoulders to north, looking to south, sun is on my right side) while pvlib tells me azimut should be at 174°, so on my left.

What's wrong?
Thanks.




kevina...@gmail.com

unread,
Nov 24, 2023, 8:56:37 AM11/24/23
to pvlib-python
I don't think I understand the question; how can 187 and 174 degrees be in opposite directions?  

pvlib's azimuth convention is north=0, east=90, south=180, west=270.  Perhaps that helps?

Best,
Kevin

kevina...@gmail.com

unread,
Nov 24, 2023, 9:17:36 AM11/24/23
to pvlib-python
My apologies, I guess you meant that it is in the left/right halves of the sky, but in either case it is close to due south. 

I notice one hour later in the pvlib azimuth output is 189 degrees, very close to your observed 187 degrees, and Italy is one hour from UTC this time of year.  Perhaps there is an error in converting the local time to UTC?

The only other things that come to mind are that the supplied coordinates are incorrect, or that there is a ~13 degree offset in your estimate of the actual sun azimuth (maybe south is not exactly where you thought it was?).

Best,
Kevin
Reply all
Reply to author
Forward
0 new messages