Quick question about pvlib.iotools.get_pvgis_tmy()

107 views
Skip to first unread message

steve idowu

unread,
Apr 1, 2024, 11:27:55 AM4/1/24
to pvlib-python
Hello all,
I am relatively new to pvlib/python and making good progress on some modeling exercises for a class at the University of Toledo.

I have encountered something I think should be easy to resolve: 

When I load TMY3 data using this command 'pvlib.iotools.get_pvgis_tmy(latitude, longitude)[0]', the weather data index shows UTC instead of local time.

Could someone please advise on an easy way to convert the index to the local time zone?

Steve.

cwh...@sandia.gov

unread,
Apr 1, 2024, 11:39:53 AM4/1/24
to pvlib-python
Use the pytz package to find the string for your timezone, then use pandas .tz_localize to set the timezone as desired.

steve idowu

unread,
Apr 1, 2024, 7:58:40 PM4/1/24
to pvlib-python
Thank you, I will give it a shot.

Saurabh Aneja

unread,
Apr 2, 2024, 2:53:07 PM4/2/24
to pvlib-python
Hey Steve, I have had some fun learning-issues myself when I was learning this function. You will find that for a given location, the function may/will return different year-values for the individual months (as this makes sense given a TMY). If you need to get around this, and need a consistent 8760 dataset to work with, here is a little function (with guidance from a maintainer). It basically does the time-zone conversion from GMT, and then manually writes over any values that were pushed or pulled into a different year. If then simply sorts the index again to have a nice fun 8760.

Hope this helps, and/or that my explanation is clear (and forgive the screenshot, I need to learn formatting).

Saurabh
Picture1.jpg
Reply all
Reply to author
Forward
0 new messages