<div dir="ltr">Hi Justin,<div><br></div><div>This is strange. I copied your script directly and run in my server (redhat Linux) and it ran smoothly. Can you check the issue is not related to the platform you are running. I encountered this while using opengrads package in windows. </div><div><br></div><div><div>reinit</div><div>mday = '31 28 31 30 31 30 31 31 30 31 30 31'</div><div>month = 'jan feb mar apr may jun jul aug sep oct nov dec'</div><div><br></div><div> 'open /CLIMDATA/CMIP5/DAILY/CanESM2/pr/historical/pr_day_CanESM2_historical_rimes.ctl'</div><div><br></div><div> 'set gxout fwrite'</div><div>reinit</div><div>mday = '31 28 31 30 31 30 31 31 30 31 30 31'</div><div>month = 'jan feb mar apr may jun jul aug sep oct nov dec'</div><div><br></div><div> 'open /CLIMDATA/CMIP5/DAILY/CanESM2/pr/historical/pr_day_CanESM2_historical_rimes.ctl'</div><div><br></div><div> 'set gxout fwrite'</div><div> 'set fwrite test'</div><div><br></div><div> yr1 = 1980</div><div> yr2 = 2005</div><div><br></div><div> yr = yr1</div><div> while (yr<=yr2)</div><div> leap = 0</div><div> if (math_mod(yr,400) = 0 | math_mod(yr,4) = 0 & math_mod(yr,100) != 0)</div><div> leap = 1</div><div> say yr' is a leap year.'</div><div> endif</div><div> imon = 1</div><div> while (imon <= 12)</div><div> md = subwrd(mday,imon)</div><div> mc = subwrd(month,imon)</div><div> if (imon = 2); md = md + leap; endif;</div><div> time1 = '01'mc''yr</div><div> time2 = md''mc''yr</div><div> say time1' 'time2</div><div> 'd ave(pr,time='time1',time='time2')'</div><div> imon = imon + 1</div><div> endwhile</div><div> yr = yr + 1</div><div> endwhile</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 15, 2016 at 8:30 PM, Justin Hicks <span dir="ltr"><<a href="mailto:jhicks2014@gmail.com" target="_blank">jhicks2014@gmail.com</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">Itesh,<div><br></div><div>I am still getting the same error even after including a space. I'll paste my code below:</div><div><br></div><div><span class=""><div>reinit</div><div>mday = '31 28 31 30 31 30 31 31 30 31 30 31'</div><div>month = 'jan feb mar apr may jun jul aug sep oct nov dec'</div><div><br></div></span><div> 'open /data2/control/GPCC_FirstGuessDaily'</div><span class=""><div><br></div><div> 'set gxout fwrite'</div><div> 'set fwrite /data2/control/GPCC_FirstGuessDailyScriptTest'</div><div><br></div><div> yr1 = 2009</div><div> yr2 = 2013</div><div><br></div><div> yr = yr1</div><div> while (yr<=yr2)</div><div> leap = 0</div></span><div> if (math_mod(yr,400) = 0 | math_mod(yr,4) = 0 & math_mod(yr,100) != 0)</div><span class=""><div> leap = 1</div><div> say yr' is a leap year.'</div><div> endif</div><div> imon = 1</div></span><div> while (imon <= 12)</div><span class=""><div> md = subwrd(mday,imon)</div><div> mc = subwrd(month,imon)</div></span><div> if (imon = 2); md = md + leap; endif;</div><span class=""><div> time1 = '01'mc''yr</div><div> time2 = md''mc''yr</div></span><span class=""><div> say time1' 'time2</div><div> 'd ave(p,time='time1',time='time2')'</div><div> imon = imon + 1</div><div> endwhile</div><div> yr = yr + 1</div><div> endwhile</div></span></div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Justin</div></font></span><div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 14, 2016 at 4:36 PM, itesh dash <span dir="ltr"><<a href="mailto:itesh@rimes.int" target="_blank">itesh@rimes.int</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Just provide a space at beginning of () in the <span></span>while statement. <div><br></div><div>While (yr<=yr2)</div><div><br></div><div>It should work.<div><div><br><br>On Wednesday, 15 June 2016, Justin Hicks <<a href="mailto:jhicks2014@gmail.com" target="_blank">jhicks2014@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Now, with the same exact script, it is giving me the error<div><br></div><div> "Unable to locate ENDWHILE statement for the WHILE statement at line 14<div> In file DailytoMonthlyTest.gs"</div><div><br></div><div>This is the error I was previously dealing with, yet it resolved itself with no changes. I'm not too sure what's going on, both endwhile statements are there.</div><div><br></div><div>-Justin </div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 9, 2016 at 12:32 PM, Jeff Duda <span dir="ltr"><<a>jeffduda319@gmail.com</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">The code looks fine to me other than the following line:<br><br><div> 'open file /data2/control/GPCC_FirstGuessDaily'<br><br></div><div>Remove 'file' from this command.<br><br></div><div>Jeff Duda<br></div><br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Thu, Jun 9, 2016 at 10:10 AM, Justin Hicks <span dir="ltr"><<a>jhicks2014@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">To whom it may concern,<div><br></div><div>I'm working on converting a plethora of datasets, many of them with daily and hourly temporal resolutions, into a monthly temporal resolution. </div><div><br></div><div>I am unsure how to write a script that I can run that changes, in this case, average daily data into average monthly data, with respect to leap years and such. I have tried to follow scripts from other users who have previously posted here, but they did not seem to work. </div><div><br></div><div>There is an example of the script I tried to run on this page: <a href="http://gradsusr.org/pipermail/gradsusr/2006-June/003290.html" target="_blank">http://gradsusr.org/pipermail/gradsusr/2006-June/003290.html</a></div><div><br></div><div>This is the script I am currently running: </div><div><br></div><div><div>reinit</div><div>mday = '31 28 31 30 31 30 31 31 30 31 30 31'</div><div>month = 'jan feb mar apr may jun jul aug sep oct nov dec'</div><div><br></div><div> 'open file /data2/control/GPCC_FirstGuessDaily'</div><div><br></div><div> 'set gxout fwrite'</div><div> 'set fwrite /data2/control/GPCC_FirstGuessDailyScriptTest'</div><div><br></div><div> yr1 = 2009</div><div> yr2 = 2013</div><div><br></div><div> yr = yr1</div><div> while(yr<=yr2)</div><div> leap = 0</div><div> if(math_mod(yr,400) = 0 | math_mod(yr,4) = 0 & math_mod(yr,100) != 0)</div><div> leap = 1</div><div> say yr' is a leap year.'</div><div> endif</div><div> imon = 1</div><div> while(imon <= 12)</div><div> md = subwrd(mday,imon)</div><div> mc = subwrd(month,imon)</div><div> if(imon = 2); md = md + leap; endif;</div><div> time1 = '01'mc''yr</div><div> time2 = md''mc''yr</div><div>* say time1' 'time2</div><div> 'd ave(p,time='time1',time='time2')'</div><div> imon = imon + 1</div><div> endwhile</div><div> yr = yr + 1</div><div> endwhile</div></div><div><br></div><div><br></div><div>Running this code gives me an error saying that it cannot open the file, yet it is pointed to the correct directory. However, it does output saying that '2012 is a leap year' which is correct.</div><div><br></div><div>Any help would be appreciated, as I'm a terrible coder. </div><span><font color="#888888"><div><br></div><div>-Justin</div></font></span></div>
<br></div></div>_______________________________________________<br>
gradsusr mailing list<br>
<a>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><span><font color="#888888"><br><br clear="all"><br>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div>Jeff Duda<br>Post-doctoral research associate<br>University of Oklahoma School of Meteorology<br></div></div></div>
</font></span></div>
<br>_______________________________________________<br>
gradsusr mailing list<br>
<a>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></div>
</blockquote></div></div></div>
<br>_______________________________________________<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>
<br></blockquote></div><br></div></div></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></div>