We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bab679f commit 3c5d5b5Copy full SHA for 3c5d5b5
atlite/convert.py
@@ -805,7 +805,10 @@ def hydro(
805
806
matrix = cutout.indicatormatrix(basins.shapes)
807
# compute the average surface runoff in each basin
808
- matrix_normalized = matrix / matrix.sum(axis=1)
+ # Fix NaN and Inf values to 0.0 to avoid numerical issues
809
+ matrix_normalized = np.nan_to_num(
810
+ matrix / matrix.sum(axis=1), nan=0.0, posinf=0.0, neginf=0.0
811
+ )
812
runoff = cutout.runoff(
813
matrix=matrix_normalized,
814
index=basins.shapes.index,
0 commit comments