Hi team — a leading-space typo in waterRegimeCode that turns a special case into dead code and raises for group_9 soils.
In SALCAphosphorus/SALCAphosphor.py, when soil_waterRegime == 'group_9', watRegSel = ['z']. The intended special case is:
103 ...}.get(watRegSel[0])
104
105 if watRegSel[0] == ' z':
106 waterRegCode = 'z'
107 else:
108 ind = searchintervals(bound, soil_depth_cm)
109 waterRegCode = watRegSel[len(bound)-ind]
Line 105 compares against ' z' (leading space), so it is never True for watRegSel[0] == 'z'. The bound dict (lines 96-103) has no 'z' key, so .get('z') returns None, execution falls into the else, and searchintervals(None, soil_depth_cm) calls np.searchsorted(None, ...) → ValueError.
Why it's a bug: any group_9 soil hits the dead branch and crashes instead of returning water-regime code 'z'.
One-line fix:
Thanks!
Hi team — a leading-space typo in
waterRegimeCodethat turns a special case into dead code and raises forgroup_9soils.In
SALCAphosphorus/SALCAphosphor.py, whensoil_waterRegime == 'group_9',watRegSel = ['z']. The intended special case is:Line 105 compares against
' z'(leading space), so it is neverTrueforwatRegSel[0] == 'z'. Thebounddict (lines 96-103) has no'z'key, so.get('z')returnsNone, execution falls into theelse, andsearchintervals(None, soil_depth_cm)callsnp.searchsorted(None, ...)→ValueError.Why it's a bug: any
group_9soil hits the dead branch and crashes instead of returning water-regime code'z'.One-line fix:
Thanks!