storm-fsv-cvut / smoderp2d

SMODERP2D - Distributed event-based model for surface and subsurface runoff and erosion
https://storm-fsv-cvut.github.io/smoderp2d-manual/
GNU General Public License v3.0
9 stars 4 forks source link

check again if mat aa is zero #383

Open jerabekjak opened 5 months ago

jerabekjak commented 5 months ago

in some cases, there was a problem that mat_aa was returned zero. This is a draft of simple yet not elegant solution. Feel free to modify....

pesekon2 commented 5 months ago

In general, I agree with this fix. I have also found mat_aa == 0 in some cases and it clearly should not happen. However, I do not understand how can be mat_aa == 0 at this point. I do not see a way 0 would be saved into the matrix with the code above the added line (unless nodata == 0):

        mat_aa = ma.where(
            ma.logical_or(
                mat_nsheet == no_data, mat_y == no_data, mat_slope == no_data
            ),
            no_data,
            ma.where(
                mat_slope == 0,
                0.0001,  # comment OP: where did we get this value from?
                1 / mat_nsheet * ma.power(mat_slope, mat_y)
            )
        )
jerabekjak commented 4 months ago

Next steps in this branch are described in commit 3098be1.