Skip to content

Commit

Permalink
fix future warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bmeyers committed Jul 15, 2024
1 parent a998f50 commit e8e56ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion solardatatools/data_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ def plot_polar_transform(
)
if has_changed:
self.polar_transform.transform(
agg_func=np.nanmean,
agg_func="mean",
elevation_round=elevation_round,
azimuth_round=azimuth_round,
)
Expand Down
12 changes: 9 additions & 3 deletions solardatatools/polar_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ def normalize_days(self):
normed_data.loc[day] = power_normed
return normed_data

def transform(self, elevation_round=1, azimuth_round=2, agg_func=np.nanmean):
def transform(self, elevation_round=1, azimuth_round=2, agg_func="mean"):
# Solar position subroutine requires TZ-aware time stamps or UTC time
# stamps, but we typically have non-TZ-aware local time, without DST
# shifts (which is the most natural for solar data). So, step 1 is to
# convert the time to UTC.
times = self.data.index.shift(-self.tz_offset, "H")
times = self.data.index.shift(-self.tz_offset, "h")
# run solar position subroutine
solpos = get_solarposition(times, self.lat, self.lon)
# reset the time from UTC to local
Expand Down Expand Up @@ -110,5 +110,11 @@ def plot_transformation(
fig = plt.figure(figsize=figsize)
ax = fig.add_subplot(111)
# Plot clipped (non-neg) data
sns.heatmap(np.clip(self.transformed_data, 0, np.inf), ax=ax, cbar=cbar, cmap=cmap, alpha=alpha)
sns.heatmap(
np.clip(self.transformed_data, 0, np.inf),
ax=ax,
cbar=cbar,
cmap=cmap,
alpha=alpha,
)
return plt.gcf()

0 comments on commit e8e56ad

Please sign in to comment.