Skip to content

update "package overview" to use UTC or localized time only (v0.3.0) #156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mikofski opened this issue May 5, 2016 · 1 comment · Fixed by #162
Closed

update "package overview" to use UTC or localized time only (v0.3.0) #156

mikofski opened this issue May 5, 2016 · 1 comment · Fixed by #162
Milestone

Comments

@mikofski
Copy link
Member

mikofski commented May 5, 2016

in the documentation for pvlib-0.3.2 the package overview still uses naive times:

In [5]: times = pd.DatetimeIndex(start='2015', end='2016', freq='1h')

Following the remainder of the package overview yields clear sky conditions for Tuscon that are shifted because UTC time is assumed instead of Mountain (UTC-0700) for Tuscon, AZ:

                            dhi         dni         ghi
2015-01-01 00:00:00   34.953032  192.253259   52.216282
2015-01-01 01:00:00    0.000000    0.000000    0.000000
2015-01-01 02:00:00    0.000000    0.000000    0.000000
2015-01-01 03:00:00    0.000000    0.000000    0.000000
2015-01-01 04:00:00    0.000000    0.000000    0.000000
2015-01-01 05:00:00    0.000000    0.000000    0.000000
2015-01-01 06:00:00    0.000000    0.000000    0.000000
2015-01-01 07:00:00    0.000000    0.000000    0.000000
2015-01-01 08:00:00    0.000000    0.000000    0.000000
2015-01-01 09:00:00    0.000000    0.000000    0.000000
2015-01-01 10:00:00    0.000000    0.000000    0.000000
2015-01-01 11:00:00    0.000000    0.000000    0.000000
2015-01-01 12:00:00    0.000000    0.000000    0.000000
2015-01-01 13:00:00    0.000000    0.000000    0.000000
2015-01-01 14:00:00    0.000000    0.000000    0.000000
2015-01-01 15:00:00   45.561471  319.726178   87.899467
2015-01-01 16:00:00   72.842756  657.165518  275.613415
2015-01-01 17:00:00   88.224503  790.722174  444.994415
2015-01-01 18:00:00   97.867156  850.448564  565.631525
2015-01-01 19:00:00  102.416226  873.616029  625.010822
2015-01-01 20:00:00  101.874240  871.001767  617.869572
2015-01-01 21:00:00   96.247097  841.484912  544.819744
2015-01-01 22:00:00   85.490429  770.707743  412.458359
2015-01-01 23:00:00   68.537323  610.365846  235.460436
2015-01-02 00:00:00   35.629743  200.992987   54.141994
2015-01-02 01:00:00    0.000000    0.000000    0.000000
2015-01-02 02:00:00    0.000000    0.000000    0.000000
2015-01-02 03:00:00    0.000000    0.000000    0.000000
2015-01-02 04:00:00    0.000000    0.000000    0.000000
2015-01-02 05:00:00    0.000000    0.000000    0.000000

Since v0.3.0, UTC or localized times are required.

Updating the times with the correct time zone:

import pytz
times = pd.DatetimeIndex(start='2015', end='2016', freq='1h', tz=pytz.timezone('US/Mountain'))

now yields

                                  dhi         dni         ghi
2015-01-01 00:00:00-07:00    0.000000    0.000000    0.000000
2015-01-01 01:00:00-07:00    0.000000    0.000000    0.000000
2015-01-01 02:00:00-07:00    0.000000    0.000000    0.000000
2015-01-01 03:00:00-07:00    0.000000    0.000000    0.000000
2015-01-01 04:00:00-07:00    0.000000    0.000000    0.000000
2015-01-01 05:00:00-07:00    0.000000    0.000000    0.000000
2015-01-01 06:00:00-07:00    0.000000    0.000000    0.000000
2015-01-01 07:00:00-07:00    0.000000    0.000000    0.000000
2015-01-01 08:00:00-07:00   45.561471  319.726178   87.899467
2015-01-01 09:00:00-07:00   72.842756  657.165518  275.613415
2015-01-01 10:00:00-07:00   88.224503  790.722174  444.994415
2015-01-01 11:00:00-07:00   97.867156  850.448564  565.631525
2015-01-01 12:00:00-07:00  102.416226  873.616029  625.010822
2015-01-01 13:00:00-07:00  101.874240  871.001767  617.869572
2015-01-01 14:00:00-07:00   96.247097  841.484912  544.819744
2015-01-01 15:00:00-07:00   85.490429  770.707743  412.458359
2015-01-01 16:00:00-07:00   68.537323  610.365846  235.460436
2015-01-01 17:00:00-07:00   35.596019  199.416149   53.963036
2015-01-01 18:00:00-07:00    0.000000    0.000000    0.000000
2015-01-01 19:00:00-07:00    0.000000    0.000000    0.000000
2015-01-01 20:00:00-07:00    0.000000    0.000000    0.000000
2015-01-01 21:00:00-07:00    0.000000    0.000000    0.000000
2015-01-01 22:00:00-07:00    0.000000    0.000000    0.000000
2015-01-01 23:00:00-07:00    0.000000    0.000000    0.000000
2015-01-02 00:00:00-07:00    0.000000    0.000000    0.000000
2015-01-02 01:00:00-07:00    0.000000    0.000000    0.000000
2015-01-02 02:00:00-07:00    0.000000    0.000000    0.000000
2015-01-02 03:00:00-07:00    0.000000    0.000000    0.000000
2015-01-02 04:00:00-07:00    0.000000    0.000000    0.000000
2015-01-02 05:00:00-07:00    0.000000    0.000000    0.000000
@wholmgren
Copy link
Member

Thanks for pointing this out. PR welcome, though it's easy for me to change too. Could use this an example for the Santa Clara workshop.

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

Successfully merging a pull request may close this issue.

2 participants