[gradsusr] function

Charles Seman charles.seman at noaa.gov
Wed Jul 11 17:48:55 EDT 2012


Wendi,

Probably Examples 4 and 5 at 
http://grads.iges.org/grads/gadoc/gradfuncave.html might be more 
informative in terms of using a fixed dimension environment; especially 
note example 5:
---
The use of the define command can make certain operations much more 
efficient. If you want to calculate standard deviation, for example:

     sqrt(ave(pow(ave(z,t=1,t=20)-z,2),t=1,t=20))

     would be correct, but the inside average would be calculated 20 
times. Defining the inside average in advance will be substantially faster:

     define zave = ave(z,t=1,t=20)
     d sqrt(ave(pow(zave-z,2),t=1,t=20))
---

Chuck

On 07/11/2012 05:32 PM, Charles Seman wrote:
> Wendi,
>
> An idea; set the time dimension to span t=1,15 for the definition of "R":
>
> 'set t 1 15'
> 'R=pow((pow(10, ref/10))/200,5/8)'
> 'set t 1' ;* see discussion below
> 'd sum(R, t=1, t=15)'
>
> 'set t 1': for displaying sum; this is OK to go from time range to a
> single time level to do the sum (see "wild cards" discussion at
> http://grads.iges.org/grads/gadoc/variable.html#new); if left as 'set t
> 1 15', I think you would get 15 time levels with same "sum" result for
> the display command... you could try it both ways to see what you get...
>
> Hope this helps,
> Chuck
>
> On 07/06/2012 05:53 AM, wendi harjupa wrote:
>> Dear Grads users,
>>
>> I have problem,
>> below is  my descriptor file
>>
>> DSET /misc/home/wendi/data1/radar/kototabang/XDR/data/20040410/%d2%h2.dat
>> TITLE  RADAR
>> OPTIONS  TEMPLATE LITTLE_ENDIAN
>> UNDEF  -1000
>> XDEF    321 LINEAR    99.688120996    0.004492369
>> YDEF    321 LINEAR    -1.083708891    0.004522556
>> ZDEF    39  LINEAR   1.0 0.5
>> TDEF    15 LINEAR 21:00Z10apr2004  4mn
>> VARS    2
>> ref 39  99  Reflectivity(dBZ)
>> vel 39  99  Doppler Velocity(m/s)
>> ENDVARS
>>
>> As you see time is 15,
>>
>> I want to convert the ref (dbz) to Rain (mm/hr)
>> by using Z-R correlation formula, as below :
>>
>> 'pow((pow(10, R/10))/200,5/8)',
>>
>> Then I want to accumulate the rainrate for 1 hour,
>> I use this formula :
>>
>> 'sum(ref, t=1, t=15)'
>>
>> But I got strange result.
>>
>> Here my complete gs file,
>>
>> 'reinit'
>> 'set grads off'
>> 'set mproj latlon'
>> 'set mpdset hires'
>> 'set gxout shaded'
>> 'open RHI.ctl'
>> 'set lon 100 100.8'
>> 'set lat -0.45'
>> 'set Z 1 19'
>> 'set parea 1 7.5 2.8 8.3'
>> 'set clevs 0 50 100 150 200 250 300 350 400 450 500 550 600'
>> 'set ccols 9 14 4 11 5 13 3 10 7 12 8 2 6'
>> 'R=pow((pow(10, ref/10))/200,5/8)'
>> 'd sum(R, t=1, t=15)'
>> 'run /misc/home/wendi/grads-2.0.1/cbarn 0.7 0.7 7.9 5.2'
>> 'draw string  7.7 7.8 [dBz]'
>>
>> Would you help me, about this,
>> please let me know, which part I got wrong
>>
>> Thank you very much!
>>
>> Best regards,
>> wendi
>>
>>
>> --
>> -------------
>> Wendi Harjupa. ST
>> ShimaneUniversityGraduateSchool ofEngineering Sciences
>> Department ofElectronic ControlSystems
>> RemoteSensingLaboratory
>> s119447
>> Cellphone : +81-080-4268-6676
>> email : wendi at rslab.riko.shimane-u.ac.jp
>> <mailto:wendi at rslab.riko.shimane-u.ac.jp>
>>
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>

-- 

Please note that Charles.Seman at noaa.gov should be considered my NOAA
email address, not cjs at gfdl.noaa.gov.

********************************************************************
  Charles Seman                                Charles.Seman at noaa.gov
  U.S. Department of Commerce / NOAA / OAR
  Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
  201 Forrestal Road                              fax: (609) 987-5063
  Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
********************************************************************

"The contents of this message are mine personally and do not reflect any
official or unofficial position of the United States Federal Government,
the United States Department of Commerce, or NOAA."





More information about the gradsusr mailing list