Skip to content

Commit fe06ece

Browse files
committed
fix: replace deprecated IANA timezone aliases with canonical names
1 parent 8e1b87b commit fe06ece

19 files changed

Lines changed: 110 additions & 34 deletions

docs/examples/irradiance-transposition/plot_ghi_transposition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from matplotlib import pyplot as plt
1919

2020
# For this example, we will be using Golden, Colorado
21-
tz = 'MST'
21+
tz = 'America/Phoenix'
2222
lat, lon = 39.755, -105.221
2323

2424
# Create location object to store lat, lon, timezone

docs/examples/shading/plot_simple_irradiance_adjustment_for_horizon_shading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
# Golden, CO
2525
latitude, longitude = 39.76, -105.22
26-
tz = 'MST'
26+
tz = 'America/Phoenix'
2727

2828
# Set times in the morning of the December solstice.
2929
times = pd.date_range(

docs/examples/solar-position/plot_sunpath_diagrams.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import numpy as np
2222
import matplotlib.pyplot as plt
2323

24-
tz = 'Asia/Calcutta'
24+
tz = 'Asia/Kolkata'
2525
lat, lon = 28.6, 77.2
2626

2727
times = pd.date_range('2019-01-01 00:00:00', '2020-01-01', freq='h', tz=tz)
@@ -110,7 +110,7 @@
110110
import numpy as np
111111
import matplotlib.pyplot as plt
112112

113-
tz = 'Asia/Calcutta'
113+
tz = 'Asia/Kolkata'
114114
lat, lon = 28.6, 77.2
115115
times = pd.date_range('2019-01-01 00:00:00', '2020-01-01', freq='h', tz=tz)
116116

docs/examples/solar-tracking/plot_discontinuous_tracking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def get_orientation(self, solar_zenith, solar_azimuth):
5050
# %%
5151
# Let's take a look at the tracker rotation curve it produces:
5252

53-
times = pd.date_range('2019-06-01', '2019-06-02', freq='1min', tz='US/Eastern')
53+
times = pd.date_range('2019-06-01', '2019-06-02', freq='1min', tz='America/New_York')
5454
loc = location.Location(40, -80)
5555
solpos = loc.get_solarposition(times)
5656
mount = DiscontinuousTrackerMount(axis_azimuth=180, gcr=0.4)

docs/examples/solar-tracking/plot_single_axis_tracking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import pandas as pd
2525
import matplotlib.pyplot as plt
2626

27-
tz = 'US/Eastern'
27+
tz = 'America/New_York'
2828
lat, lon = 40, -80
2929

3030
times = pd.date_range('2019-01-01', '2019-01-02', freq='5min',

docs/examples/solar-tracking/plot_single_axis_tracking_on_sloped_terrain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
import matplotlib.pyplot as plt
8787

8888
# PV system parameters
89-
tz = 'US/Eastern'
89+
tz = 'America/New_York'
9090
lat, lon = 40, -80
9191
gcr = 0.4
9292

docs/examples/system-models/oedi_9068.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229

230230
fn = r"path/to/9068_ac_power_data.csv"
231231
df_inverter_measured = pd.read_csv(fn, index_col=0, parse_dates=True)
232-
df_inverter_measured = df_inverter_measured.tz_localize('US/Mountain',
232+
df_inverter_measured = df_inverter_measured.tz_localize('America/Denver',
233233
ambiguous='NaT',
234234
nonexistent='NaT')
235235
# convert to standard time to match the NSRDB-based simulation

docs/sphinx/source/user_guide/modeling_topics/clearsky.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ returns a :py:class:`pandas.DataFrame`.
6666

6767
.. ipython::
6868

69-
In [1]: tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
69+
In [1]: tus = Location(32.2, -111, 'America/Phoenix', 700, 'Tucson')
7070

7171
In [1]: times = pd.date_range(start='2016-07-01', end='2016-07-04', freq='1min', tz=tus.tz)
7272

@@ -264,7 +264,7 @@ A clear sky time series using only basic pvlib functions.
264264

265265
.. ipython::
266266

267-
In [1]: latitude, longitude, tz, altitude, name = 32.2, -111, 'US/Arizona', 700, 'Tucson'
267+
In [1]: latitude, longitude, tz, altitude, name = 32.2, -111, 'America/Phoenix', 700, 'Tucson'
268268

269269
In [1]: times = pd.date_range(start='2014-01-01', end='2014-01-02', freq='1Min', tz=tz)
270270

@@ -404,7 +404,7 @@ A clear sky time series using only basic pvlib functions.
404404

405405
.. ipython::
406406

407-
In [1]: latitude, longitude, tz, altitude, name = 32.2, -111, 'US/Arizona', 700, 'Tucson'
407+
In [1]: latitude, longitude, tz, altitude, name = 32.2, -111, 'America/Phoenix', 700, 'Tucson'
408408

409409
In [1]: times = pd.date_range(start='2014-01-01', end='2014-01-02', freq='1Min', tz=tz)
410410

docs/sphinx/source/user_guide/modeling_topics/modelchain.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Next, we run a model with some simple weather data.
7878
7979
weather = pd.DataFrame([[1050, 1000, 100, 30, 5]],
8080
columns=['ghi', 'dni', 'dhi', 'temp_air', 'wind_speed'],
81-
index=[pd.Timestamp('20170401 1200', tz='US/Arizona')])
81+
index=[pd.Timestamp('20170401 1200', tz='America/Phoenix')])
8282
8383
mc.run_model(weather)
8484

docs/sphinx/source/user_guide/modeling_topics/timetimezones.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ And you can also filter for GMT-based fixed offset zones:
6060
6161
sorted(filter(lambda x: 'GMT' in x, zoneinfo.available_timezones()))
6262
63-
Note that while the IANA database has ``'EST'`` and ``'MST'``, it does not have
63+
Note that while the IANA database has ``'EST'`` and ``'America/Phoenix'``, it does not have
6464
``'PST'``. Use ``'Etc/GMT+8'`` instead, or see :ref:`fixedoffsets`.
6565

6666
Timestamps
@@ -109,21 +109,21 @@ Daylight savings time
109109
*********************
110110

111111
Some time zones are aware of daylight savings time and some are not. For
112-
example the winter time results are the same for US/Mountain and MST,
112+
example the winter time results are the same for America/Denver and MST,
113113
but the summer time results are not.
114114

115115
Note the UTC offset in winter...
116116

117117
.. ipython:: python
118118
119-
pd.Timestamp('2015-1-1 00:00').tz_localize('US/Mountain')
119+
pd.Timestamp('2015-1-1 00:00').tz_localize('America/Denver')
120120
pd.Timestamp('2015-1-1 00:00').tz_localize('Etc/GMT+7')
121121
122122
vs. the UTC offset in summer...
123123

124124
.. ipython:: python
125125
126-
pd.Timestamp('2015-6-1 00:00').tz_localize('US/Mountain')
126+
pd.Timestamp('2015-6-1 00:00').tz_localize('America/Denver')
127127
pd.Timestamp('2015-6-1 00:00').tz_localize('Etc/GMT+7')
128128
129129
pandas makes this time zone handling possible because pandas
@@ -140,8 +140,8 @@ will use the same integer to represent them.
140140

141141
.. ipython:: python
142142
143-
# US/Mountain
144-
pd.Timestamp('2015-6-1 01:00', tz='US/Mountain').value
143+
# America/Denver
144+
pd.Timestamp('2015-6-1 01:00', tz='America/Denver').value
145145
146146
# MST
147147
pd.Timestamp('2015-6-1 00:00', tz='Etc/GMT+7').value
@@ -219,7 +219,7 @@ expected.
219219
pd.Timestamp(naive_python_dt)
220220
221221
# tz aware python datetime.datetime object using zoneinfo
222-
aware_python_dt = naive_python_dt.replace(tzinfo=zoneinfo.ZoneInfo('US/Mountain'))
222+
aware_python_dt = naive_python_dt.replace(tzinfo=zoneinfo.ZoneInfo('America/Denver'))
223223
224224
# tz aware pandas Timestamp object
225225
pd.Timestamp(aware_python_dt)
@@ -243,7 +243,7 @@ convert it to a :py:class:`python:datetime.datetime`.
243243
:okexcept:
244244
245245
# fail: datetime.date has no tzinfo support via replace
246-
naive_python_date.replace(tzinfo=zoneinfo.ZoneInfo('US/Mountain'))
246+
naive_python_date.replace(tzinfo=zoneinfo.ZoneInfo('America/Denver'))
247247
248248
249249
pvlib-specific functionality

0 commit comments

Comments
 (0)