This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi Muhammad- > I found that in the Grid diagnostic function > def add(S1,S2): > """ Addition > <div class=jython> > ADD (S1, S2) = S1 + S2 > </div> > """ > return GridMath.add(S1,S2) > > It only allows for two variables, S1 and S2. > > I've tried to add more variables but then an error exist. > > Is it possible to modifiy the function so we could use more than 2 variables? add, sub, mult, etc are meant to be low level routines between two paramaters. You can always string together multiple adds: add(add(s1,s2),s3) or create a multi-add function (madd): def madd(a): sum = 0 for i in range(len(a)): if i == 0: sum = a[i] else: sum = add(sum, a[i]) return sum and call it with: madd(a[multiple=true]) Don Murray Ticket Details =================== Ticket ID: KZD-153013 Department: Support IDV Priority: Normal Status: Open