I have a vector where each value represents a concentration of a dissolved parameter (e.g. some element such as Ca, Al, Fe; or pH, EC, acidity, or alkalinity). This vector was computed from a regression and has resulted in some values being negative. Negative concentrations don't make physical sense, and I want to replace all negative values with a zero value. How can I do this? Currently I am trying to write a script in the script element to make these replacements. Any ideas?
-
Official comment
This is very easy to do and does not require a script. It simply requires a single Expression. If your vector is named, for example, Vector1, then simply create an Expression that looks like this and it will set all negative values to 0: vector(if(Vector1[row]<0,0,Vector1[row]))
You can read about the "row" variable here: https://help.goldsim.com/default.htm#GS/definingarraysinaninputfieldusingarrayconstructorfunctions.htm
Comment actions
Please sign in to leave a comment.
Comments
2 comments