99import zoneinfo
1010
1111import pandas as pd
12- import pytz
1312import h5py
1413
1514from pvlib import solarposition , clearsky , atmosphere , irradiance
@@ -22,13 +21,11 @@ class Location:
2221 time zone, and altitude data associated with a particular geographic
2322 location. You can also assign a name to a location object.
2423
25- Location objects have two time-zone attributes :
24+ Location objects have a time-zone attribute :
2625
2726 * ``tz`` is an IANA time-zone string.
28- * ``pytz`` is a pytz-based time-zone object (read only).
2927
30- The read-only ``pytz`` attribute will stay in sync with any changes made
31- using ``tz``.
28+ The ``pytz`` attribute was removed. Use ``tz`` property instead.
3229
3330 Location objects support the print method.
3431
@@ -47,8 +44,8 @@ class Location:
4744 list of valid name strings. An `int` or `float` must be a whole-number
4845 hour offsets from UTC that can be converted to the IANA-supported
4946 'Etc/GMT-N' format. (Note the limited range of the offset N and its
50- sign-change convention.) Time zones from the pytz and zoneinfo packages
51- may also be passed here, as they are subclasses of datetime.tzinfo .
47+ sign-change convention.) Time zones from the zoneinfo packages may also
48+ be passed here.
5249
5350 The `tz` attribute is represented as a valid IANA time zone name
5451 string.
@@ -108,17 +105,19 @@ def tz(self, tz_):
108105 if isinstance (tz_ , str ):
109106 self ._zoneinfo = zoneinfo .ZoneInfo (tz_ )
110107 elif isinstance (tz_ , int ):
111- self ._zoneinfo = zoneinfo .ZoneInfo (f"Etc/GMT{ - tz_ :+d} " )
108+ tz_str = f"Etc/GMT{ - tz_ :+d} " # noqa: E231
109+ self ._zoneinfo = zoneinfo .ZoneInfo (tz_str )
112110 elif isinstance (tz_ , float ):
113111 if tz_ % 1 != 0 :
114112 raise TypeError (
115113 "Floating-point tz has non-zero fractional part: "
116114 f"{ tz_ } . Only whole-number offsets are supported."
117115 )
118116
119- self ._zoneinfo = zoneinfo .ZoneInfo (f"Etc/GMT{ - int (tz_ ):+d} " )
117+ tz_str = f"Etc/GMT{ - int (tz_ ):+d} " # noqa: E231
118+ self ._zoneinfo = zoneinfo .ZoneInfo (tz_str )
120119 elif isinstance (tz_ , datetime .tzinfo ):
121- # Includes time zones generated by pytz and zoneinfo packages.
120+ # Includes time zones generated by zoneinfo packages.
122121 self ._zoneinfo = zoneinfo .ZoneInfo (str (tz_ ))
123122 else :
124123 raise TypeError (
@@ -127,11 +126,6 @@ def tz(self, tz_):
127126 "datetime.tzinfo object (including subclasses)"
128127 )
129128
130- @property
131- def pytz (self ):
132- """The location's pytz time zone (read only)."""
133- return pytz .timezone (str (self ._zoneinfo ))
134-
135129 @classmethod
136130 def from_tmy (cls , tmy_metadata , tmy_data = None , ** kwargs ):
137131 """
0 commit comments