Skip to content
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

Add fix nan #278

Merged
merged 1 commit into from
May 2, 2023
Merged

Add fix nan #278

merged 1 commit into from
May 2, 2023

Conversation

davide-f
Copy link
Contributor

Change proposed in this Pull Request

Simple fix of nan values in hydro function.
In the hydro function a normalization of the matrix indicator is performed; yet some nan values may be created.
To avoid the formation of nan values, in this PR they are forced to zero.

This is a feature needed for earth analysis and originally implemented intp #245.

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 change)

Checklist

  • I tested my contribution locally and it seems to work fine.
  • I locally ran pytest inside the repository and no unexpected problems came up.
  • I have adjusted the docstrings in the code appropriately.
  • I have documented the effects of my code changes in the documentation doc/.
  • I have added newly introduced dependencies to environment.yaml file.
  • I have added a note to release notes doc/release_notes.rst.
  • I have used pre-commit run --all to lint/format/check my contribution

@euronion
Copy link
Collaborator

Do you know what causes the nan and inf values to appear?

@davide-f
Copy link
Contributor Author

When using this in the past, I had some nans reported but I don't recall exactly the reason, I have no experience of inf, but that function also hands them.
Some times since that normalization is performed, the sum of the row was zero.

@davide-f
Copy link
Contributor Author

It could be when the hydrobasins shapes and cutout regions do not exactly match and/or when the hydrobasin is not complete.
This is the case for Large regions where the source of a river starts very far from a country.

@FabianHofmann FabianHofmann self-requested a review May 2, 2023 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants