[gradsusr] how to get average of a country

Kishore Ragi kishoreragi at gmail.com
Sun Apr 14 02:31:33 EDT 2013


you check once as follows

set lon 61.25 143.75
set lat 8.75 56.25
d maskout(pdsi,1)

if it visualizes only your area, your code should be right . Otherwise, try
as I suggested

Best regards,

Kishore


On Sun, Apr 14, 2013 at 11:55 AM, Kishore Ragi <kishoreragi at gmail.com>wrote:

> hi,
>
> You have opened maskout_china.ctl as second file so the command should be
> as follow
>
>
> *'define mpdsi=aave(maskout(pdsi,mask.2),lon=x1,lon=x2,lat=y1,lat=y2)' *
>
> I don't know about your tloop but, it give area average (country average)
> of your interest leaving rest of the area.
>
> Hope it solves your purpose....
>
> Best regards,
>
> Kishore
>
>
> On Sun, Apr 14, 2013 at 11:33 AM, <fairyes at zju.edu.cn> wrote:
>
>> Dear Kishore,
>>
>> Thank you for your remind. I'm sorry for my unclearly expression.
>>
>> I want to get the timeseries of average pdsi value about china, next is
>> the gs file I once used which was not precisely about china:
>> 'sdfopen d:/grads/mada/data.cdf'
>> 'set lon 73.66'
>> 'set lat 4'
>> 'set lev 0 0'
>> 'set e 1 1'
>> 'set t 114 121'
>> 'define mpdsi=tloop(aave(pdsi,lon=73.66,lon=135.08,lat=4,lat=53.52))'
>> 'set xlopts 1 5 0.25'
>> 'set ylopts 1 5 0.15'
>> 'set gxout line'
>> 'set cthick 7'
>> 'set grads off'
>> 'd mpdsi'
>> 'draw title MADA,IVI2 event_1416'
>> 'printim d:/grads/mada/event_1416.png white x1600 y1200'
>> ;
>>
>> then after saw the method, I tried it to make my timeseries precisely
>> about china, as the pdsi data are in a 2.5°regular grid, I set the xsize
>> and ysize in meteoinfo to both 2.5, and then get the maskout_china dat
>> file and ctl file from meteoinfo, after that, as the ctl file of pdsi data
>> are built-in,and after I use sdopen comman to open the data.cdf, it shows
>> the 'time values set: 1300:6:23:18 ', and I have known its time period are
>> from 1300 to 2005, so I changed the next part in maskout_china ctl file:TDEF 706 LINEAR 18:00Z23JUN1300 1yr.
>>
>>
>> Then I change my gs file as below:
>>
>> 'sdfopen d:/grads/mada/data.cdf'
>> 'open d:/grads/mada/maskout_china.ctl'
>> 'set lon 73.66'
>> 'set lat 4'
>> 'set lev 0 0'
>> 'set e 1 1'
>> 'set t 114 121'
>> *'define mpdsi=tloop(aave(pdsi,maskout(pdsi,mask)))'*
>> 'set xlopts 1 5 0.25'
>> 'set ylopts 1 5 0.15'
>> 'set gxout line'
>> 'set cthick 7'
>> 'set grads off'
>> 'd mpdsi'
>> 'draw title MADA,IVI2 event_1416'
>> 'printim d:/grads/mada/event_1416_precise.png white x1600 y1200'
>> ;
>>
>> when I run the above gs file, opengrads
>> showed:                                                    error from aave:
>> too many or two few
>> args                                                             5
>> arguments
>> expected
>>   operation error: error from aave
>> function                                                      operation
>> error: error from tloop
>> function                                                         error
>> occured at column
>> 1
>> define error: invalid
>> expression
>> syntax error: invalid
>> operand
>> 'mpdsi' not a variable or function
>> name                                                           error
>> occured at column
>> 1
>> display error: invalid
>> expression
>> expression = mpdsi
>>
>> Maybe I just didn't know how to use the maskout_china dat and ctl file
>> correctly in my gs file, or the modification of maskout_china ctl file I
>> made have some errors? I don't know why it shows so many errors in the next
>> while it can be done in the above one. Any guidance or tip? Thank you very
>> much!
>>
>> Looking forward to your reply! Best regards!
>>
>> Zhihong
>>
>>
>>
>>
>>
>>
>> --
>>
>>  Zhihong Zhuo,Postgraduate Student
>>
>>  College of Environmental and Resource Sciences, Zhejiang University
>>
>> Address: 866 Yuhangtan Road, Hangzhou, China
>>
>> Email: fairyes at zju.edu.cn
>>
>>
>>
>> _______________________________________________
>> 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/20130414/1f4fe90f/attachment-0003.html 


More information about the gradsusr mailing list