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 Nov 21, 2024
1 parent 25f7397 commit 35ad447
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/anemoi/datasets/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,15 @@ def _drop_to_columns(self, vars):
return sorted([v for k, v in self.name_to_index.items() if k not in vars])

def _reorder_to_columns(self, vars):
if isinstance(vars, str) and vars=="sort":
if isinstance(vars, str) and vars == "sort":
# Sorting the variables alphabetically.
# This is cruical for pre-training then transfer learning in combination with
# cutout and adjust = 'all'

indices = [self.name_to_index[k] for k, v in sorted(self.name_to_index.items(), key=lambda x: x[0])]
assert set(indices) == set(range(len(self.name_to_index)))
return indices

if isinstance(vars, (list, tuple)):
vars = {k: i for i, k in enumerate(vars)}

Expand Down

0 comments on commit 35ad447

Please sign in to comment.