Skip to content

Commit c3feac7

Browse files
author
Fraser Greenroyd
authored
Fixed deprecation warnings for python unit tests (#209)
2 parents 4cbc5d3 + 14d2a57 commit c3feac7

10 files changed

Lines changed: 15 additions & 15 deletions

File tree

LadybugTools_Engine/Python/src/ladybugtools_toolkit/external_comfort/shelter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def shelter(self, northern_hemisphere: bool = True) -> Shelter:
5050
) as fp:
5151
tree_config = json.load(fp)[self.name]
5252

53-
idx = pd.date_range("2017-01-01", periods=8760, freq="60T")
53+
idx = pd.date_range("2017-01-01", periods=8760, freq="60min")
5454
if tree_config["deciduous"]:
5555
vals = np.stack(
5656
[

LadybugTools_Engine/Python/src/ladybugtools_toolkit/ladybug_extension/datacollection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def to_hourly(
440440

441441
series = collection_to_series(collection)
442442
annual_hourly_index = pd.date_range(
443-
f"{series.index[0].year}-01-01", periods=8760, freq="H"
443+
f"{series.index[0].year}-01-01", periods=8760, freq="h"
444444
)
445445
series_annual = series.reindex(annual_hourly_index)
446446
series_annual[series_annual.index[-1]] = series_annual[series_annual.index[0]]

LadybugTools_Engine/Python/src/ladybugtools_toolkit/ladybug_extension/epw.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,12 +1074,12 @@ def seasonality_from_temperature_timeseries(
10741074
dbt.drop((2, 29), axis=0, inplace=True)
10751075
except KeyError:
10761076
pass
1077-
dbt.index = pd.date_range("2017-01-01 00:00:00", freq="60T", periods=8760)
1077+
dbt.index = pd.date_range("2017-01-01 00:00:00", freq="60min", periods=8760)
10781078
dbt.name = "dbt"
10791079

10801080
# prepare a 3-year dataset using the aggregate year from the input data and drop leap days if included
10811081
dbt_3year = pd.Series(
1082-
index=pd.date_range("2016-01-01 00:00:00", freq="60T", periods=len(dbt) * 3),
1082+
index=pd.date_range("2016-01-01 00:00:00", freq="60min", periods=len(dbt) * 3),
10831083
data=np.array([[i] * 3 for i in dbt.values]).T.flatten(),
10841084
)
10851085

@@ -1709,7 +1709,7 @@ def longest_day(epw: EPW) -> datetime:
17091709
The longest day in the year associated with this epw object."""
17101710

17111711
sunpath = Sunpath.from_location(epw.location)
1712-
idx = pd.date_range("2017-01-01 00:00:00", "2018-01-01 00:00:00", freq="1T")
1712+
idx = pd.date_range("2017-01-01 00:00:00", "2018-01-01 00:00:00", freq="1min")
17131713
suns = [sunpath.calculate_sun_from_date_time(i) for i in idx][:-1]
17141714

17151715
s = pd.Series([i.altitude for i in suns], index=idx[:-1])
@@ -1722,7 +1722,7 @@ def shortest_day(epw: EPW) -> datetime:
17221722
The shortest day in the year associated with this epw object."""
17231723

17241724
sunpath = Sunpath.from_location(epw.location)
1725-
idx = pd.date_range("2017-01-01 00:00:00", "2018-01-01 00:00:00", freq="1T")
1725+
idx = pd.date_range("2017-01-01 00:00:00", "2018-01-01 00:00:00", freq="1min")
17261726
suns = [sunpath.calculate_sun_from_date_time(i) for i in idx][:-1]
17271727

17281728
s = pd.Series([i.altitude for i in suns], index=idx[:-1])

LadybugTools_Engine/Python/src/ladybugtools_toolkit/plot/_diurnal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def diurnal(
7171

7272
# resample to hourly to ensuure hour alignment
7373
# TODO - for now we only resample to hourly, but this could be made more flexible by allowing any subset of period
74-
series = series.resample("H").mean()
74+
series = series.resample("h").mean()
7575

7676
# remove nan/inf
7777
series = series.replace([-np.inf, np.inf], np.nan).dropna()

LadybugTools_Engine/Python/src/ladybugtools_toolkit/plot/_misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def solar_elevation_azimuth(location: Location, ax: plt.Axes = None) -> plt.Axes
474474
ax = plt.gca()
475475

476476
sp = Sunpath.from_location(location)
477-
idx = pd.date_range("2017-01-01 00:00:00", "2018-01-01 00:00:00", freq="10T")
477+
idx = pd.date_range("2017-01-01 00:00:00", "2018-01-01 00:00:00", freq="10min")
478478
suns = [sp.calculate_sun_from_date_time(i) for i in idx]
479479
a = pd.DataFrame(index=idx)
480480
a["altitude"] = [i.altitude for i in suns]

LadybugTools_Engine/Python/src/ladybugtools_toolkit/plot/_sunpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def sunpath(
6969
day_suns = []
7070
for month in [6, 9, 12]:
7171
date = pd.to_datetime(f"2017-{month:02d}-21")
72-
day_idx = pd.date_range(date, date + pd.Timedelta(hours=24), freq="1T")
72+
day_idx = pd.date_range(date, date + pd.Timedelta(hours=24), freq="1min")
7373
_ = []
7474
for idx in day_idx:
7575
s = sunpath_obj.calculate_sun_from_date_time(idx)

LadybugTools_Engine/Python/src/ladybugtools_toolkit/solar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def wea(self, location: Location) -> Wea:
453453
df = remove_leap_days(self.df)
454454

455455
grouped = df.groupby([df.index.month, df.index.day, df.index.hour]).mean()
456-
index = pd.date_range("2017-01-01", periods=8760, freq="60T")
456+
index = pd.date_range("2017-01-01", periods=8760, freq="60min")
457457
grouped.set_index(index, inplace=True)
458458

459459
return Wea.from_annual_values(

LadybugTools_Engine/Python/tests/test_helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ def test_remove_leap_days():
525525
def test_month_hour_binned_series():
526526
"""_"""
527527
s = pd.Series(
528-
index=pd.date_range(start="2017-01-01 00:00:00", freq="60T", periods=8760),
528+
index=pd.date_range(start="2017-01-01 00:00:00", freq="60min", periods=8760),
529529
data=range(8760),
530530
)
531531

@@ -545,7 +545,7 @@ def test_month_hour_binned_series():
545545
month_hour_binned_series(
546546
pd.Series(
547547
index=pd.date_range(
548-
start="2017-01-01 00:00:00", freq="60T", periods=5000
548+
start="2017-01-01 00:00:00", freq="60min", periods=5000
549549
),
550550
data=range(5000),
551551
)
@@ -556,7 +556,7 @@ def test_month_hour_binned_series():
556556
month_hour_binned_series(
557557
pd.Series(
558558
index=pd.date_range(
559-
start="2017-01-01 00:00:00", freq="120T", periods=8760 * 3
559+
start="2017-01-01 00:00:00", freq="120min", periods=8760 * 3
560560
),
561561
data=range(8760),
562562
)

LadybugTools_Engine/Python/tests/test_ladybug_extension/test_datacollection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
SERIES_GOOD = pd.Series(
1212
data=EPW_OBJ.dry_bulb_temperature.values,
1313
name="Dry Bulb Temperature (C)",
14-
index=pd.date_range("2007-01-01 00:30:00", freq="60T", periods=8760),
14+
index=pd.date_range("2007-01-01 00:30:00", freq="60min", periods=8760),
1515
)
1616

1717

LadybugTools_Engine/Python/tests/test_plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def test_heatmap():
250250
heatmap(
251251
pd.Series(
252252
np.random.random(21000),
253-
index=pd.date_range("2000-01-01", periods=21000, freq="H"),
253+
index=pd.date_range("2000-01-01", periods=21000, freq="h"),
254254
)
255255
),
256256
plt.Axes,

0 commit comments

Comments
 (0)