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

Last change on this file since 2006 was 2005, checked in by lfita, 7 years ago

Fixing right variable for if

  • Property svn:executable set to *
File size: 3.9 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    for filen in ${files}; do
55      $pyHOME/get_WRFsounding-surface_data.bash ${scratch} ${ofold} ${expn} ${sndvn} \
56        None ${filen} ${snddiags} ${sfcdiags} ${sfcnondiags}
57    # end of files
58    done
59
60    # Concatenating files
61    ofile=${ofold}/simout_sndvars_${sndid}_${expn}.nc
62    if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
63    if test ! -f ${ofile}; then
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} >> ${insoutf}
76      echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S "'"${values}"'" \
77       -f ${HMT} -v all >> ${insoutf}
78      echo " " >> ${insoutf}
79      mv netcdf_fold_concatenated_HMT.nc ${ofile}
80    fi
81    #exit
82
83  # end of soundings
84  done
85  fi
86
87  if test ! ${sfcstations} = 'None'; then
88  for sfcvn in ${sfcsts}; do
89    sfcid=`echo ${sfcvn} | tr ',' ' ' | awk '{print $1}'`
90    sfclon=`echo ${sfcvn} | tr ',' ' ' | awk '{print $2}'`
91    sfclat=`echo ${sfcvn} | tr ',' ' ' | awk '{print $3}'`
92
93    for filen in ${files}; do
94      $pyHOME/get_WRFsounding-surface_data.bash ${scratch} ${ofold} ${expn} None     \
95        ${sfcvn} ${filen} ${snddiags} ${sfcdiags} ${sfcnondiags}
96    # end of files
97    done
98
99    # Concatenating files
100    ofile=${ofold}/simout_sfcvars_${sfcid}_${expn}.nc
101    if test ${scratch} = 'true'; then rm ${ofile} >& /dev/null; fi
102    if test ! -f ${ofile}; then
103      values=${ofold}',Time,time'
104      HMT='simout_sfcdiags_,'${sfcid},'nc'
105      python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}         \
106       -f ${HMT} -v all
107      if test $? -ne 0; then
108        echo ${errmsg}
109        echo "  python failed!!"
110        echo python ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S ${values}  \
111        -f ${HMT} -v all
112        exit
113      fi
114      echo " * Concatenating surface data at point: "${sfclon}", "${sfclat} >> ${insoutf}
115      echo python  ${pyHOME}/nc_var.py -o netcdf_fold_concatenation_HMT -S "'"${values}"'" \
116       -f ${HMT} -v all >> ${insoutf}
117      echo " " >> ${insoutf}
118      mv netcdf_fold_concatenated_HMT.nc ${ofile}
119    fi
120    #exit
121
122  # end of surfaces
123  done
124  fi
125
126# End of experiments
127done
Note: See TracBrowser for help on using the repository browser.