[gradsusr] Making some months be previous/next year when using text file
Jason Phelps
phelpsajason at gmail.com
Fri Jan 24 17:54:35 EST 2014
Hi,
So I'm looking at Wind Vector data for 3-month periods (JFM,FMA,MAM,etc)
using data from the month that is the middle month of this 3-month period.
I have text file I'm using to implement the specific years I want to look.
These are 4 sets of years each set of years for a different phase of QBO.
My question is for when I do November-December-January and
December-January-February...how to get Grads to use my years just as they
are for November/December for computing the Wind Vector composites in that
NDJ case but to add one year to the January ones so that it considers the
next year for January since January is of the next year...and then for the
DJF to subtract one for the December years considered but to keep January
and February as they are.
Here's just a sample of what my text file looks like (I'll have December
one for the NDJ case and a January one for the DJF case):
pos dec neg inc
1966 1988 1965 1977
1980 1993 1974 1994
1995 2001
2011
And my code with the parts involving the text file and t-0,t+2 line I'm
using to get the months highlighted:
'reinit'
'set display color white';'c'
'set grid off'
*- - -
xl=0.4 ; yt=7.5
dx=2.3 ; dy=1.4
*- - -
size.1=2
size.2=4
size.3=2
size.4=3
file='Nov.txt'
ret=read(file)
n=1;while(n<=100)
ret=read(file)
chk=sublin(ret,1);if(chk>0);break;endif
ret=sublin(ret,2)
ip=1;while(ip<=4)
if(n<=size.ip)
* year.ip.n=substr(ret,ip)
year.1.n=substr(ret,1,4)
year.2.n=substr(ret,6,4)
year.3.n=substr(ret,11,4)
year.4.n=substr(ret,16,4)
endif
ip=ip+1;endwhile
n=n+1;endwhile
*= = = = = = = = =
'sdfopen /export1/Databank/NCEP_Month/pressure/uwnd.mon.mean.nc'
'sdfopen /export1/Databank/NCEP_Month/pressure/vwnd.mon.mean.nc'
lv=1 ; while(lv<=2)
'set t 17 775'
if(lv=1); 'set lev 30' ;endif
if(lv=2); 'set lev 200' ;endif
'define pu1=ave(uwnd.1,t-3,t+3)'
'define pu2=ave(uwnd.1,t-16,t+16)'
'define pufilter=pu1-pu2'
'define pv1=ave(vwnd.2,t-3,t+3)'
'define pv2=ave(vwnd.2,t-16,t+16)'
'define pvfilter=pv1-pv2'
ip=1 ; while(ip<=4)
'define ucomp'ip'=const(pufilter,0)'
'define vcomp'ip'=const(pvfilter,0)'
n=1 ; while(n<=size.ip)
'set time oct'year.ip.n *(this I change to suit the 3-month period I'm
using, this one is Oct-Dec)
'ucomp'ip'=ucomp'ip'+ave(pufilter,t-0,t+2)/'size.ip
'vcomp'ip'=vcomp'ip'+ave(pvfilter,t-0,t+2)/'size.ip
n=n+1 ; endwhile
ip=ip+1 ; endwhile
* = = = = = = = = =
*'set gxout shaded'
'set gxout vector'
'umean=(ucomp1+ucomp2+ucomp3+ucomp4)/4'
'vmean=(vcomp1+vcomp2+vcomp3+vcomp4)/4'
ip=1 ; while(ip<=4)
'define utot'ip'= ucomp'ip' - umean'
'define vtot'ip'= vcomp'ip' - vmean'
ip=ip+1 ; endwhile
* plotting
ip=1 ; while(ip<=4)
xr=xl+dx
yb=yt-dy
'set parea 'xl' 'xr' 'yb' 'yt
'set lat -90 90'
'set lon 0 360'
'set lev 30'
'set mproj scaled'
'set ccolor 1'
'set map 11'
'set annot 1 2'
'set xlopts 15 1 0.08'
'set ylopts 15 1 0.08'
len=0.1
scale=3
'color -10 10 -kind green->white->orangered'
'd utot'ip
*'set gxout vector'
*'set arrscl 'len' 'scale
*'set arrlab off'
*'set arrowhead -0.2'
*'d skip(utot'ip',6);skip(vtot'ip',6)'
'set gxout stream'
'set cthick 1' ; 'set ccolor 1'
'set strmden 1'
'd utot'ip';vtot'ip
'set string 1 c 5'
'set strsiz 0.1 0.1'
'draw string 1.5 8.1 (1) Oct-Dec 30mb'
'draw string 1.5 7.9 Wind Anomaly'
'draw string 1.5 7.7 QBO Positive Phase'
'set string 1 c 5'
'set strsiz 0.1 0.1'
'draw string 4.2 8.1 (2) Oct-Dec 30mb'
'draw string 4.2 7.9 Wind Anomaly'
'draw string 4.2 7.7 QBO Decreasing Phase'
'set string 1 c 5'
'set strsiz 0.1 0.1'
'draw string 6.9 8.1 (3) Oct-Dec 30mb'
'draw string 6.9 7.9 Wind Anomaly'
'draw string 6.9 7.7 QBO Negative Phase'
'set string 1 c 5'
'set strsiz 0.1 0.1'
'draw string 9.6 8.1 (4) Oct-Dec 30mb'
'draw string 9.6 7.9 Wind Anomaly'
'draw string 9.6 7.7 QBO Increasing Phase'
'set string 1 c 5'
'set strsiz 0.1 0.1'
'draw string 1.5 4.7 (1) Oct-Dec 200mb'
'draw string 1.5 4.5 Wind Anomaly'
'draw string 1.5 4.3 QBO Positive Phase'
'set string 1 c 5'
'set strsiz 0.1 0.1'
'draw string 4.2 4.7 (2) Oct-Dec 200mb'
'draw string 4.2 4.5 Wind Anomaly'
'draw string 4.2 4.3 QBO Decreasing Phase'
'set string 1 c 5'
'set strsiz 0.1 0.1'
'draw string 6.9 4.7 (3) Oct-Dec 200mb'
'draw string 6.9 4.5 Wind Anomaly'
'draw string 6.9 4.3 QBO Negative Phase'
'set string 1 c 5'
'set strsiz 0.1 0.1'
'draw string 9.6 4.7 (4) Oct-Dec 200mb'
'draw string 9.6 4.5 Wind Anomaly'
'draw string 9.6 4.3 QBO Increasing Phase'
xl=xr+0.4
ip=ip+1 ; endwhile
xl=0.4
yt=yb-2.0
lv=lv+1 ; endwhile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20140124/d78f0a44/attachment.html
More information about the gradsusr
mailing list