例子画多个子图
#!/bin/csh
# program to plot a column file in 2D, color
# uses awk, gmt and other unix commands, so run on a machine that can access these
# set fonts
gmtset ANOT_FONT_SIZE 10 LABEL_FONT_SIZE 10 HEADER_FONT_SIZE 16
set outfil = aver_FSNS_assaw.ps
set COORD = -126.052/-67/25/52.905
set SIZE = 2.812/2.7905
set proj = JX2.4/1.8d
set SH = 2.5
set BSH = -5
set YY = -1.85
set BARa = 0/2400/400
set BARad = -1000/1000/400
set BARs = 0/1000/200
set BARsd = -500/700/200
set COMMON = /nfs/sphere/usr1/chunmei/from_norway/agu/common/cpt_file
set CPTa = $COMMON/str_weak_5_80-230.cpt
set CPTad = $COMMON/str-weak_5_-10-90.cpt
set CPTs = $COMMON/str-weak_5_0-350.cpt
set CPTsd = $COMMON/str_weak_6_-50-130.cpt
set TITLE = ("PCM B0622" "Observed" "PCM - VIC")
set season = ("MAM" "JJA" "SON" "DJF")
set PCMFL = (ann_pcm_SWnet.50-99
spr_pcm_SWnet.50-99
sum_pcm_SWnet.50-99
fall_pcm_SWnet.50-99
win_pcm_SWnet.50-99)
set OBSFL = (ann_vic_SWnet.50-99
spr_vic_SWnet.50-99
sum_vic_SWnet.50-99
fall_vic_SWnet.50-99
win_vic_SWnet.50-99)
set NCDF = (ann_pcm_SWnet.50-99:r.ncdf )
set II = 0
while ( $II < 5 ) # leave room for lt averages
@ II ++
set NCDFP$II = $PCMFL[$II]:r.ncdf
set NCDFO$II = $OBSFL[$II]:r.ncdf
awk '{print $1, $2, $3}' $PCMFL[$II] | xyz2grd -GNCDFP$II -F -I$SIZE -R$COORD
awk '{print $1, $2, $3}' $OBSFL[$II] | xyz2grd -GNCDFO$II -F -I$SIZE -R$COORD
grdmath NCDFP$II NCDFO$II SUB = diff$II.ncdf
end
grdimage NCDFP1 -R$COORD -Bwsne -$proj -Y9.0 -X0.5 -K -P -C$CPTa
pscoast -R$COORD -$proj -O -V -K -N1 -N2 -W1 -A10000 >> $outfil
grdimage NCDFO1 -R$COORD -Bwsne -$proj -X$SH -O -K -C$CPTa >> $outfil
pscoast -R$COORD -$proj -O -V -K -N1 -N2 -W1 -A10000 >> $outfil
grdimage diff1.ncdf -R$COORD -Bwsne -$proj -X$SH -O -K -C$CPTad >> $outfil
pscoast -R$COORD -$proj -O -V -K -N1 -N2 -W1 -A10000 >> $outfil
# add legend
psscale -C$CPTa -X-4.5 -Y-0.6 -E -D2.0/0.5/4.0/0.1h -B:"Average FSNS (W/m^2)": -O -K >> $outfil
psscale -C$CPTad -X3.7 -Y0.5 -E -D2.0/0/2.0/0.1h -B:"Difference (W/m^2)": -O -K >> $outfil
grdimage NCDFP2 -R$COORD -$proj -Bwsne -Y-2.5 -X-4.2 -O -K -C$CPTs >> $outfil
pscoast -R$COORD -$proj -O -K -N1 -N2 -W1 -A10000 >> $outfil
grdimage NCDFO2 -R$COORD -Bwsne -$proj -X$SH -O -K -C$CPTs >> $outfil
pscoast -R$COORD -$proj -O -K -N1 -N2 -W1 -A10000 >> $outfil
grdimage diff2.ncdf -R$COORD -Bwsne -$proj -X$SH -O -K -C$CPTsd >> $outfil
pscoast -R$COORD -$proj -O -K -N1 -N2 -W1 -A10000 >> $outfil
set II = 2
while ( $II < 5 ) # leave room for lt averages
@ II ++
grdimage NCDFP$II -R$COORD -$proj -Bwsne -Y$YY -X$BSH -O -K -C$CPTs >> $outfil
pscoast -R$COORD -$proj -O -K -N1 -N2 -W1 -A10000 >> $outfil
grdimage NCDFO$II -R$COORD -Bwsne -$proj -X$SH -O -K -C$CPTs >> $outfil
pscoast -R$COORD -$proj -O -K -N1 -N2 -W1 -A10000 >> $outfil
grdimage diff$II.ncdf -R$COORD -Bwsne -$proj -X$SH -O -K -C$CPTsd >> $outfil
pscoast -R$COORD -$proj -O -K -N1 -N2 -W1 -A10000 >> $outfil
end
# add legend
psscale -C$CPTs -X-4.5 -Y-0.6 -E -D2.0/0.5/4.0/0.1h -B:"Average FSNS (W/m^2)": -O -K >> $outfil
psscale -C$CPTsd -X3.7 -Y0.5 -E -D2.0/0/2.0/0.1h -B:"Difference (W/m^2)": -O >> $outfil
m *.ncdf
gs $outfil