Skip to content

fix: Write correct values at step 0 #186

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

Merged
merged 3 commits into from
Apr 4, 2025
Merged

Conversation

gmertes
Copy link
Member

@gmertes gmertes commented Mar 21, 2025

Description

When writing the initial state the multistep input, a 2D array containing t0 and t-6, is written to step 0. Only the 1D array of t0 should be written to step 0.

Thanks for @frazane for finding the bug and proposing the solution.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Co-authored-by: Francesco Zanetta <[email protected]>
@gmertes gmertes requested a review from b8raoult March 21, 2025 12:52
@gmertes gmertes linked an issue Mar 21, 2025 that may be closed by this pull request
@github-project-automation github-project-automation bot moved this to Now In Progress in Anemoi-dev Mar 21, 2025
@github-actions github-actions bot added the bug Something isn't working label Mar 21, 2025
@HCookie
Copy link
Member

HCookie commented Mar 24, 2025

Why not use the reduce method?

@classmethod
def reduce(cls, state: State) -> State:
"""Create a new state which is a projection of the original state on the last step in the multi-steps dimension.
Parameters
----------
state : State
The original state.
Returns
-------
State
The reduced state.
"""
reduced_state = state.copy()
reduced_state["fields"] = {}
for field, values in state["fields"].items():
reduced_state["fields"][field] = values[-1, :]
return reduced_state

@gmertes
Copy link
Member Author

gmertes commented Apr 3, 2025

I forgor 💀

Using reduce now.

@gmertes gmertes merged commit 7923860 into main Apr 4, 2025
66 checks passed
@github-project-automation github-project-automation bot moved this from Now In Progress to Done in Anemoi-dev Apr 4, 2025
@gmertes gmertes deleted the 166-inconsistent-initial-step branch April 4, 2025 09:19
gmertes added a commit that referenced this pull request Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Inconsistent md5GridSection between initial step and other steps
2 participants