<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Arial; font-size: 10pt; color: #000000'>Thanks everyone for your solutions.&nbsp; I'll play with all of them and let you know how it turns out.<BR>
<DIV><FONT size=2>Mark</FONT></DIV><BR><BR>----- Original Message -----<BR>From: "Eric Altshuler" &lt;ela@COLA.IGES.ORG&gt;<BR>To: GRADSUSR@LIST.CINECA.IT<BR>Sent: Wednesday, March 25, 2009 8:29:41 PM GMT -08:00 US/Canada Pacific<BR>Subject: Re: Logic Question<BR><BR>Hello Mark,<BR><BR>I think the following will do what you want:<BR><BR>var1m=const(maskout(var1,var1-var2),0,-u)<BR>var2m=const(maskout(var2,var2-var1),0,-u)<BR>varxm=const(maskout(var1,-abs(var1-var2)),0,-u)<BR>d var1m+var2m-varxm<BR><BR>var1m will equal var1 where var1&gt;=var2 and zero where var1&lt;var2.<BR>var2m will equal var2 where var2&gt;=var1 and zero where var2&lt;var1.<BR><BR>The sum of var1m and var2m will equal var1 where var1&gt;var2 and will equal var2 where var2&gt;var1. However, at grid points where var1=var2, var1m+var2m will be equal to var1+var2 (and also equal to 2*var1 and 2*var2). In this case, var1 (or var2) must be subtracted from var1+var2 to get the correct value. To handle the situation where var1=var2, varxm will equal var1 (and also var2) where var1=var2 and zero where var1&lt;&gt;var2. So, finally, the expression var1m+var2m-varxm will equal var1 where var1&gt;=var2 and will equal var2 where var2&gt;=var1.<BR><BR>I tried this out with my own data and it seems to work. The maskout and const functions are amazingly useful for problems like this.<BR><BR>Best regards,<BR><BR>Eric L. Altshuler<BR>Assistant Research Scientist<BR>Center for Ocean-Land-Atmosphere Studies<BR>4041 Powder Mill Road, Suite 302<BR>Calverton, MD 20705-3106<BR>USA<BR><BR>E-mail: ela@cola.iges.org<BR>Phone: (301) 902-1257<BR>Fax: (301) 595-9793<BR><BR>----- Original Message -----<BR>From: "Mark Sponsler" &lt;msponsler@COMCAST.NET&gt;<BR>To: GRADSUSR@LIST.CINECA.IT<BR>Sent: Wednesday, March 25, 2009 6:54:20 PM GMT -05:00 US/Canada Eastern<BR>Subject: Logic Question<BR><BR>I need your expert assistance<BR><BR>The goal is to display the greater of 2 variables, comparing them grib<BR>point by grib point onto a single image in one display operation. &nbsp;I<BR>believe that 'if' and '&gt;' can't be used in a define statement, hence the<BR>dilemma:<BR><BR>Logically for each grib point I want to:<BR><BR>if (var1 &gt;= var2)<BR>&nbsp;&nbsp; d var1<BR>else<BR>if (var2 &gt; var1)<BR>&nbsp;&nbsp; d var2<BR>endif<BR><BR>So I'm trying to figure out how to set up a define statement to accomplish<BR>that.<BR><BR>define var3 = (logic here...)<BR>d var3<BR><BR>Any thoghts would be most appreciated.<BR></div></body></html>