<div dir="ltr"><div dir="ltr"><div>Jeff,</div><div><br></div><div>Your second option worked great.</div><div><br></div><div>Thanks!</div><div><br></div><div>-- Matt</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 13, 2020 at 3:21 PM Jeff Duda <<a href="mailto:jeffduda319@gmail.com">jeffduda319@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Matt,</div><div>If you can group those arrays together using one of the dimensions (time, height, ensemble etc.) then you can use one of the built-in functions. If you can't do that, then you'd have to get creative and use a recursive function to find maxes of increasingly complex pairs of arrays using nested if() statements. For example:</div><div><br></div><div>Start with any pair of two fields.</div><div><br></div><div>'define maxfield = if(field1 > field2,field1,field2)'</div><div>'maxfield = if(field3 > maxfield,field3,maxfield)'</div><div>'maxfield = if(field4 > maxfield,field4,maxfield)'</div><div>...</div><div>...</div><div>...<br></div><div>'maxfieldfinal = if(field'n' > maxfield,field'n',maxfield)'</div><div><br></div><div>You can probably use a while loop to handle the intermediate steps there.</div><div><br></div><div>Jeff Duda<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 13, 2020 at 2:06 PM Matt Bunkers - NWS Rapid City <<a href="mailto:matthew.bunkers@noaa.gov" target="_blank">matthew.bunkers@noaa.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<div><br>I am trying to fund a function (or otherwise straightforward way) to find the max value at each index (i, j) for several 2D arrays (e.g., input 8 arrays and get 1 array that has the max value for each grid point). GrADS only seems to have functions to calculate the max over an individual array.  Does anyone know of a script to do this?</div><div><br></div><div>Thanks,</div><div><br></div><div>-- Matt</div><div><br></div></div>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font size="2"><span>Jeff Duda, Research Scientist</span></font></div><div dir="ltr"><font size="2"><span></span></font>University of Colorado Boulder</div><div dir="ltr"><font size="2"><span></span></font>Cooperative Institute for Research in Environmental Sciences</div><div dir="ltr">NOAA/OAR/ESRL/Global Systems Laboratory<br><font size="2"><span>

<span>Boulder, CO<br></span></span></font>



</div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</blockquote></div></div>