Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 22, 2024
1 parent cf04eb8 commit 72eb682
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
14 changes: 7 additions & 7 deletions mesmer/calibrate_mesmer/train_gv.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ def train_gv_AR(params_gv, gv, max_lag, sel_crit):

# create temporary DataArray objects
data = [
xr.DataArray(
data,
dims=["run", "time"],
coords=[np.arange(data.shape[0]), np.arange(data.shape[1])],
)
for data in gv.values()
]
xr.DataArray(
data,
dims=["run", "time"],
coords=[np.arange(data.shape[0]), np.arange(data.shape[1])],
)
for data in gv.values()
]

AR_order = _select_ar_order_scen_ens(
*data, dim="time", ens_dim="run", maxlag=max_lag, ic=sel_crit
Expand Down
22 changes: 11 additions & 11 deletions mesmer/calibrate_mesmer/train_lv.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,17 @@ def train_lv_AR1_sci(params_lv, targs, y, wgt_scen_eq, aux, cfg):
# create temporary DataArray
dims = ("run", "time", "cell")
data = [
xr.DataArray(
data,
dims=dims,
coords=(
np.arange(data.shape[0]),
np.arange(data.shape[1]),
np.arange(data.shape[2]),
),
)
for data in targ.values()
]
xr.DataArray(
data,
dims=dims,
coords=(
np.arange(data.shape[0]),
np.arange(data.shape[1]),
np.arange(data.shape[2]),
),
)
for data in targ.values()
]

params = _fit_auto_regression_scen_ens(*data, dim="time", ens_dim="run", lags=1)

Expand Down
2 changes: 1 addition & 1 deletion mesmer/stats/_auto_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _fit_auto_regression_scen_ens(*objs, dim, ens_dim, lags):
for obj in objs:
ar_params = fit_auto_regression(obj, dim=dim, lags=int(lags))

#TODO: think about weighting! see https://github.com/MESMER-group/mesmer/issues/307
# TODO: think about weighting! see https://github.com/MESMER-group/mesmer/issues/307
if ens_dim in ar_params.dims:
ar_params = ar_params.mean(ens_dim)

Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_auto_regression_scen_ens.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def test_fit_auto_regression_scen_ens_multi_scen():

xr.testing.assert_equal(result, expected)


def test_fit_auto_regression_scen_ens_no_ens_dim():

da = generate_ar_samples([1, 0.5, 0.3, 0.4], n_timesteps=100, n_ens=4)
Expand Down

0 comments on commit 72eb682

Please sign in to comment.