1 | #!/bin/bash |
---|
2 | ## g.e. # ./blank_WRF.bash /d4/lflmd/DATA/WRF/WRFV3.3.1 /d4/lflmd/etudes/AquaPlanet/test_eraint |
---|
3 | if test $1 = '-h'; then |
---|
4 | echo "**************************************" |
---|
5 | echo "*** Shell to prepare WRF structure ***" |
---|
6 | echo "*** from the scratch in a folder ***" |
---|
7 | echo "**************************************" |
---|
8 | echo "blank_WRF.bash [WRFfold](folder with serial/dmpar WRFV3 and WPS compilation folders) [WORKfold](working directory)" |
---|
9 | else |
---|
10 | rootsh=`pwd` |
---|
11 | WRFfold=$1 |
---|
12 | WORKfold=$2 |
---|
13 | |
---|
14 | errmsg='ERROR -- error -- ERROR -- error' |
---|
15 | main='blank_WRF.bash' |
---|
16 | |
---|
17 | if test $# -ne 2; then |
---|
18 | echo ${errmsg} |
---|
19 | echo " "${main}": 2 parameters needed '"$@"' passed !!!!" |
---|
20 | exit |
---|
21 | fi |
---|
22 | |
---|
23 | if test -d ${WRFfold}/serial; then |
---|
24 | infold=${WRFfold}/serial |
---|
25 | else |
---|
26 | infold=${WRFfold}/dmpar |
---|
27 | fi |
---|
28 | |
---|
29 | # ungrib |
---|
30 | ## |
---|
31 | odir=${WORKfold}/ungrib |
---|
32 | mkdir -p ${odir} |
---|
33 | links='ungrib.exe Variable_Tables' |
---|
34 | for link in ${links}; do |
---|
35 | rm ${dir}/${link} >& /dev/null |
---|
36 | ln -s ${infold}/WPS/ungrib/${link} ${odir} |
---|
37 | done |
---|
38 | mkdir ${odir}/GribDir |
---|
39 | ln -s ${infold}/WPS/link_grib.csh ${odir} |
---|
40 | |
---|
41 | # metgrid |
---|
42 | ## |
---|
43 | odir=${WORKfold}/metgrid |
---|
44 | mkdir -p ${odir} |
---|
45 | links='metgrid.exe METGRID.TBL.ARW' |
---|
46 | for link in ${links}; do |
---|
47 | rm ${odir}/${link} >& /dev/null |
---|
48 | if test ${link:0:3} = 'MET'; then |
---|
49 | rm ${odir}/METGRID.TBL >& /dev/null |
---|
50 | ln -s ${infold}/WPS/metgrid/${link} ${odir}/METGRID.TBL |
---|
51 | else |
---|
52 | ln -s ${WRFfold}/serial/WPS/metgrid/${link} ${odir} |
---|
53 | fi |
---|
54 | done |
---|
55 | |
---|
56 | # real |
---|
57 | ## |
---|
58 | odir=${WORKfold}/run |
---|
59 | mkdir -p ${odir} |
---|
60 | rm ${odir}/real.exe >& /dev/null |
---|
61 | ln -s ${infold}/WRFV3/main/real.exe ${odir} |
---|
62 | |
---|
63 | # wrf |
---|
64 | ## |
---|
65 | odir=${WORKfold}/run |
---|
66 | rm ${odir}/* >& /dev/null |
---|
67 | ln -s ${infold}/WRFV3/run/* ${odir} |
---|
68 | rm ${odir}/namelist.input |
---|
69 | if test -d ${WRFfold}/serial; then |
---|
70 | rm ${WORKfold}/wrf.exe |
---|
71 | ln -s ${WRFfold}/serial/WRFV3/main/wrf.exe ${odir}/wrf.serial.exe |
---|
72 | ln -s ${WRFfold}/dmpar/WRFV3/main/wrf.exe ${odir}/wrf.dmpar.exe |
---|
73 | fi |
---|
74 | fi |
---|
75 | |
---|
76 | echo "export LD_LIBRARY_PATH=${HOME}/bin/gcc_netcdf-4.3.0/lib:\${LD_LIBRARY_PATH}" |
---|