alex-s-gardner / GEMB

A 1D column that simulates snow/firn/ice processes and surface-atmosphere mass and energy exchanges
Apache License 2.0
5 stars 2 forks source link

Logical of a sum of a logical in melt.m #4

Closed chadagreene closed 3 months ago

chadagreene commented 3 months ago

@alex-s-gardner I found an error check in melt.m that checks the logical of the sum of a logical. On line 258 it reads:

if sum(W < 0.0-Wtol)

That works, but it's somewhat unconventional, and I wonder if it's an error. I would expect either:

if any(W < 0.0-Wtol)

or

if sum(W) < (0.0-Wtol)

The same check appears again on line 302.

alex-s-gardner commented 3 months ago

@chadagreene these types of code specific questions are typically best dealt with through PR with comments. GitHub provides tools for discussion and modification of proposed changes in PRs.

alex-s-gardner commented 3 months ago

@chadagreene I agree would propose changing lines 258 and 302 to: if any(W < 0.0-Wtol)