<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">On Thu, Jun 9, 2016 at 10:10 AM, 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">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 class="HOEnZb"><font color="#888888"><div><br></div><div>-Justin</div></font></span></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" 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>
</div>