Tuesday, April 28, 2009

Tex

This section describes some of the major advantages that TeX systems enjoy.
Compared to word processors

Most people have used a word processor, so a comparison may be helpful.

With a word processors your text is placed while you type it, referred to as "what you see is what you get." In contrast, TeX is a formatter: it separates the steps of entering the material and placing it on the page.

To see the difference, consider how a typical user of each system might start a new section. In a word processor a typical user might start that section by hitting twice to get two lines of vertical space, typing "Section 1.2: New results", clicking to highlight that text, clicking to select a larger type size, clicking to select a new type style, and finally entering two more lines of vertical space. A typical user TeX user will type into a file the line "\section{New results}". That is, a word processing user is formatting the text as they enter it, while the TeX user describes the meaning of the text and later TeX will format it.

Beginners like word processing but when they graduate to complex jobs the appeal fades. Word processing a twenty page technical article is hard; for instance, keeping the vertical space between sections uniform is error-prone, and so is making sure that all of the bibliographic entries follow the required format. In particular, very few people have both the knowledge and the eye to correctly lay out equations — people often say their equations "just don't look right." That is, as a user becomes more experienced and knowledgable the TeX approach of having the typesetting done by the program becomes the better choice. (Some word processors offer as advanced features TeX-like facilities for organizing input text, although few users take advantage of them.)

Wednesday, April 1, 2009

Grads code for active-break cross anomaly

Prompt 'Enter the folder name: '
pull fld
'!mkdir ../'fld

'reinit'
prompt 'Enter the starting year:'
pull y1
prompt 'Enter the ending year:'
pull yn

newseas=y
while(newseas=y)
'clear'
prompt 'Enter the season : '
pull season

prompt ' enter the starting month as number: '
pull m1
n=m1
if(n=1)
mmm='jan'
endif
if(n=2)
mmm='feb'
endif
if(n=3)
mmm='mar'
endif
if(n=4)
mmm='apr'
endif
if(n=5)
mmm='may'
endif
if(n=6)
mmm='jun'
endif
if(n=7)
mmm='jul'
endif
if(n=8)
mmm='aug'
endif
if(n=9)
mmm='sep'
endif
if(n=10)
mmm='oct'
endif
if(n=11)
mmm='nov'
endif
if(n=12)
mmm='dec'
endif
mmm1=mmm
prompt 'Enter the starting day: '
pull d1
prompt ' enter the ending month as number: '
pull mn
n=mn
if(n=1)
mmm='jan'
endif
if(n=2)
mmm='feb'
endif
if(n=3)
mmm='mar'
endif
if(n=4)
mmm='apr'
endif
if(n=5)
mmm='may'
endif
if(n=6)
mmm='jun'
endif
if(n=7)
mmm='jul'
endif
if(n=8)
mmm='aug'
endif
if(n=9)
mmm='sep'
endif
if(n=10)
mmm='oct'
endif
if(n=11)
mmm='nov'
endif
if(n=12)
mmm='dec'
endif
mmmn=mmm
prompt 'Enter the ending day: '
pull dn

'open sst6098.ctl'
'set lat -25 25'
'set lon 50 180'
'set time 'dn''mmmn''yn''
'set sdfwrite clim.'key'.nc'
'define cp=0'
'define ct=0'
'define cu=0'
'close 1'

'open sst6098.ctl'
'set lat -25 25'
'set lon 50 180'
*'set mproj scaled'
'set time 'd1''mmm1''y1' 'dn''mmmn''yn''
'define t=ave(sst,time='d1''mmm1',time='dn''mmmn')'
'set time 'dn''mmmn''yn''
'define ct=ave(t,time='d1''mmm1''y1',time='dn''mmmn''yn')'
'undefine t'
'set grads off'
'set gxout shaded'
'set clevs 298.5 299 299.5 300 300.5 301 301.5 302 302.5 303 303.5 304'
'set ccols 9 14 4 11 5 13 3 10 7 12 8 2 6'
'd ct'
'cbarn'
'set gxout contour'
*'set ccolor 0'
'd ct'
'sdfwrite ct'
*'undefine ct'
'close 1'
'draw title sst climatology 'season''
'printim ../'fld'/climatology_'season'_'sst'.jpg white'

'clear'
'sdfopen slp.nc'
'set lat -25 25'
'set lon 50 180'
*'set mproj scaled'
'set time 'd1''mmm1''y1' 'dn''mmmn''yn''
'define p=ave(slp,time='d1''mmm1',time='dn''mmmn')'
'set time 'dn''mmmn''yn''
'define cp=ave(p,time='d1''mmm1''y1',time='dn''mmmn''yn')'
'undefine p'
'set grads off'
'set gxout shaded'
'd cp'
'cbarn'
'set gxout contour'
'set ccolor 0'
'd cp'
'sdfwrite cp'
*'undefine cp'
'close 1'
'draw title slp climatology 'season''
'printim ../'fld'/climatology_'season'_'slp'.jpg white'

'clear'
'open u850.ctl'
'set lat -25 25'
'set lon 50 180'
*'set mproj scaled'
'set time 'd1''mmm1''y1' 'dn''mmmn''yn''
'define uw=ave(u,time='d1''mmm1',time='dn''mmmn')'
'set time 'dn''mmmn''yn''
'define cu=ave(uw,time='d1''mmm1''y1',time='dn''mmmn''yn')'
'undefine uw'
'set grads off'
'set gxout shaded'
'd cu'
'cbarn'
'set gxout contour'
'd cu'
'cbarn'
'sdfwrite ct'
*'undefine cu'
'close 1'
'draw title u wind climatology 'season''
'printim ../'fld'/climatology_'season'_'uwind'.jpg white'






num=1

'sdfopen slp.nc'
'open sst6098.ctl'
'open u850.ctl'
'set time 31dec1960'
'set lat -25 25'
'set lon 50 180'
'define sp1=0'
'define st1=0'
'define su1=0'
'close 3'
'close 2'
'close 1'

prompt 'Enter the Key word (Active/Break) : '
pull key
prompt 'Enter the year:'
pull yyyy


while(yyyy>1950)
prompt ' enter the starting month as number: '
pull m1
n=m1
if(n=1)
mmm='jan'
endif
if(n=2)
mmm='feb'
endif
if(n=3)
mmm='mar'
endif
if(n=4)
mmm='apr'
endif
if(n=5)
mmm='may'
endif
if(n=6)
mmm='jun'
endif
if(n=7)
mmm='jul'
endif
if(n=8)
mmm='aug'
endif
if(n=9)
mmm='sep'
endif
if(n=10)
mmm='oct'
endif
if(n=11)
mmm='nov'
endif
if(n=12)
mmm='dec'
endif
mmm1=mmm
prompt 'Enter the starting day: '
pull d1
prompt ' enter the ending month as number: '
pull mn
n=mn
if(n=1)
mmm='jan'
endif
if(n=2)
mmm='feb'
endif
if(n=3)
mmm='mar'
endif
if(n=4)
mmm='apr'
endif
if(n=5)
mmm='may'
endif
if(n=6)
mmm='jun'
endif
if(n=7)
mmm='jul'
endif
if(n=8)
mmm='aug'
endif
if(n=9)
mmm='sep'
endif
if(n=10)
mmm='oct'
endif
if(n=11)
mmm='nov'
endif
if(n=12)
mmm='dec'
endif
mmmn=mmm
prompt 'Enter the ending day: '
pull dn


'clear'
'sdfopen slp.nc'
'set lat -25 25'
'set lon 50 180'
*'set mproj scaled'
'set time 'd1''mmm1'1960'
'define p=ave(slp,time='d1''mmm1''yyyy',time='dn''mmmn''yyyy')'
'set time 31dec1960'
'define sp1=sp1+p'
'undefine p'
'define csp=sp1/'num''
'set grads off'
'set gxout shaded'
'd csp'
'cbarn'
'set gxout contour'
'd csp'
'draw title slp climatology 'season'\'key''
'printim ../'fld'/climatology_'key'_'season'_'slp'.jpg white'
'clear'
'set gxout shaded'
'd csp-cp'
'cbarn'
'set gxout contour'
'd csp-cp'
'draw title slp Anomaly 'season'\'key''
'printim ../'fld'/Anomaly_'key'_'season'_'slp'.jpg white'
'undefine csp'
'close 1'

'clear'
if (yyyy<=1998)
'open sst6098.ctl'
'set lat -25 25'
'set lon 50 180'
*'set mproj scaled'
'set time 'd1''mmm1''1960''
'define t=ave(sst,time='d1''mmm1''yyyy',time='dn''mmmn''yyyy')'
'define st1=st1+t'
'undefine t'
'define cst=st1/'num''
'set grads off'
'set gxout shaded'
'd cst'
'cbarn'
'set gxout contour'
'd cst'
'draw title sst climatology 'season'\'key''
'printim ../'fld'/climatology_'key'_'season'_'sst'.jpg white'
'clear'
'set gxout shaded'
'd cst-ct'
'cbarn'
'set gxout contour'
'd cst-ct'
'draw title sst Anomaly 'season'\'key''
'printim ../'fld'/Anomaly_'key'_'season'_'sst'.jpg white'
'undefine cst'
'close 1'
endif

'clear'
'open u850.ctl'
'set lat -25 25'
'set lon 50 180'
*'set mproj scaled'
'set time 'd1''mmm1''1960''
'define uwnd=ave(u,time='d1''mmm1''yyyy',time='dn''mmmn''yyyy')'
'define su1=su1+uwnd'
'undefine uwnd'
'define csu=su1/'num''
'set grads off'
'set gxout shaded'
'd csu'
'cbarn'
'set gxout contour'
'd csu'
'draw title u wind climatology 'season'\'key''
'printim ../'fld'/climatology_'key'_'season'_'uwind'.jpg white'
'clear'
'set gxout shaded'
'd csu-cu'
'cbarn'
'set gxout contour'
'd csu-cu'
'draw title u wind Anomaly 'season'\'key''
'printim ../'fld'/Anomaly_'key'_'season'_'uwind'.jpg white'
'undefine csu'
'close 1'

prompt 'Enter the next year:'
pull yyyy

num=num+1
endwhile
'define csp1=sp1/('num'-1)'
'undefine sp1'
'define cst1=st1/('num'-1)'
'undefine st1'
'define csu1=su1/('num'-1)'
'undefine su1'

num=1

'sdfopen slp.nc'
'open sst6098.ctl'
'open u850.ctl'
'set time 31dec1960'
'set lat -25 25'
'set lon 50 180'
'define sp2=0'
'define st2=0'
'define su2=0'
'close 3'
'close 2'
'close 1'

prompt 'Enter the Key word (Active/Break) : '
pull key
prompt 'Enter the year:'
pull yyyy

while(yyyy>1950)
prompt ' enter the starting month as number: '
pull m1
n=m1
if(n=1)
mmm='jan'
endif
if(n=2)
mmm='feb'
endif
if(n=3)
mmm='mar'
endif
if(n=4)
mmm='apr'
endif
if(n=5)
mmm='may'
endif
if(n=6)
mmm='jun'
endif
if(n=7)
mmm='jul'
endif
if(n=8)
mmm='aug'
endif
if(n=9)
mmm='sep'
endif
if(n=10)
mmm='oct'
endif
if(n=11)
mmm='nov'
endif
if(n=12)
mmm='dec'
endif
mmm1=mmm
prompt 'Enter the starting day: '
pull d1
prompt ' enter the ending month as number: '
pull mn
n=mn
if(n=1)
mmm='jan'
endif
if(n=2)
mmm='feb'
endif
if(n=3)
mmm='mar'
endif
if(n=4)
mmm='apr'
endif
if(n=5)
mmm='may'
endif
if(n=6)
mmm='jun'
endif
if(n=7)
mmm='jul'
endif
if(n=8)
mmm='aug'
endif
if(n=9)
mmm='sep'
endif
if(n=10)
mmm='oct'
endif
if(n=11)
mmm='nov'
endif
if(n=12)
mmm='dec'
endif
mmmn=mmm
prompt 'Enter the ending day: '
pull dn


'clear'
'sdfopen slp.nc'
'set lat -25 25'
'set lon 50 180'
*'set mproj scaled'
'set time 'd1''mmm1'1960'
'define p=ave(slp,time='d1''mmm1''yyyy',time='dn''mmmn''yyyy')'
'set time 31dec1960'
'define sp2=sp2+p'
'undefine p'
'define csp=sp2/'num''
'set grads off'
'set gxout shaded'
'd csp'
'cbarn'
'set gxout contour'
'd csp'
'draw title slp climatology 'season'\'key''
'printim ../'fld'/climatology_'key'_'season'_'slp'.jpg white'
'clear'
'set gxout shaded'
'd csp-cp'
'cbarn'
'set gxout contour'
'd csp-cp'
'draw title slp Anomaly 'season'\'key''
'printim ../'fld'/Anomaly_'key'_'season'_'slp'.jpg white'
'undefine csp'
'close 1'

'clear'
if (yyyy<=1998)
'open sst6098.ctl'
'set lat -25 25'
'set lon 50 180'
*'set mproj scaled'
'set time 'd1''mmm1''1960''
'define t=ave(sst,time='d1''mmm1''yyyy',time='dn''mmmn''yyyy')'
'define st2=st2+t'
'undefine t'
'define cst=st2/'num''
'set grads off'
'set gxout shaded'
'd cst-ct'
'cbarn'
'set gxout contour'
'd cst'
'draw title sst climatology 'season'\'key''
'printim ../'fld'/climatology_'key'_'season'_'sst'.jpg white'
'clear'
'set gxout shaded'
'd cst-ct'
'cbarn'
'set gxout contour'
'd cst-ct'
'draw title sst Anomaly 'season'\'key''
'printim ../'fld'/Anomaly_'key'_'season'_'sst'.jpg white'
'undefine cst'
'close 1'
endif

'clear'
'open u850.ctl'
'set lat -25 25'
'set lon 50 180'
*'set mproj scaled'
'set time 'd1''mmm1''1960''
'define uwnd=ave(u,time='d1''mmm1''yyyy',time='dn''mmmn''yyyy')'
'define su2=su2+uwnd'
'undefine uwnd'
'define csu=su2/'num''
'set grads off'
'set gxout shaded'
'd csu'
'cbarn'
'set gxout contour'
'd csu'
'draw title u wind climatology 'season'\'key''
'printim ../'fld'/climatology_'key'_'season'_'uwind'.jpg white'
'clear'
'set gxout shaded'
'd csu-cu'
'cbarn'
'set gxout contour'
'd csu-cu'
'draw title u wind Anomaly 'season'\'key''
'printim ../'fld'/Anomaly_'key'_'season'_'uwind'.jpg white'
'undefine csu'
'close 1'

prompt 'Enter the next year:'
pull yyyy

num=num+1
endwhile
'define csp2=sp2/('num'-1)'
'undefine sp2'
'define cst2=st2/('num'-1)'
'undefine st2'
'define csu2=su2/('num'-1)'
'undefine su2'
'clear'
'set gxout shaded'
'set clevs -240 -200 -160 -120 -80 -40 0 40 80 120 160 200 240'
'set ccols 9 14 4 11 5 13 3 10 7 12 8 2 6'
'd csp1-csp2'
'cbarn'
'set gxout contour'
'd csp1-csp2'
'undefine csp1'
'undefine csp2'
'draw title 'season' slp climatology cross anomaly'
'printim ../'fld'/climatology_cross_anomaly_'season'_'slp'.jpg white'
'clear'
'set gxout shaded'
'set clevs -1.2 -1.0 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1.0 1.2'
'set ccols 9 14 4 11 5 13 3 10 7 12 8 2 6'
'd cst1-cst2'
'cbarn'
'set gxout contour'
'd cst1-cst2'
'draw title 'season' sst climatology cross anomaly'
'printim ../'fld'/climatology_cross_anomaly_'season'_'sst'.jpg white'
'undefine cst1'
'undefine cst2'
'clear'
'set gxout shaded'
'set clevs -12 -10 -8 -6 -4 -2 0 2 4 6 8 10 12'
'set ccols 9 14 4 11 5 13 3 10 7 12 8 2 6'
'd csu1-csu2'
'cbarn'
'set gxout contour'
'd csu1-csu2'
'draw title 'season' u wind climatology cross anomaly'
'printim ../'fld'/climatology_cross_anomaly_'season'_'uwind'.jpg white'
'undefine csu1'
'undefine csu2'
'clear'
prompt 'Do you have another season: '
pull newseas
endwhile