#
#sed 's/:/ /g' tmpdir/HFEVAV2.dat | awk '{if (($1 < 0) && ($3 >= 0)) print $1+(1-$4/60), $3+($2/60), $5; if (($1 >= 0) && ($3 >= 0)) print $1+(1-$4/60), $3+($2/60), $5; if (($1 < 0) && ($3 < 0)) print $1+(1-$4/60), $3+1-(1-$2/60), $5; if (($1 >= 0) && ($3 < 0)) print $1+(1-$4/60), $3+1-(1-$2/60), $5}' >! tmpdir/temp.dec
#sed 's/:/ /g' tmpdir/ENHANCEDV2.dat | awk '{if (($3 >= 0) && ($5 != 999) && ($5 != 888) && ($5 != 0)) print $1+(1-$4/60), $3+($2/60), $5; if (($3 < 0) && ($5 != 999) && ($5 != 888) && ($5 != 0)) print $1+(1-$4/60), $3+1-(1-$2/60), $5}' >! tmpdir/temp.dec

#xyz2grd tmpdir/temp.dec -R-180/180/-49/75 -H1 -I5m -Gtmpdir/ENHANCEDV2.grd
#xyz2grd tmpdir/temp.dec -R-180/180/-49/75 -H1 -I1 -Gtmpdir/ENHANCEDV2.grd

#grd2xyz /Data/topo/topo_8.2.grd >! tmpdir/topo_8.2.xyz

##awk '{if ($1 > 180) print $1-360, $2, $3; if ($1 <= 180) print $1, $2, $3}' tmpdir/topo_8.2.xyz >! tmpdir/topo_8.2_180.xyz
##xyz2grd tmpdir/topo_8.2_180.xyz -R-180/180/-49/75 -I5m -Gtmpdir/topo_8.2.5.grd
##grdgradient tmpdir/topo_8.2.5.grd -A0/270 -Ne0.5 -Gtmpdir/intense.grd

makecpt -Cseis -T0/3600/800 >! tmpdir/enhancedv2.cpt

#makecpt -Cseis -T799/800/1 >! tmpdir/pelagic.cpt
#grdcontour -R$maplimits -J$scale tmpdir/ENHANCEDV2.grd -D -m -C800 -L799/801 >! pelagic

#awk '{print $3}'  ENHANCEDV2.dat | sort | uniq


cat << EOF >! tmpdir/enhanced.cpt
#
0	255	145	30	400	255	145	30
400	255	255	0	600	255	255	0
600	255	50	50	800	255	50	50
800 0	0	0	1000	0	0	0
1000 140	70	30	1200	140	70	30
1200 255	145	30	1400	255	145	30
1400 255	255	0	1600	255	255	0
1600 200	200	200	2500	200	200	200
2500 0	250	0	3000	0	250	0
3000 50	50	255	3500	50	50	255
N 255 255 255
EOF

set maplimits = "20/380/-90/90"
set scale = "W9i"

#grdimage tmpdir/ENHANCEDV2.grd  -R$maplimits -J$scale -Ctmpdir/enhancedv2.cpt -Ba30/a30WeSn -K >! tmpdir/bst_enhancedv2.ps
grdview tmpdir/ENHANCEDV2.grd  -R$maplimits -J$scale -Itmpdir/intense.grd -Ctmpdir/enhanced.cpt -Ba30/a30WeSn -Qs -E180/90 -K >! tmpdir/bst_enhancedv2.ps
pscoast -Dh -R$maplimits -J$scale -W1/0/0/0 -A1000 -G255 -O -K >> tmpdir/bst_enhancedv2.ps
psscale -D3i/6i/6i/0.2ih -Ctmpdir/enhanced.cpt -L -O -K >> tmpdir/bst_enhancedv2.ps

convert  -density 600 tmpdir/bst_enhancedv2.ps tmpdir/bst_enhancedv2.jpg

#convert -density 72  tmpdir/bst_enhancedv2.ps tmpdir/bst_enhancedv2.png
#convert tmpdir/bst_enhancedv2.ps tmpdir/bst_enhancedv2.png

##grdcontour tmpdir/ENHANCEDV2.grd -R$maplimits -J$scale -C800 -L799/801 -W4 -O -K >> tmpdir/bst_enhancedv2.ps
##psxy  contour -R$maplimits -J$scale -M -Gp200/16 -W4 -A -O -K -Y5i >> tmpdir/bst_enhancedv2.ps

#pshistogram tmpdir/temp.dec -T2 -H1 -W0.4i -JX6i/2i -Z0 -R0/3500/0/1 -Ctmpdir/enhancedv2.cpt -Ba5f1/a10f5WeSn -O -K -Y5i >> tmpdir/bst_enhancedv2.ps

alldone:

#pshistogram tmpdir/temp.dec -T2 -H1 -W0.2i -JX6i/2i -Z1 -R0/25/0/50 -Ctmpdir/enhancedv2.cpt -Ba5f1/a10f5WeSn -P -K >! tmpdir/bst_enhancedv2.ps

