-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add tests for time conversions in tools package #2341
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
Changes from 19 commits
9347f12
0638773
c1df9a7
77c0f81
6704d06
dbb1805
6750709
1144106
14715ed
545c196
271fd97
01263c2
60a5d94
9ab2ecf
ddef8d1
4f17f49
a3c3e03
5f59417
c84801f
195efbc
1a5efed
e5af9ae
67e9844
e35eb42
a1a0261
8373ac4
eee6f51
9662c1f
32284ba
01e4cfc
c09a328
4ef4b69
7490792
a5f7646
1382e30
059e35f
f9f07d7
75db2aa
1164c96
5f6ad14
f691bb6
7cfb170
ef5c60f
c96c018
5d4be75
5d5e553
6d83e16
d26204f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -12,12 +12,21 @@ Enhancements | |||||
~~~~~~~~~~~~ | ||||||
|
||||||
|
||||||
Bug Fixes | ||||||
~~~~~~~~~ | ||||||
* Ensure proper tz and pytz types in pvlib.location.Location. | ||||||
(:issue:`2340`, :pull:`2341`) | ||||||
|
||||||
|
||||||
Documentation | ||||||
~~~~~~~~~~~~~ | ||||||
|
||||||
|
||||||
Testing | ||||||
~~~~~~~ | ||||||
* Add tests for timezone types in pvlib.location.Location. | ||||||
(:issue:`2340`, :pull:`2341`) | ||||||
* Add tests for time conversions in pvlib.tools. (:issue:`2340`, :pull:`2341`) | ||||||
|
* Add tests for time conversions in pvlib.tools. (:issue:`2340`, :pull:`2341`) | |
* Add tests for time conversion functions in pvlib.tools. (:issue:`2340`, :pull:`2341`) |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Mark Campanellli (:ghuser:`markcampanelli`) | |
* Mark Campanelli (:ghuser:`markcampanelli`) |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -18,13 +18,15 @@ | |||||||||
class Location: | ||||||||||
""" | ||||||||||
Location objects are convenient containers for latitude, longitude, | ||||||||||
timezone, and altitude data associated with a particular | ||||||||||
geographic location. You can also assign a name to a location object. | ||||||||||
time zone, and altitude data associated with a particular geographic | ||||||||||
location. You can also assign a name to a location object. | ||||||||||
|
||||||||||
Location objects have two timezone attributes: | ||||||||||
Location objects have two time-zone attributes, either of which can be | ||||||||||
individually changed after the Location object has been instantiated and | ||||||||||
the other will stay in sync: | ||||||||||
|
||||||||||
* ``tz`` is a IANA timezone string. | ||||||||||
* ``pytz`` is a pytz timezone object. | ||||||||||
* ``tz`` is a IANA time-zone string. | ||||||||||
* ``pytz`` is a pytz time-zone object. | ||||||||||
|
||||||||||
Location objects support the print method. | ||||||||||
|
||||||||||
|
@@ -38,12 +40,16 @@ class Location: | |||||||||
Positive is east of the prime meridian. | ||||||||||
Use decimal degrees notation. | ||||||||||
|
||||||||||
tz : str, int, float, or pytz.timezone, default 'UTC'. | ||||||||||
See | ||||||||||
http://en.wikipedia.org/wiki/List_of_tz_database_time_zones | ||||||||||
for a list of valid time zones. | ||||||||||
pytz.timezone objects will be converted to strings. | ||||||||||
ints and floats must be in hours from UTC. | ||||||||||
tz : time zone as str, int, float, or datetime.tzinfo (inc. subclasses | ||||||||||
from the pytz and zoneinfo packages), default 'UTC'. | ||||||||||
See http://en.wikipedia.org/wiki/List_of_tz_database_time_zones for a | ||||||||||
list of valid name strings for IANA time zones. | ||||||||||
ints and floats must be non-fractional N-hour offsets from UTC, which | ||||||||||
|
ints and floats must be non-fractional N-hour offsets from UTC, which | |
ints and floats must be whole number hour offsets from UTC, which |
cwhanse marked this conversation as resolved.
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"floating point tz does not have zero fractional part: " | |
f"{tz_}" | |
"floating point tz has non-zero fractional part: " | |
f"{tz_}. Only whole number offsets are supported." |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"string, a non-fractional int/float UTC offset, or a " | |
"string, a whole number int/float UTC offset, or a " |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -119,21 +119,21 @@ def atand(number): | |||||
|
||||||
def localize_to_utc(time, location): | ||||||
""" | ||||||
Converts or localizes a time series to UTC. | ||||||
Converts time to UTC, localizing if necessary using location. | ||||||
|
Converts time to UTC, localizing if necessary using location. | |
Converts ``time`` to UTC, localizing if necessary using location. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
location : pvlib.Location object (unused if time is localized) | |
location : pvlib.Location object (unused if ``time`` is localized) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.