[gradsusr] Converting Daily Average to Monthly Average

Justin Hicks jhicks2014 at gmail.com
Tue Jun 14 16:09:32 EDT 2016


Now, with the same exact script, it is giving me the error

 "Unable to locate ENDWHILE statement for the WHILE statement at line 14
  In file DailytoMonthlyTest.gs"

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.

-Justin


On Thu, Jun 9, 2016 at 12:32 PM, Jeff Duda <jeffduda319 at gmail.com> wrote:

> The code looks fine to me other than the following line:
>
>  'open file /data2/control/GPCC_FirstGuessDaily'
>
> Remove 'file' from this command.
>
> Jeff Duda
>
>
> On Thu, Jun 9, 2016 at 10:10 AM, Justin Hicks <jhicks2014 at gmail.com>
> wrote:
>
>> To whom it may concern,
>>
>> I'm working on converting a plethora of datasets, many of them with daily
>> and hourly temporal resolutions, into a monthly temporal resolution.
>>
>> 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.
>>
>> There is an example of the script I tried to run on this page:
>> http://gradsusr.org/pipermail/gradsusr/2006-June/003290.html
>>
>> This is the script I am currently running:
>>
>> reinit
>> mday = '31 28 31 30 31 30 31 31 30 31 30 31'
>> month = 'jan feb mar apr may jun jul aug sep oct nov dec'
>>
>>  'open file /data2/control/GPCC_FirstGuessDaily'
>>
>>  'set gxout fwrite'
>>  'set fwrite /data2/control/GPCC_FirstGuessDailyScriptTest'
>>
>>  yr1 = 2009
>>  yr2 = 2013
>>
>>  yr = yr1
>>  while(yr<=yr2)
>>  leap = 0
>>   if(math_mod(yr,400) = 0 | math_mod(yr,4) = 0 & math_mod(yr,100) != 0)
>>    leap = 1
>>    say yr' is a leap year.'
>>   endif
>>   imon = 1
>>   while(imon <= 12)
>>    md = subwrd(mday,imon)
>>    mc = subwrd(month,imon)
>>    if(imon = 2); md = md + leap; endif;
>>   time1 = '01'mc''yr
>>    time2 = md''mc''yr
>> *   say time1' 'time2
>>    'd ave(p,time='time1',time='time2')'
>>    imon = imon + 1
>>   endwhile
>>   yr = yr + 1
>>  endwhile
>>
>>
>> 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.
>>
>> Any help would be appreciated, as I'm a terrible coder.
>>
>> -Justin
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>
>
> --
> Jeff Duda
> Post-doctoral research associate
> University of Oklahoma School of Meteorology
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20160614/9fa26497/attachment.html 


More information about the gradsusr mailing list