<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>That was enough, it's working now. Thank you very much for such a straightforward explanation.<br>
</p>
<p><br>
</p>
<p>Grateful,<br>
</p>
<p>Ryne<br>
</p>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> gradsusr-bounces@gradsusr.org <gradsusr-bounces@gradsusr.org> on behalf of Jeff Duda <jeffduda319@gmail.com><br>
<b>Sent:</b> Tuesday, June 16, 2015 5:14 PM<br>
<b>To:</b> GrADS Users Forum<br>
<b>Subject:</b> Re: [gradsusr] A Faulty IF Loop</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>
<div>You need to be very explicit with your translation of human statements into code. You might say, "if the lag is 1, 5, 9, or 13 I want to do one thing, and do something different if otherwise." But to convert that to code you need to explicitly spell out
EACH logical expression:<br>
</div>
if lag is 1<br>
</div>
if lag is 5<br>
</div>
if lag is 9<br>
</div>
if lag is 13<br>
<br>
</div>
Thus, your if statement should read:<br>
</div>
<b>if (lag = 1 | lag = 5 | lag = 9 | lag = 13)</b><br>
<br>
</div>
Jeff<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Jun 16, 2015 at 4:06 PM, Noska, Ryne <span dir="ltr">
<<a href="mailto:rgn14c@my.fsu.edu" target="_blank">rgn14c@my.fsu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt; color:#000000; background-color:#ffffff; font-family:Calibri,Arial,Helvetica,sans-serif">
<div style="font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif; background-color:rgb(255,255,255)">
<div>
<div>
<div style="min-width:350px; clear:both">
<div style="min-height:70px; border-bottom-width:1px; border-bottom-style:solid; padding-bottom:30px">
<div>
<div>
<div style="clear:both; width:auto; padding-top:12px; word-wrap:break-word">
<div style="font-size:15px; outline:none">
<div dir="ltr"><span dir="ltr">
<div><font color="black" face="Calibri,Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">
<div style="margin-top:0px; margin-bottom:0px">I have written a very simple code for the purpose of creating one image with sixteen figures (four rows and four columns). Unfortunately, the loop I have designed to change the location of the next figure is broken.
Instead of only executing the "if" statement if lag = 1 or 5 or 9 or 13, this portion of the loop is ALWAYS executed. The "else" statement is NEVER executed, <font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size:16px">causing the
figures to run off the page after figure 4 since only ymin and ymax change. Below is a portion of my code; again, the problematic portion is the IF loop:</span></font><br>
</div>
<div style="margin-top:0px; margin-bottom:0px"><font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size:16px"><br>
</span></font></div>
<div style="margin-top:0px; margin-bottom:0px"><font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size:16px">---------------------------------------</span></font></div>
<div style="margin-top:0px; margin-bottom:0px"><font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size:16px"><br>
</span></font></div>
<div>
<div>xmin = 0.25</div>
<div>xmax = 2.50</div>
<div>ymin = 6.25 + 2.00</div>
<div>ymax = 8.00 + 2.00</div>
<div><br>
</div>
<div>lag = 1</div>
<div>while (lag <= 16)</div>
<div> numlag = lag - 1</div>
<div><br>
</div>
<div> <strong> if (lag = 1 | 5 | 9 | 13)</strong></div>
<div><strong> xmin = 0.25</strong></div>
<div><strong> xmax = 2.50</strong></div>
<div><strong> ymin = ymin - 2.00</strong></div>
<div><strong> ymax = ymax - 2.00</strong></div>
<div><strong> else </strong></div>
<div><strong> xmin = xmin + 2.50</strong></div>
<div><strong> xmax = xmax + 2.50</strong></div>
<div><strong> endif</strong></div>
<div><br>
</div>
<div> xlab = ((xmax - xmin)/2) + 0.25</div>
<div> ylab = ymax + 0.125<br>
</div>
<div><br>
</div>
<div> 'set parea 'xmin' 'xmax' 'ymin' 'ymax</div>
<div> 'set xlopts 1 1 0.10'</div>
<div> 'set ylopts 1 1 0.10'</div>
<div> 'set xlint 10'</div>
<div> 'set ylint 10'</div>
<div> 'set xlab off'</div>
<div> 'set ylab off'</div>
<div> 'set grid on'</div>
<div> 'set grads off'</div>
<div> 'set map 1 1 5'</div>
<div> 'set clevs -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.1 0.2 0.3'</div>
<div> 'set ccols 9 14 4 11 5 13 3 10 0 7 12 8'</div>
<div> 'set t 'lag</div>
<div> 'd corr_grdons'</div>
<div> 'set strsiz 0.15'</div>
<div> 'set string 1 c 8'</div>
<div> 'draw string 'xlab' 'ylab' lag='numlag'days'</div>
<div><br>
</div>
<div> lag = lag + 1</div>
<div>endwhile<br>
</div>
<br>
</div>
<div>-------------------------------<br>
</div>
<div><br>
</div>
<div>Any suggestions?<br>
</div>
<div><br>
</div>
<div>Thank you,<br>
</div>
<div>Ryne<br>
</div>
<div><br>
</div>
</span></font></div>
</span></div>
</div>
</div>
</div>
<div style="clear:both">​<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p><br>
</p>
</div>
</div>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">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>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
<div class="gmail_signature">Jeff Duda<br>
Graduate research assistant<br>
University of Oklahoma School of Meteorology<br>
Center for Analysis and Prediction of Storms<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>