[gradsusr] Cannot Locate Endwhile Statement Error

Jeff Duda jeffduda319 at gmail.com
Thu Jul 7 16:00:17 EDT 2016


Use lterp.

Jeff Duda

On Thu, Jul 7, 2016 at 11:33 AM, Justin Hicks <jhicks2014 at gmail.com> wrote:

> GrADS users,
>
> The GLDAS data is working with the masks. However, I am trying to get
> MERRA2 data to work with the masks now. I keep getting an error saying:
>
> Data Request Error: Invalid dimension expression
>   Attempt to set or modify varying dimension
>   Variable = prectot.2, Dimension = 0
> Operation Error:  Error from maskout function
> Operation Error:  Error from aave function
>   Error ocurred at column 1
> DISPLAY error:  Invalid expression
>   Expression =
> aave(maskout(prectot.2(x=1,y=1),mask.1(x=1,y=1,time=00:30z01feb1980)),lon=-179.5,lon=179.5,lat=-89.5,lat=89.5)
>
> As you can see, I tried to fix x and y grid points because I kept getting
> that error, but this did nothing.
>
> The result of 'q dims' of the mask file is:
>
> Default file number is: 1
> X is fixed     Lon = 0  X = 180.5
> Y is fixed     Lat = -90  Y = 0.5
> Z is fixed     Lev = 0  Z = 1
> T is fixed     Time = 00:30Z01DEC1991  T = 143
> E is fixed     Ens = 1  E = 1
>
> The result of 'q dims' of the MERRA2 file is:
>
> Default file number is: 2
> X is fixed     Lon = 0  X = 1
> Y is fixed     Lat = -90  Y = 1
> Z is fixed     Lev = 0  Z = 1
> T is fixed     Time = 00:30Z01DEC1991  T = 143
> E is fixed     Ens = 1  E = 1
>
>
> How can I get the x and y grid points to match up?
>
> -Justin
>
> On Tue, Jul 5, 2016 at 3:34 PM, Jennifer M Adams <jadams21 at gmu.edu> wrote:
>
>>
>> On Jul 5, 2016, at 3:21 PM, Justin Hicks <jhicks2014 at gmail.com> wrote:
>>
>> Jennifer,
>>
>> I am still getting values of 0 in my text file (and on the terminal).
>> Typing in a 'q dims' command gives LEV=0  Z=1    for the mask and LEV=0
>>  Z=0  for the GLDAS file. Could the inconsistency be the issue?
>>
>> Maybe. Try this:
>>
>> evap.2(z=1),mask.1(z=1,time=00Z01JAN1979)
>>>>>
>>>>
>>
>> There aren't any errors displayed on the terminal. And just to note,
>> taking out the while statement gives me monthly values on the terminal when
>> the maskout function is in use, so I assume the issue is within the while
>> statement.
>>
>> Put some more ‘say’ statements in there to make sure you’re parsing and
>> pasting all the strings correctly.
>> —Jennifer
>>
>>
>> -Justin
>>
>> On Tue, Jul 5, 2016 at 2:47 PM, Jennifer M Adams <jadams21 at gmu.edu>
>> wrote:
>>
>>>
>>>
>>> On Jul 5, 2016, at 1:51 PM, Justin Hicks <jhicks2014 at gmail.com> wrote:
>>>
>>> Jennifer,
>>>
>>> How would I go about making the lat/lon values fixed? I know the aave
>>> function needs 4 different lat/lon arguments. Would this just be 'd
>>> ave(.......,lon=-179.5,lon=-179.5,lat=-89.5,lat=-89.5)’
>>>
>>> Correct. These args provide the range for your average.
>>>
>>>    or     'd ave(.......,x=1,x=1,y=1,y=1)’?
>>>
>>> No. This will give you an average over only one grid point.
>>>
>>> The ‘set x 1’ and ’set y 1’ commands are there to restrict the dimension
>>> environment to match the result that comes out of aave(), which does not
>>> vary in X or Y. Those dimensions need to be fixed, and it doesn’t matter at
>>> all what they are, it could just as easily be ‘set x 22’ and ‘set y 89’.
>>>
>>> —Jennifer
>>>
>>>
>>>
>>> -Justin
>>>
>>> On Tue, Jul 5, 2016 at 12:25 PM, Jennifer M Adams <jadams21 at gmu.edu>
>>> wrote:
>>>
>>>> Hi, Justin —
>>>> Your dimension environment isn’t set properly. When using the aave()
>>>> function, make sure the lat and lon dimensions are fixed — you’ve got them
>>>> varying. Also, the LEV dimension value at z=1 may be different for your two
>>>> data sets. Put in a 'say result’ statement after each display and it should
>>>> print out more than just the warning message; it should show you what the
>>>> dimensions are for the variables in your expression, and that should guide
>>>> you as to where the mismatch is. I also think you can remove most of the
>>>> code before the 'while’ statement:
>>>>
>>>> ‘open /data2/control/Region15_AFR_mask_TEST.nc'
>>>> 'open /data2/control/GLDAS_VIC10_M.ctl'
>>>> ‘set dfile 2’
>>>> ‘set x 1’
>>>> ‘set y 1’
>>>> ‘set gxout print'
>>>> ‘set prnopts %6.2f 1 1’
>>>> nmonths=428
>>>> i=1
>>>> while (i<nmonths)
>>>>   ‘set t ‘i
>>>>   ...
>>>>   ‘d aave ….'
>>>>   say ‘t=’t’
>>>>   say result
>>>>   ….
>>>>   i=i+1
>>>> endwhile
>>>>
>>>> —Jennifer
>>>>
>>>> On Jul 5, 2016, at 12:00 PM, Justin Hicks <jhicks2014 at gmail.com> wrote:
>>>>
>>>> To those who responded,
>>>>
>>>> Thank you for the responses! Those seemed to do the trick. However,
>>>> instead of the 'endwhile' error, I am now receiving this error:
>>>>
>>>> Data Request Warning:  Request is completely outside file limits
>>>>
>>>> This error is repeated 9 times. The text file that is created also
>>>> contains only one column with each value being 0.0.
>>>>
>>>> -Justin
>>>>
>>>> On Tue, Jul 5, 2016 at 11:38 AM, sushant puranik <
>>>> sushantpuranik at gmail.com> wrote:
>>>>
>>>>> Along with the suggested changes simply press enter button once at
>>>>> ending line of your script.
>>>>> On 5 Jul 2016 8:45 pm, "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
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> gradsusr mailing list
>>>>> gradsusr at gradsusr.org
>>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>>
>>>>>
>>>> _______________________________________________
>>>> gradsusr mailing list
>>>> gradsusr at gradsusr.org
>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>
>>>>
>>>> --
>>>> Jennifer Miletta Adams
>>>> Center for Ocean-Land-Atmosphere Studies (COLA)
>>>> George Mason University
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> gradsusr mailing list
>>>> gradsusr at gradsusr.org
>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>
>>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>>
>>> --
>>> Jennifer Miletta Adams
>>> Center for Ocean-Land-Atmosphere Studies (COLA)
>>> George Mason University
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>> --
>> Jennifer Miletta Adams
>> Center for Ocean-Land-Atmosphere Studies (COLA)
>> George Mason University
>>
>>
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20160707/8239e403/attachment.html 


More information about the gradsusr mailing list