Skip to content

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

@mikofski

Description

@mikofski

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions