Skip to content

Commit 1b6358c

Browse files
refactor: move field filters (+ tests) under separate subdir (#248)
## Description Move the field specific filters (and their tests) under separate subdirectories. ## What problem does this change solve? Makes it easier to see at a glance which filters only work on field or tabular inputs. ***As a contributor to the Anemoi framework, please ensure that your changes include unit tests, updates to any affected dependencies and documentation, and have been tested in a parallel setting (i.e., with multiple GPUs). As a reviewer, you are also responsible for verifying these aspects and requesting changes if they are not adequately addressed. For guidelines about those please refer to https://anemoi.readthedocs.io/en/latest/*** By opening this pull request, I affirm that all authors agree to the [Contributor License Agreement.](https://github.com/ecmwf/codex/blob/main/Legal/contributor_license_agreement.md)
1 parent e933805 commit 1b6358c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+81
-64
lines changed

src/anemoi/transform/filters/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
from typing import Any
1212

13-
from anemoi.utils.registry import Registry
13+
from anemoi.transform.filters.fields import filter_registry as fields_filter_registry
1414

15-
filter_registry = Registry(__name__)
15+
filter_registry = fields_filter_registry
1616

1717

1818
def create_filter(context: Any, config: Any) -> Any:
@@ -33,3 +33,6 @@ def create_filter(context: Any, config: Any) -> Any:
3333
filter = filter_registry.from_config(config)
3434
filter.context = context
3535
return filter
36+
37+
38+
__all__ = ["filter_registry", "create_filter"]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# (C) Copyright 2026- Anemoi contributors.
2+
#
3+
# This software is licensed under the terms of the Apache Licence Version 2.0
4+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5+
#
6+
# In applying this licence, ECMWF does not waive the privileges and immunities
7+
# granted to it by virtue of its status as an intergovernmental organisation
8+
# nor does it submit to any jurisdiction.
9+
10+
11+
from anemoi.utils.registry import Registry
12+
13+
filter_registry = Registry(__name__)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/anemoi/transform/filters/cos_sin_from_rad.py renamed to src/anemoi/transform/filters/fields/cos_sin_from_rad.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
import numpy as np
1616

1717
from anemoi.transform.filters import filter_registry
18-
from anemoi.transform.filters.matching import MatchingFieldsFilter
19-
from anemoi.transform.filters.matching import matching
18+
from anemoi.transform.filters.fields.matching import MatchingFieldsFilter
19+
from anemoi.transform.filters.fields.matching import matching
2020

2121

2222
@filter_registry.register("cos_sin_from_rad")

src/anemoi/transform/filters/cos_sin_mean_wave_direction.py renamed to src/anemoi/transform/filters/fields/cos_sin_mean_wave_direction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
import numpy as np
1616

1717
from anemoi.transform.filters import filter_registry
18-
from anemoi.transform.filters.matching import MatchingFieldsFilter
19-
from anemoi.transform.filters.matching import matching
18+
from anemoi.transform.filters.fields.matching import MatchingFieldsFilter
19+
from anemoi.transform.filters.fields.matching import matching
2020

2121

2222
@filter_registry.register("cos_sin_mean_wave_direction")
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)