-
Notifications
You must be signed in to change notification settings - Fork 105
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
Fix NaN values into inflow #242
Conversation
Thanks @davide-f for looking into this! Do you happen to know the reason for the NaN values? Would be good to treat the root cause rather than the symptoms. |
Co-authored-by: Fabian Hofmann <hofmann@fias.uni-frankfurt.de>
The reason is the intrinsic shift operation: when a time series is shifted at the beginning (or end in case of negative shifts) NaN values are created because of missing data. |
Just checked that there is the function "roll" that performs the circular shift, shall we go for it? |
I'd suggest yes. |
Completely agree (already done), as not using it may lead to underestimate the hydro potential for a region. This PR is ready. There are no nan fix here, though they were mostly caused by the shift procedure. |
Closes #241
Change proposed in this Pull Request
This PR aims at avoiding NaN values into the inflow.
Any NaN value would be converted into 0.0 instead before summing to the inflow.
Description
When performing the shift of the inflow dataarray, some NaN values appears hence leading to NaN values into the sum.
This has been fixed.
Motivation and Context
If NaN values remain, this may lead to issues in the usage of the tool
How Has This Been Tested?
Using pypsa-africa
Type of change
Checklist
pytest
inside the repository and no unexpected problems came up.doc/
.environment.yaml
file.doc/release_notes.rst
.pre-commit run --all
to lint/format/check my contribution