1 | #!/bin/bash |
---|
2 | ### Script to get sounding and surface points for validation purposes |
---|
3 | |
---|
4 | scratch='false' |
---|
5 | |
---|
6 | # Input folder |
---|
7 | infolder='/ccc/scratch/cont003/lmd/fitaborl/estudios/FPS_ALPS/additional/IOP' |
---|
8 | |
---|
9 | # Output folder |
---|
10 | ofolder='/ccc/scratch/cont003/lmd/fitaborl/estudios/FPS_ALPS/additional/IOP/validation' |
---|
11 | |
---|
12 | # Labels of the experiments |
---|
13 | experiments='120lev:80lev:50lev:50lev_assigned:38lev:NOaerosol' |
---|
14 | |
---|
15 | # Sounding stations [sndid],[sndlon],[sndlat]:[sndid2],[sndlon2],[sndlat2]:... |
---|
16 | sndstations='10868,11.55,48.25:16080,9.28,45.43:16144,11.61,44.65:16546,8.85,39.35' |
---|
17 | |
---|
18 | # Surface stations [sfcid],[sfclon],[sfclat]:[sfcid2],[sfclon2],[sfclat2]:... |
---|
19 | sfcstations='None' |
---|
20 | |
---|
21 | # Sounding diagnostics |
---|
22 | snddiags='WRFt:WRFtda:WRFp:WRFua:WRFva:ws:WRFwd' |
---|
23 | |
---|
24 | # Surface diagnostics |
---|
25 | sfcdiags='wds:wss:WRFtdas' |
---|
26 | |
---|
27 | # Surface NON-diag variables |
---|
28 | sfcnondiags='T2' |
---|
29 | |
---|
30 | ####### ####### |
---|
31 | ## MAIN |
---|
32 | ####### |
---|
33 | insoutf='allins_functions.inf' |
---|
34 | module load python/2.7.14 |
---|
35 | |
---|
36 | exps=`echo ${experiments} | tr ':' ' '` |
---|
37 | sndsts=`echo ${sndstations} | tr ':' ' '` |
---|
38 | sfcsts=`echo ${sfcstations} | tr ':' ' '` |
---|
39 | |
---|
40 | for expn in ${exps}; do |
---|
41 | ifold=${infolder}/${expn}/wrfout |
---|
42 | ofold=${ofolder}/${expn} |
---|
43 | |
---|
44 | files=`ls -1 ${infolder}/${expn}/wrfout/wrfout_d02*` |
---|
45 | |
---|
46 | mkdir -p ${ofold} |
---|
47 | |
---|
48 | if test ! ${sndstations} = 'None'; then |
---|
49 | for sndvn in ${sndsts}; do |
---|
50 | sndid=`echo ${sndvn} | tr ',' ' ' | awk '{print $1}'` |
---|
51 | sndlon=`echo ${sndvn} | tr ',' ' ' | awk '{print $2}'` |
---|
52 | sndlat=`echo ${sndvn} | tr ',' ' ' | awk '{print $3}'` |
---|
53 | |
---|
54 | ofile=${ofold}/simout_sndvars_${sndid}_${expn}.nc |
---|
55 | if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi |
---|
56 | if test ! -f ${ofile}; then |
---|
57 | for filen in ${files}; do |
---|
58 | $pyHOME/get_WRFsounding-surface_data.bash ${scratch} ${ofold} ${expn} \ |
---|
59 | ${sndvn} None ${filen} ${snddiags} ${sfcdiags} ${sfcnondiags} |
---|
60 | # end of files |
---|
61 | done |
---|
62 | |
---|
63 | # Concatenating files |
---|
64 | values=${ofold}',Time,time' |
---|
65 | HMT='simout_snddiags_,'${sndid},'nc' |
---|
66 | python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values} \ |
---|
67 | -f ${HMT} -v all |
---|
68 | if test $? -ne 0; then |
---|
69 | echo ${errmsg} |
---|
70 | echo " python failed!!" |
---|
71 | echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}\ |
---|
72 | -f ${HMT} -v all |
---|
73 | exit |
---|
74 | fi |
---|
75 | echo " * Concatenating sounding data at point: "${sndlon}", "${sndlat} >> \ |
---|
76 | ${insoutf} |
---|
77 | echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S "'"${values}"'" \ |
---|
78 | -f ${HMT} -v all >> ${insoutf} |
---|
79 | echo " " >> ${insoutf} |
---|
80 | mv netcdf_fold_concatenated_HMT.nc ${ofile} |
---|
81 | fi |
---|
82 | #exit |
---|
83 | |
---|
84 | # end of soundings |
---|
85 | done |
---|
86 | fi |
---|
87 | |
---|
88 | if test ! ${sfcstations} = 'None'; then |
---|
89 | for sfcvn in ${sfcsts}; do |
---|
90 | sfcid=`echo ${sfcvn} | tr ',' ' ' | awk '{print $1}'` |
---|
91 | sfclon=`echo ${sfcvn} | tr ',' ' ' | awk '{print $2}'` |
---|
92 | sfclat=`echo ${sfcvn} | tr ',' ' ' | awk '{print $3}'` |
---|
93 | |
---|
94 | ofile=${ofold}/simout_sfcvars_${sfcid}_${expn}.nc |
---|
95 | if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi |
---|
96 | if test ! -f ${ofile}; then |
---|
97 | for filen in ${files}; do |
---|
98 | $pyHOME/get_WRFsounding-surface_data.bash ${scratch} ${ofold} ${expn} None \ |
---|
99 | ${sfcvn} ${filen} ${snddiags} ${sfcdiags} ${sfcnondiags} |
---|
100 | # end of files |
---|
101 | done |
---|
102 | |
---|
103 | # Concatenating files |
---|
104 | values=${ofold}',Time,time' |
---|
105 | HMT='simout_sfcdiags_,'${sfcid},'nc' |
---|
106 | python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values} \ |
---|
107 | -f ${HMT} -v all |
---|
108 | if test $? -ne 0; then |
---|
109 | echo ${errmsg} |
---|
110 | echo " python failed!!" |
---|
111 | echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values} \ |
---|
112 | -f ${HMT} -v all |
---|
113 | exit |
---|
114 | fi |
---|
115 | echo " * Concatenating surface data at point: "${sfclon}", "${sfclat} >> ${insoutf} |
---|
116 | echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S "'"${values}"'" \ |
---|
117 | -f ${HMT} -v all >> ${insoutf} |
---|
118 | echo " " >> ${insoutf} |
---|
119 | mv netcdf_fold_concatenated_HMT.nc ${ofile} |
---|
120 | fi |
---|
121 | #exit |
---|
122 | |
---|
123 | # end of surfaces |
---|
124 | done |
---|
125 | fi |
---|
126 | |
---|
127 | # End of experiments |
---|
128 | done |
---|