-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from gibsramen/vi
Model fitting refactor
- Loading branch information
Showing
10 changed files
with
176 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import re | ||
from typing import Sequence | ||
|
||
import xarray as xr | ||
|
||
|
||
def _drop_data(dataset: xr.Dataset, vars_to_drop: Sequence[str]) -> xr.Dataset: | ||
"""Drop data and associated dimensions from inference group.""" | ||
new_dataset = dataset.drop_vars(vars_to_drop) | ||
# TODO: Figure out how to do this more cleanly | ||
dims_to_drop = [] | ||
for var in vars_to_drop: | ||
for dim in new_dataset.dims: | ||
if re.match(f"{var}_dim_\\d", dim): | ||
dims_to_drop.append(dim) | ||
new_dataset = new_dataset.drop_dims(dims_to_drop) | ||
return new_dataset |
Oops, something went wrong.