[gradsusr] Cannot Locate Endwhile Statement Error

Stephen McMillan smcmillan at planalytics.com
Tue Jul 5 11:59:29 EDT 2016


Justin,

It appears there may be other problems with your sample script.  For
example,

'q time' should yield only one line, not five.  Perhaps you intended to get
the results of 'q dim' instead?  That one does produce five lines, and your
subwrd(rectime,6) would indeed give you a date.

Also, after your 'd aave(maskout...' in the while loop, you have "evap =
sublin(result,2)" which I believe produces only a single line in the
result, not two as you code suggests.  For the subsequent line, would you
not want "evap = subwrd(evap,4)"?

Stephen Mc

On Tue, Jul 5, 2016 at 11:13 AM, Justin Hicks <jhicks2014 at gmail.com> wrote:

> GrADS users,
>
> I am running a script that should output values into a 2 column table. The
> first column will be the time (monthly in the form of 00Z01JAN1979) and the
> second column will be the value of the variable (evap) at that time. After
> running the code below, I receive an error saying "Unable to locate
> ENDWHILE statement for the WHILE statement at line 18."
>
> This is the script I'm running; everything before the while statement is
> setting up a mask (in this case, the mask only outputs values for Africa):
>
> 'reinit'
> 'open /data2/control/Region15_AFR_mask_TEST.nc'
> 'set t 1 last'
> 'set dfile 1'
> 'set lon -179.5 179.5'
> 'set lat -89.5 89.5'
> 'open /data2/control/GLDAS_VIC10_M.ctl'
> 'set dfile 2'
> 'set lon -179.5 179.5'
> 'set lat -89.5 89.5'
> 'set time 00Z01JAN1979 00Z01JAN2016'
> 'set dfile 1'
> 'd
> aave(maskout(evap.2,mask.1(time=00Z01JAN1979)),lon=-179.5,lon=179.5,lat=-89.5,lat=89.5)'
> 'set gxout print'
> 'set prnopts %6.2f 1 1'
> nmonths = 428
> i = 1
> while (i <= nmonths)
>  'set t 'i
>  'q time'
> rectime = sublin(result,5)
> recdate = subwrd(rectime,6)
>  'd
> aave(maskout(evap.2,mask.1(time=00Z01JAN1979)),lon=-179.5,lon=179.5,lat=-89.5,lat=89.5)'
> evap = sublin(result,2)
> evap = subwrd(evap,1)
> string = rectime' 'evap
>  'write('GLDAS_MASK_DATA.txt' ,  string ,append)'
>  i = i + 1
> endwhile
>
>
>
>
> I'm not sure why GrADS is giving me this error.
>
> -Justin
>
> _______________________________________________
> 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/20160705/f4ec1786/attachment.html 


More information about the gradsusr mailing list