*TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT * Author : Martin V. Mathew , email: vmartinmathew@gmail.com * Prepared on : 12 June 2011 *LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL 'reinit' 'set display color white' 'c' *=========================================================================== * 1) Defining names of input file and figures *=========================================================================== * Define i/p file names InFile1='GTOPO30_5min.nc' ;* Use a bathymetry data file here InFile2Prt='/users/martin/work/research/test_scripts_figs/scripts/grads/sumesh_pgms/cyclone_trk/';*part of name of cyclone tracks *Define the output '.eps' file name. figname='fig_track_cyclone' outeps=figname%'.eps' 'enable print 'figname *=========================================================================== * 2) Stanard setting of the "vpage" ('xmin' 'xmax' 'ymin' 'ymax') *=========================================================================== xMn=0.0 xMx=11.0 yMn=0.0 yMx=8.5 *=========================================================================== * 3) Setting parameters for each subplot. These parameters can be changed * depending on our requirement. * maxt --> Total no of subplots (for 12 months it is 12) * nos --> No of subplots falling in each figure * imax, jmax --> No of columns, rows falling in each figure. *=========================================================================== maxt=1 ;*Total no of months to be plotted for each data nos=1 ;*No of subplots in each figure imax=1 ;*No of columns jmax=1 ;*No of rows *=========================================================================== * 4) Specify the figure layout (specifically sub-plot related) * informations such as: * These parameters can be changed depending on our requirement. * SuWt --> Width of each subplot * SuHt --> Height of each subplot * LfMgn --> Left margin width (ie. how much space need to be given from the * left margin of the page.) * TpMgn --> Top margin width (ie. how much space need to be given from the * top margin of the page.) * VrtSpc --> Vertical space between two subplots * HztlSpc --> Horizontal space between two subplots *=========================================================================== SuWt=7.5 ; SuHt=6.00 ; LfMgn=0.6 ; TpMgn=0.6 ; VrtSpc=0.040 ; HztlSpc=0.05 ; *=========================================================================== * 5) Specify number of cyclone tracks to be plotted *=========================================================================== trkNo=4 *=========================================================================== * 6) Specify ascii file names containing lat lon cordinates of cyclone track.^M * No of files should be same as the variable 'trkNo' specified earlier^M * This file name is appended to the path of the file given by variable 'InFile2Prt' *=========================================================================== trkFile.1='track1.asc' trkFile.2='track2.asc' trkFile.3='track3.asc' trkFile.4='track4.asc' *=========================================================================== * 7) Specifying number of points to be plotted for each cyclone track using a ^M * compoud variable.^M *=========================================================================== trk1.1=12 trk1.2=11 trk1.3=11 trk1.4=12 *TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT * 8) Defining contour properties and legend details *LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL * Again, different compound variables are used... * [a] First, define the line style *------------------------------------------------------------------- LnStyl=1 ;* at present all cyclone tracks are given by solid line. * [b] Second, define the marker style. *------------------------------------------------------------------- * Different markers are used to distinguish cyclones of 5 catogories. * But at present we dont have cyclone catogory data, therefore now all cyclones * tracks are plotted using the same markers. We can * Here, for example, MkrStyl.1=3 means for catagory 1 cyclone. MkrStyl.1=0 ;* closed circle || Cat 1 MkrStyl.2=3 ;* closed circle || Cat 2 MkrStyl.3=5 ;* closed square || Cat 3 MkrStyl.4=6 ;* multiplication sign || Cat 4 MkrStyl.5=9 ;* closed triangle || Cat 5 * [Note: at present all cyclones are marked using closed circle, since we havint catogorized cyclones] * [c] Third, define the color for contours and markers. *------------------------------------------------------------------- LnClr=2 ;* All cyclone tracks are given by same color *=========================================================================== * 9) Plotting basemap/ bathymetry data *=========================================================================== 'sdfopen 'InFile1 'set lat 5 27' ; 'set lon 45 100' io=1 jo=1 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Calculating location of subplot sxMn=LfMgn+(io-1)*(SuWt+HztlSpc) sxMx=LfMgn+io*SuWt+(io-1)*HztlSpc syMn=yMx-(TpMgn+jo*SuHt+(jo-1)*VrtSpc) syMx=yMx-(TpMgn+(jo-1)*(SuHt+VrtSpc)) *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'set vpage 'xMn' 'xMx' 'yMn' 'yMx 'set parea 'sxMn' 'sxMx' 'syMn' 'syMx 'set gxout shaded' 'set csmooth on' 'set grid on' 'set grads off' 'set font 1' 'set xlab on' 'set ylab on' 'set xlpos 0 b' 'set ylpos 0 l' 'set font 1' 'set cthick 6' 'set ylab on' 'set xlab on' 'set clab off' 'set xlopts 0 0 0' 'set ylopts 0 0 0' 'set mpdset hires' 'set map 1 1 1' 'set clevs 0 ' 'set ccols 0 15' 'display htsd' ;* Bathymetry variable *=========================================================================== * 9) Plotting cyclone tracks *=========================================================================== dta1=trkNo dta=0 while(dta1>0) dta=dta+1 dtaFile=InFile2Prt%trkFile.dta say 'reading from file 'dtaFile res=read(dtaFile) ;* skipping first line of cyclone track data file say 'title line 'res rows=trk1.dta res=read (dtaFile);* Reading first lat lon points anslin2=sublin(res,2) say 'second row ' res lonpt1=subwrd (anslin2,1) latpt1=subwrd (anslin2,2) 'q w2xy 'lonpt1' 'latpt1 *'q w2xy 100 28' will give result as 'X = 6.22321 Y = 8.08214' * 'x1 = subwrd(result,3)', will take '6.22321', which is in 3rd position in 'result' * and save it in 'x1' x1=subwrd(result,3) y1=subwrd(result,6) while(rows>1) res=read (dtaFile) anslin2=sublin(res,2) lonpt2=subwrd (anslin2,1) latpt2=subwrd (anslin2,2) 'q w2xy 'lonpt2' 'latpt2 x2=subwrd(result,3) y2=subwrd(result,6) 'set line 'LnClr' 'LnStyl;*set line color#