-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotMaps
132 lines (85 loc) · 5.83 KB
/
plotMaps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
#################################################
### WAVE Height Maps SWELL ##################
#################################################
#makecpt -T0/4/0.2 -D -M -Cseminf-haxby.cpt >Hscolor.cpt
cd ./out/
./proc_swanout
cd ..
fileHsw=./out/Hswell.nc?Hswell
fileDp=./out/Dp.nc?dp
fileTp=./out/Tp.nc?Tp
region=-R176.73/178.869/-19.33/-17.731
proj=-JM15c
#grdmath bathy_fiji_test.nc 1.5 ADD = bathy_fiji.nc
#Land=1 sea =NaN
#grdmath bathy_fiji.nc 0.0 LE 0 NAN = Sea_NAN_Fiji.nc
#grdsample mask_Fiji.nc -RFiji_99th.nc -GSea_NAN_Fiji.nc
#grdsample bathy_fiji.nc -RFiji_99th.nc -Gbathy_fiji_resampled.nc
#Land=Nan Sea =1
#grdmath bathy_fiji.nc 0.0 GT 0 NAN = Land-Nan.nc
#grdsample Land-Nan.nc -RFiji_99th.nc -GLand-Nan_resampled.nc
#grdgradient bathy_fiji.nc -A180/90 -Nt0.2 -Ggradients_Fiji.nc
#grdmath gradients_Fiji.nc Sea_NAN_Fiji.nc MUL = Gradient_Fj_Nan.nc
#grdsample gradplot_Fiji.nc -RFiji_99th.nc -GGradient_Fj_Nan.nc
#grdmath bathy_fiji.nc Sea_NAN_Fiji.nc MUL = Bathy_NOSEA.nc
for ttt in 1 13 25 37 49 61 73 85 97 109 121 133 145 157 169
do
#awk -v step=$ttt 'BEGIN{nx=714; ny=534}{if(NR>=1+(step-1)*ny*nx && NR<step*ny*nx){printf("%f\t%f\t%f\n",176.73+(NR % nx + 1)*0.003,-19.33+(((NR/nx)-((NR/nx)%1))+1)*0.003,$1)}}' $fileHsw | xyz2grd -R176.73/178.869/-19.33/-17.731 -I0.003 -Gout_Hswell.nc
#awk -v step=$ttt 'BEGIN{nx=714; ny=534}{if(NR>=1+(step-1)*ny*nx && NR<step*ny*nx){printf("%f\t%f\t%f\n",176.73+(NR % nx + 1)*0.003,-19.33+(((NR/nx)-((NR/nx)%1))+1)*0.003,$1)}}' $fileDp | xyz2grd -R176.73/178.869/-19.33/-17.731 -I0.003 -Gout_Dp.nc
#awk -v step=$ttt 'BEGIN{nx=714; ny=534}{if(NR>=1+(step-1)*ny*nx && NR<step*ny*nx){printf("%f\t%f\t%f\n",176.73+(NR % nx + 1)*0.003,-19.33+(((NR/nx)-((NR/nx)%1))+1)*0.003,$1)}}' $fileTp | xyz2grd -R176.73/178.869/-19.33/-17.731 -I0.003 -Gout_Tp.nc
#need this to remove round off error in Land-Nan
#grdsample Land-Nan.nc -Rout_Hswell.nc -GLand-Nan_resampled.nc
grdmath ${fileHsw}[${ttt}] 1 MUL = out_Hswell.nc
grdmath ${fileDp}[${ttt}] 1 MUL = out_Dp.nc
grdmath ${fileTp}[${ttt}] 1 MUL = out_Tp.nc
#grdsample Land-Nan.nc -Rout_Hswell.nc -GLand-Nan_resampled.nc
grdmath out_Hswell.nc Land-Nan_resampled.nc MUL = toplot1.nc
#grdmath out_Dp.nc 0 MUL 1 ADD = Vect1.nc
outps=test_${ttt}.ps
outpng=test_${ttt}.png
psbasemap $region $proj --MAP_FRAME_TYPE=plain --FONT_ANNOT_PRIMARY=10p,Helvetica,black -Ba0.5f0.1WSen -K > $outps
grdview $region $proj toplot1.nc -CHscolor.cpt -Qs -O -K >> $outps
grdsample out_Dp.nc $region -I0.05 -GdirFD.nc
grdmath dirFD.nc 0.0 AND = dirFDAND.nc
grdmath dirFDAND.nc 0.0 MUL 1.0 ADD = VeldirFDAND.nc
grd2xyz dirFDAND.nc > dp_resampled.txt
#grdsample Vect1.nc $region -I0.001 -GhsdirFD.nc
#awk '{print($1,$2,$3,$4)}' dp_resampled.txt |psxy $region $proj -G0 -W0.6p,black -SV0.3p+b -O -K >> $outps
#grdvector $region $proj VeldirFDAND.nc dirFDAND.nc -A -G0 -W0.6p,black -I0.05 -Q2p+b+a60+g0+jc -Sl3p -O -K >> $outps
awk '{print($1,$2,$3,0.3)}' dp_resampled.txt |psxy $region $proj -G0 -SV3p+b -W0.5p,black -O -K >> $outps
grdimage $region $proj Bathy_NOSEA.nc -CWheat_land.cpt -IGradient_Fj_Nan.nc -Q -O -K >> $outps
grdcontour $region $proj bathy_fiji.nc -C+0 -Wc0.2p,00/00/00 -O -K >> $outps
grdcontour $region $proj bathy_fiji.nc -C+1.5 -Wc0.2p,00/00/00,"-" -O -K >> $outps
#grdmath ./DirMEanAll.nc 1 MUL 0 ADD = dirF.nc
#grdmath ./HsMeanAll.nc 1 MUL toplot1.nc MUL = hsdirF.nc
#grdsample dirF.nc $region -I0.001 -GdirFD.nc
#grdsample hsdirF.nc $region -I0.001 -GhsdirFD.nc
#echo "177.5 -19.0 90.0 1.0" | psxy $region $proj -SV0.3p+b -W1p,black -O -K >> $outps
echo "177.433767,-17.772513 Nadi" | pstext $region $proj -F+a-0+f7p,Helvetica,black+jMC -D-0.2c/-0.15c -O -K>>$outps
echo "178.441794,-18.097980 Suva" | pstext $region $proj -F+a-0+f7p,Helvetica,black+jMC -D0.0c/0.0c -O -K>>$outps
echo "177.502246,-18.138963 Sigatoka" | pstext $region $proj -F+a0-0+f7p,Helvetica,black+jMC -D0.0c/0.0c -O -K>>$outps
echo "178.177679,-18.215958 Navua" | pstext $region $proj -F+a-0+f7p,Helvetica,black+jMC -D-0.45c/-0.1c -O -K>>$outps
echo "178.109877,-18.391847 Beqa" | pstext $region $proj -F+a-0+f7p,Helvetica,black+jMC -D0.8c/-0.3c -O -K>>$outps
echo "177.610555,-18.521345 Vatulele" | pstext $region $proj -F+a-0+f7p,Helvetica,black+jMC -D-0.5c/0.0c -O -K>>$outps
echo "178.297961,-18.980413 Kadavu" | pstext $region $proj -F+a-0+f7p,Helvetica,black+jMC -D0.4c/0.0c -O -K>>$outps
echo "178.546730,-18.011885 Nausori" | pstext $region $proj -F+a-0+f7p,Helvetica,black+jMC -O -K>>$outps
echo "178.0,-17.800 Swell Height [m]" | pstext $region $proj -F+a-0+f12p,Helvetica,black+jMC -O -K>>$outps
echo "178.1,-17.900 Last update:" | pstext $region $proj -F+f12p,Helvetica,black+jLM -O -K>>$outps
#awk '{if(NR==2){print(178.0,-18.000,"Last update:")}}' Lastcycle.txt | pstext $region $proj -F+f12p,Helvetica,black+jLM -O -K>>$outps
awk '{if(NR==2){print(178.1,-17.9700,$0)}}' Lastcycle.txt | pstext $region $proj -F+f12p,Helvetica,black+jLM -O -K>>$outps
dstr=`awk -v tt=$ttt '{if(NR==2){printf("%s + %s hours",$0,tt-1)}}' Lastcycle.txt`
dstrformated=`date +"%a %d %b %H:00FJT" -d"${dstr}"`
echo "177.4,-17.900 Forecast time:" | pstext $region $proj -F+f12p,Helvetica,black+jLM -O -K>>$outps
echo "177.4,-17.970 ${dstrformated}" | pstext $region $proj -F+f12p,Helvetica,black+jLM -O -K>>$outps
#pscoast $region $proj -Df -W0.3p,black -Gblack -O -K >>$outps
psscale -D15.2c/4c/6c/0.3c -CHscolor.cpt -Ba1f0.2 -Ef -O -K >> $outps
psxy $region $proj -T -O >> $outps
psconvert -A -P -Tg $outps
lftp sftp://wacop:J3fG5hxU1@52.63.144.203 -e "cd public_html/Forecast; put ${outpng}; bye"
#mv -f ${outpng} /cygdrive/c/Users/cyprienb/Dropbox/Public/${outpng}
#mv -f ${outpng} /cygdrive/c/Users/cyprienb/OneDrive\ -\ SPC/Forecast/${outpng}
#| xyz2grd -Gout-${ttt}.nc
#176.73+(NR-(step-1)*ny*nx)*0.003,-19.33000+(NR-1)*0.003,$1
done
#rm *.ps