-
Notifications
You must be signed in to change notification settings - Fork 17
feat: Generic cos sin from rad filter #180
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
Conversation
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this @MeraX.
The code looks good to me, but I wonder if it might be better to add an optional argument to the existing cos_sin_mean_wave_direction filter (and potentially generalising this)? (We could also consider adding additional entries in the registry which handle the specialised cases).
What do you think?
|
Hi Aaron, thanks for your comment. I was also thinking about a generalisation and discussing it a bit with @b8raoult. There are a couple of options:
Baudoin and I chose 4th option to not overcomplicate this filter in terms of OOP. However I'm open, if you could imagine a simpler implementation. It would nice to deduce the units from the metadata, however, I think this is impossible. The correct units might be available as part of the Anyway, for generalisation, I would recommend giving the degree-variant of this filter a more general name, perhaps defining an alias for backward compatibility. |
|
Given the simplicity of the filter, I'm not averse to option 4 for now. 🙂
@b8raoult has been doing some work recently to track the processing of variables through anemoi (ecmwf/anemoi-datasets#437), I suspect that this might be a way of solving this problem.
Sounds good to me. Would you like to make that change? (Happy to either add it to this PR, or you can create another – whatever you prefer). |
|
@aaron-hopkinson, Thanks for your comment.
I would leave that to a separate task and PR. |
|
No worries, thanks @MeraX. I'll merge this. Feel free to ping/@ me on the other PR when it's ready. |
🤖 Automated Release PR This PR was created by `release-please` to prepare the next release. Once merged: 1. A new version tag will be created 2. A GitHub release will be published 3. The changelog will be updated Changes to be included in the next release: --- ## [0.1.18](0.1.17...0.1.18) (2025-10-30) ### Features * Add AccumToInterval filter transform ([#168](#168)) ([0801a4b](0801a4b)) * Generic cos sin from rad filter ([#180](#180)) ([7fabff9](7fabff9)) ### Bug Fixes * Clarify error message ([#181](#181)) ([1cd0536](1cd0536)) * Remove variable from xarray metadata when grouping ([#182](#182)) ([46465cd](46465cd)) --- > [!IMPORTANT] > Please do not change the PR title, manifest file, or any other automatically generated content in this PR unless you understand the implications. Changes here can break the release process. >⚠️ Merging this PR will: > - Create a new release > - Trigger deployment pipelines > - Update package versions **Before merging:** - Ensure all tests pass - Review the changelog carefully - Get required approvals [Release-please documentation](https://github.com/googleapis/release-please)
Description
This filter converts a variable in radian to the cosine and sine of the variable.
What problem does this change solve?
The available
cos_sin_mean_wave_directionfilter expects values in degree.What issue or task does this change relate to?
Additional notes
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.