We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 343ce31 + 3c5d5b5 commit 767c1fdCopy full SHA for 767c1fd
atlite/convert.py
@@ -799,7 +799,10 @@ def hydro(
799
800
matrix = cutout.indicatormatrix(basins.shapes)
801
# compute the average surface runoff in each basin
802
- matrix_normalized = matrix / matrix.sum(axis=1)
+ # Fix NaN and Inf values to 0.0 to avoid numerical issues
803
+ matrix_normalized = np.nan_to_num(
804
+ matrix / matrix.sum(axis=1), nan=0.0, posinf=0.0, neginf=0.0
805
+ )
806
runoff = cutout.runoff(
807
matrix=matrix_normalized,
808
index=basins.shapes.index,
0 commit comments