Skip to content

Commit

Permalink
fix bug in test mhw
Browse files Browse the repository at this point in the history
  • Loading branch information
chiaweh2 committed Sep 3, 2024
1 parent 48ac32d commit 75ba03e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions mom6/mom6_module/mom6_mhw.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def generate_forecast_batch(
# anomaly used for the threshold
ds_anom = xr.Dataset()
ds_anom[f'{self.varname}_anom'] = dict_anom['anomaly']
ds_anom['lon'] = self.dataset['lon']
ds_anom['lat'] = self.dataset['lat']

# calculate threshold
class_forecast_quantile = ForecastQuantile(ds_anom,f'{self.varname}_anom')
Expand Down
4 changes: 2 additions & 2 deletions tests/test_mom6_mhw.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def test_MarineHeatwaveForecast_generate_forecast_single(ds_forecast):
)

assert np.abs(ds_mhw_single.mhw_prob90.sum().data-505.)==0.
assert np.abs(ds_mhw_single.ssta_avg.max().data-0.37654305) < 1e-6
assert np.abs(ds_mhw_single.mhw_mag_indentified_ens.max().data-0.37654305) < 1e-6
assert np.abs(ds_mhw_single.ssta_avg.max().data-0.37654305) < 1e-5
assert np.abs(ds_mhw_single.mhw_mag_indentified_ens.max().data-0.37654305) < 1e-5


def test_MarineHeatwaveForecast_generate_forecast_batch(ds_forecast):
Expand Down

0 comments on commit 75ba03e

Please sign in to comment.