[gradsusr] plot the average wind vector

Jeff Duda jeffduda319 at gmail.com
Wed Nov 9 17:42:53 EST 2011


Yi-Chih,
I've done some experimenting with my own data sets.  Here's what worked for
me.  You'll want to adjust the ii, jj, and max values back to your own.  I
forgot to reset jj = 1 in the first while loop (not the same as FORTRAN DO
loops).  Also, I guess you have to define the first guess field as a
non-constant field (i.e., just define it as one of your other fields
already in the data file).  Also, I had to add the lines "line =
sublin(result,2)" to correspond to the output to the aave command.  You may
not need that if Grads does not need to interpolate.  You can find out by
manually entering the aave command at the command prompt and look at the
text output.

ii = 1
jj = 1
ii_max = 440
jj_max = 252
'define uave = u'
'define vave = v'
'd aave(u, x=1, x=440, y=1, y=252)'
line = sublin(result,2)
u_value = subwrd(line,4)
'd aave(v, x=1, x=440, y=1, y=252)'
line = sublin(result,2)
v_value = subwrd(line,4)
while (ii <= ii_max)
   jj = 1
   while (jj <= jj_max)
      'set defval uave 'ii' 'jj' 'u_value
      'set defval vave 'ii' 'jj' 'v_value
      jj = jj + 1
   endwhile
   ii = ii + 1
endwhile

Jeff

On Wed, Nov 9, 2011 at 4:17 PM, Jeff Duda <jeffduda319 at gmail.com> wrote:

> Yi-Chih,
> The range error may be due to the units used for the grid location.  See
> the example on the set defval page:
> http://www.iges.org/grads/gadoc/gradcomdsetdefval.html
>
> You might need to start ii and jj at 1 and 1, and translate them to match
> the actual grid you have.  Thus, you may need to modify the script like
> this:
>
> ii = 1
> jj = 1
> ii_max = 93-65
> jj_max = 65-37
>
> 'define uave = 0'
> 'define vave = 0'
> 'd aave(u, x=65, x=93, y=37, y=65)'
> u_value = subwrd(result,4)
> 'd aave(v, x=65, x=93, y=37, y=65)'
> v_value = subwrd(result,4)
> while (ii <= ii_max)
>    while (jj <= jj_max)
>       'set defval uave 'ii' 'jj' 'u_value
>       'set defval vave 'ii' 'jj' 'v_value
>       jj = jj + 1
>    endwhile
>    ii = ii + 1
> endwhile
>
> At the end, make sure you are displaying uave and vave, not u_value and
> v_value.  u_value and v_value are just dummy variables in your script,
> whereas the grid/field you want to display is uave and vave.
>
> Jeff
>
> On Wed, Nov 9, 2011 at 4:05 PM, Yi-Chih Huang <dscpln at gmail.com> wrote:
>
>> Jeff,
>>
>>     Thanks much for the updated information.  The updated error messages
>> are as follows.  The ranges of x and y should be suitable for aave(u, x=65,
>> x=93, y=37, y=65).  I don't understand where "Out of Range" came from.
>>
>>     Thanks,
>>
>>                   Yi-Chih
>>
>> ############################################################
>> ga-> q file
>> File 1 : OUTPUT FROM WRF V3.3 MODEL
>>   Descriptor: Morakot_d01.ctl
>>   Binary: Morakot_d01_%y4-%m2-%d2_%h2:%n2.dat
>>   Type = Gridded
>>   Xsize = 94  Ysize = 84  Zsize = 27  Tsize = 57  Esize = 1
>>
>> #############################################################
>> ga-> test
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> SET DEFVAL Error:  Out of Range
>> Syntax Error:  Invalid Operand
>>   'u_value' not a variable or function name
>>   Error ocurred at column 1
>> DISPLAY error:  Invalid expression
>>   Expression = u_value
>>
>> ###########################################   test.gs
>> ii = 65
>> jj = 37
>> ii_max = 93
>> jj_max = 65
>> 'define uave = 0'
>> 'define vave = 0'
>> 'd aave(u, x=65, x=93, y=37, y=65)'
>> u_value = subwrd(result,4)
>> 'd aave(v, x=65, x=93, y=37, y=65)'
>> v_value = subwrd(result,4)
>> while (ii <= ii_max)
>>    while (jj <= jj_max)
>>       'set defval uave 'ii' 'jj' 'u_value
>>       'set defval vave 'ii' 'jj' 'v_value
>>       jj = jj + 1
>>    endwhile
>>    ii = ii + 1
>> endwhile
>>
>> 'd u_value;v_value'
>> #############################################
>>
>> On Wed, Nov 9, 2011 at 4:48 PM, Jeff Duda <jeffduda319 at gmail.com> wrote:
>>
>>> Yi-Chih,
>>> For my second suggestion, just define the variable as a dummy value
>>> first.
>>>
>>> define uave = 0
>>> define vave = 0
>>>
>>> I think set defval will then overwrite the data.
>>>
>>> Jeff
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>
>
> --
> Jeff Duda
> Grad student - PhD, Meteorology
> University of Oklahoma School of Meteorology - Center for Analysis and
> Prediction of Storms
>
>


-- 
Jeff Duda
Grad student - PhD, Meteorology
University of Oklahoma School of Meteorology - Center for Analysis and
Prediction of Storms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20111109/8055cbbf/attachment-0003.html 


More information about the gradsusr mailing list