Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion unseen/eva.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ def gev_return_curve(
np.isfinite(boot_event_return_periods)
]
event_return_period_lower_ci = np.quantile(boot_event_return_periods, q)
event_return_period_upper_ci = np.quantile(boot_event_return_periods, q - 1)
event_return_period_upper_ci = np.quantile(boot_event_return_periods, 1 - q)
event_data = (
event_return_period,
event_return_period_lower_ci,
Expand Down
1 change: 1 addition & 0 deletions unseen/fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ def open_dataset(
if no_leap_days:
ds = ds.sel(time=~((ds[time_dim].dt.month == 2) & (ds[time_dim].dt.day == 29)))
if rolling_sum_window:
ds = ds.compute()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This compute was inserted to avoid this issue with rolling windows: pydata/xarray#9862

I should probably take it out and tell the user to rechunk their data instead using the chunks argument.

ds = ds.rolling({time_dim: rolling_sum_window}).sum(dim=time_dim)
if time_freq:
assert time_agg, "Provide a time_agg"
Expand Down
2 changes: 1 addition & 1 deletion unseen/process_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def count_months(event_months):
return counts


def plot_event_seasonality(ds, ax=None, core_dim=None, outfile=None):
def plot_event_seasonality(ds, ax=None, core_dim="time", outfile=None):
"""Plot event seasonality

Parameters
Expand Down
10 changes: 10 additions & 0 deletions unseen/stability.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ def plot_return_by_lead(
ax.set_ylabel(units_label)
if ylim:
ax.set_ylim(ylim)
else:
ymin, ymax = ax.get_ylim()
if ymin < 0:
ymin = 0
ax.set_ylim([ymin, ymax])
ax.legend()


Expand Down Expand Up @@ -269,6 +274,11 @@ def plot_return_by_time(
ax.set_ylabel(units_label)
if ylim:
ax.set_ylim(ylim)
else:
ymin, ymax = ax.get_ylim()
if ymin < 0:
ymin = 0
ax.set_ylim([ymin, ymax])
ax.legend()


Expand Down
Loading