Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose drop_duplicate_grid_labels in the public API #356

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 3 additions & 5 deletions xmip/postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,10 @@ def _pick_grid_label(ds_list, preferred_grid_label):
return ds_list[0]


def _drop_duplicate_grid_labels(ddict, preferred_grid_label):
def drop_duplicate_grid_labels(ddict, preferred_grid_label):
"""Eliminate multiple grid labels for the same dataset, by dropping multiples
with a preference for `preferred_grid_label`"""
match_attrs = [ma for ma in EXACT_ATTRS if ma not in ["version", "grid_label"]] + [
"variable_id"
]
match_attrs = [ma for ma in EXACT_ATTRS if ma not in ["version", "grid_label"]]
return combine_datasets(
ddict,
_pick_grid_label,
Expand Down Expand Up @@ -521,7 +519,7 @@ def interpolate_grid_label(
merge_kwargs.setdefault("combine_attrs", "drop_conflicts")

# first drop the datasets that might have both the target and another grid_label present
ds_dict = _drop_duplicate_grid_labels(ds_dict, target_grid_label)
ds_dict = drop_duplicate_grid_labels(ds_dict, target_grid_label)

return combine_datasets(
ds_dict,
Expand Down
Loading