source: lmdz_wrf/trunk/tools/get_data_snd-sfc_validation.bash @ 2018

Last change on this file since 2018 was 2010, checked in by lfita, 7 years ago

Addin not repeating steps

  • Property svn:executable set to *
File size: 4.0 KB
Line 
1#!/bin/bash
2### Script to get sounding and surface points for validation purposes
3
4scratch='false'
5
6# Input folder
7infolder='/ccc/scratch/cont003/lmd/fitaborl/estudios/FPS_ALPS/additional/IOP'
8
9# Output folder
10ofolder='/ccc/scratch/cont003/lmd/fitaborl/estudios/FPS_ALPS/additional/IOP/validation'
11
12# Labels of the experiments
13experiments='120lev:80lev:50lev:50lev_assigned:38lev:NOaerosol'
14
15# Sounding stations [sndid],[sndlon],[sndlat]:[sndid2],[sndlon2],[sndlat2]:...
16sndstations='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]:...
19sfcstations='None'
20
21# Sounding diagnostics
22snddiags='WRFt:WRFtda:WRFp:WRFua:WRFva:ws:WRFwd'
23
24# Surface diagnostics
25sfcdiags='wds:wss:WRFtdas'
26
27# Surface NON-diag variables
28sfcnondiags='T2'
29
30#######    #######
31## MAIN
32    #######
33insoutf='allins_functions.inf'
34module load python/2.7.14
35
36exps=`echo ${experiments} | tr ':' ' '`
37sndsts=`echo ${sndstations} | tr ':' ' '`
38sfcsts=`echo ${sfcstations} | tr ':' ' '`
39
40for 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
128done
Note: See TracBrowser for help on using the repository browser.