test_a_python_diag.sh 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. #!/bin/bash
  2. # B E T A ! ! !
  3. # Diag to test:
  4. # One at a time please!!!
  5. itrsig=0
  6. imhst=0
  7. iamoc=0
  8. icrosssect=0
  9. itempsal=0
  10. ifsflx=0
  11. imean2d=0
  12. imean3d=0
  13. iSflx=0
  14. ienso=0
  15. imov=1
  16. issh=0
  17. ipsi=0
  18. iwind=0
  19. isfluxes=0
  20. its=0
  21. imld=0
  22. irnf=0
  23. iice=0
  24. iemp=0
  25. icmip5=0
  26. ihov=0
  27. #CONFIG="ORCA1_L75"
  28. #ARCH="T159_ece32_marenostrum"
  29. #export EXP="LR1E" ; NC=nc4 ; jyear=1990
  30. #CONFIG="ORCA1_L42"
  31. #ARCH="ece22_triolith"
  32. #export EXP="SPIN" ; NC=nc4 ; jyear=2540
  33. #CONFIG="ORCA2_L31"
  34. #ARCH="ece32_marenostrum"
  35. #export EXP="LR20" ; NC=nc4 ; jyear=2540
  36. #CONFIG="ORCA025_L75"
  37. #ARCH="uwe_oo"
  38. #export EXP="HN71" ; NC=nc ; jyear=1990
  39. #CONFIG="ORCA025_L75"
  40. #ARCH="etienne"
  41. #export EXP="a0ez" ; NC=nc ; jyear=1945
  42. #CONFIG="ORCA1_L75"
  43. #ARCH="ro10"
  44. #export EXP="ro10" ; NC=nc ; jyear=1995
  45. #CONFIG="ORCA1_L75"
  46. #ARCH="uwe"
  47. #export EXP="SN71" ; NC=nc ; jyear=1995
  48. #CONFIG="ORCA1_L75"
  49. #ARCH="T159_ece32_triolith"
  50. #export EXP="LB30" ; NC=nc4 ; jyear=2010
  51. CONFIG="ORCA1_L75"
  52. ARCH="lolo"
  53. export EXP="AMOC" ; NC=nc4 ; jyear=1990
  54. export BARAKUDA_ROOT=`pwd | sed -e "s|/python||g"`
  55. echo "${BARAKUDA_ROOT}/configs/config_${CONFIG}_${ARCH}.sh"
  56. . ${BARAKUDA_ROOT}/src/bash/bash_functions.bash
  57. . ${BARAKUDA_ROOT}/configs/config_${CONFIG}_${ARCH}.sh
  58. ORCA_LIST="ORCA025.L75 ORCA1.L75 ORCA1.L46 ORCA1.L42 ORCA2.L31 ORCA2.L46"
  59. for og in ${ORCA_LIST}; do
  60. ca=""; ca=`echo ${CONFIG} | grep ${og}` ; if [ "${ca}" != "" ]; then export ORCA=${og}; fi
  61. done
  62. if [ "${ORCA}" = "" ]; then echo "ORCA grid of config ${CONFIG} not supported yet"; exit; fi
  63. export CONFEXP=${ORCA}-${EXP}
  64. export DIAG_D=${DIAG_DIR}/${CONFEXP} ; mkdir -p ${DIAG_D}
  65. echo ; echo " *** DIAG_D = ${DIAG_D} !"; echo
  66. HERE=`pwd`
  67. finfoclim=${DIAG_D}/clim/last_clim
  68. y1_clim=`cat ${finfoclim} | cut -d - -f1`
  69. y2_clim=`cat ${finfoclim} | cut -d - -f2`
  70. export COMP2D="OBS"
  71. # To know the name of NEMO output files:
  72. export NEMO_OUT_D=`echo ${NEMO_OUT_STRCT} | sed -e "s|<ORCA>|${ORCA}|g" -e "s|<EXP>|${EXP}|g"`
  73. if [ ! -d ${NEMO_OUT_D} ]; then echo "Unfortunately we could not find ${NEMO_OUT_D}"; exit; fi
  74. YEAR_INI=1990 ; YEAR_INI_F=1990
  75. export cyear=`printf "%04d" ${jyear}`
  76. if [ ${ece_exp} -gt 0 ]; then
  77. iy=$((${jyear}-${YEAR_INI}+1+${YEAR_INI}-${YEAR_INI_F}))
  78. dir_ece="`printf "%03d" ${iy}`/"
  79. fi
  80. CPREF=`echo ${NEMO_FILE_PREFIX} | sed -e "s|<ORCA>|${ORCA}|g" -e "s|<EXP>|${EXP}|g" -e "s|<TSTAMP>|${TSTAMP}|g"`
  81. if [ ${icrosssect} -eq 1 ] || [ ${imean2d} -eq 1 ] || [ ${imov} -eq 1 ]; then
  82. ft=${NEMO_OUT_D}/${dir_ece}${CPREF}${cyear}0101_${cyear}1231_grid_T.${NC}
  83. check_if_file ${ft}
  84. fj=${NEMO_OUT_D}/${dir_ece}${CPREF}${cyear}0101_${cyear}1231_${FILE_ICE_SUFFIX}.${NC}
  85. check_if_file ${fj}
  86. fi
  87. if [ ${imean3d} -eq 1 ]; then
  88. ft=${NEMO_OUT_D}/${dir_ece}${CPREF}${cyear}0101_${cyear}1231_grid_T.${NC}
  89. check_if_file ${ft}
  90. fi
  91. if [ ${iSflx} -eq 1 ]; then
  92. ft=${NEMO_OUT_D}/${dir_ece}${CPREF}${cyear}0101_${cyear}1231_${FILE_FLX_SUFFIX}.${NC}
  93. check_if_file ${ft}
  94. fi
  95. export PYTHONPATH=${PYTHON_HOME}/lib/python2.7/site-packages:${BARAKUDA_ROOT}/python/modules
  96. echo ; echo " *** DIAG_D=${DIAG_D} !"; echo
  97. rm -f *.png
  98. # Time for diags:
  99. if [ ${ienso} -eq 1 ]; then
  100. CMD="python exec/plot_enso.py ${DIAG_D}/Nino34_${CONFEXP}.nc ${NN_SST}"
  101. echo ; echo " CMD = ${CMD} "; echo
  102. fi
  103. if [ ${imhst} -eq 1 ]; then
  104. CMD="python exec/plot_hovm_merid_trsp.py"
  105. echo ; echo " CMD = ${CMD} "; echo
  106. fi
  107. if [ ${iamoc} -eq 1 ]; then
  108. if [ ! -f ${DIAG_D}/clim/last_clim ]; then echo "Boooo!"; exit; fi
  109. CLIM_PER=`cat ${DIAG_D}/clim/last_clim`
  110. iclyear=`echo ${CLIM_PER} | sed -e s/'-'/' '/g`
  111. CMD="python exec/moc.py ${iclyear}"
  112. echo ; echo " CMD = ${CMD} "; echo
  113. fi
  114. if [ ${icrosssect} -eq 1 ]; then
  115. export DIAG_D=`pwd`
  116. CMD="python exec/cross_sections.py ${ft} ${jyear}"
  117. fi
  118. if [ ${itempsal} -eq 1 ]; then
  119. if [ ! -f ${DIAG_D}/clim/last_clim ]; then echo "Boooo!"; exit; fi
  120. CLIM_PER=`cat ${DIAG_D}/clim/last_clim`
  121. iclyear=`echo ${CLIM_PER} | sed -e s/'-'/' '/g`
  122. CMD="python exec/temp_sal.py ${iclyear}"
  123. echo ; echo " CMD = ${CMD} "; echo
  124. fi
  125. if [ ${iice} -eq 1 ]; then
  126. if [ ! -f ${DIAG_D}/clim/last_clim ]; then echo "Boooo!"; exit; fi
  127. CLIM_PER=`cat ${DIAG_D}/clim/last_clim`
  128. iclyear=`echo ${CLIM_PER} | sed -e s/'-'/' '/g`
  129. CMD="python exec/ice.py ${iclyear}"
  130. echo ; echo " CMD = ${CMD} "; echo
  131. fi
  132. if [ ${its} -eq 1 ]; then
  133. #diag=3d_thetao ; ln -sf ${DIAG_D}/3d_${NN_T}*.nc .
  134. #diag=mean_zos ; ln -sf ${DIAG_D}/mean_${NN_SSH}*.nc .
  135. #diag=mean_htf ; ln -sf ${DIAG_D}/mean_htf*.nc .
  136. #diag=mean_fwf ; ln -sf ${DIAG_D}/mean_fwf*.nc .
  137. diag=transport_sections ; ln -sf ${DIAG_D}/transport_*sect_*.nc .
  138. #ln -sf ${DIAG_D}/${diag}*.nc .
  139. CMD="python exec/plot_time_series.py ${diag}"
  140. fi
  141. if [ ${itrsig} -eq 1 ]; then
  142. CMD="python exec/plot_trsp_sigma.py"
  143. fi
  144. if [ ${ifsflx} -eq 1 ]; then
  145. export DIAG_D="`pwd`/flx"
  146. CMD="${BARAKUDA_ROOT}/src/bash/extract_ifs_surf_fluxes.sh"
  147. fi
  148. if [ ${imean2d} -eq 1 ]; then
  149. export DIAG_D=`pwd`
  150. CMD="python exec/mean_2d.py ${ft} ${jyear}"
  151. fi
  152. if [ ${imean3d} -eq 1 ]; then
  153. export DIAG_D=`pwd`
  154. CMD="python exec/mean_3d.py ${ft} ${jyear} T"
  155. fi
  156. if [ ${iSflx} -eq 1 ]; then
  157. export DIAG_D=`pwd`
  158. CMD="python exec/flux_int_basins.py ${ft} ${jyear}"
  159. fi
  160. if [ ${imov} -eq 1 ]; then
  161. #for cv in sst mld sss; do
  162. #cv=sst
  163. cv=sss
  164. CMD="python exec/prepare_movies.py ${ft} ${jyear} ${cv}"
  165. #done
  166. fi
  167. if [ ${issh} -eq 1 ]; then
  168. CMD="python exec/ssh.py ${y1_clim} ${y2_clim}"
  169. fi
  170. if [ ${ipsi} -eq 1 ]; then
  171. CMD="python exec/psi.py ${y1_clim} ${y2_clim}"
  172. fi
  173. if [ ${iwind} -eq 1 ]; then
  174. CMD="python exec/wind.py ${y1_clim} ${y2_clim}"
  175. fi
  176. if [ ${isfluxes} -eq 1 ]; then
  177. CMD="python exec/sfluxes.py ${y1_clim} ${y2_clim}"
  178. fi
  179. if [ ${imld} -eq 1 ]; then
  180. CMD="python exec/mld.py ${y1_clim} ${y2_clim}"
  181. fi
  182. echo
  183. echo "DOING: ${CMD}"
  184. ${CMD}
  185. # Add other diags here:
  186. exit
  187. # BELOW = OLD STUFFS, fix!
  188. if [ ${ihov} -eq 1 ]; then
  189. export EXP=cp70
  190. export ORCA=ORCA1.L75
  191. export DIAG_D=/proj/bolinc/users/x_laubr/tmp/barakuda/ORCA1.L75_ece32b/ORCA1.L75-${EXP}
  192. export MM_FILE=/proj/bolinc/users/x_laubr/klaus/mesh_mask.nc
  193. export BM_FILE=/proj/bolinc/users/x_laubr/klaus/basin_mask.nc
  194. export NN_T="thetao"
  195. export NN_S="so"
  196. #
  197. cd ${DIAG_D}/
  198. python /home/x_laubr/DEV/barakuda/python/exec/plot_hovm_tz.py 1996 2000
  199. mv -f hov_*_ORCA1.L75-${EXP}*.png ${HERE}/
  200. #
  201. fi
  202. if [ ${iemp} -eq 1 ]; then
  203. export ORCA="ORCA1.L75"
  204. #export EXP="32bI"
  205. export EXP="cp00"
  206. export TSTAMP="1m"
  207. export DIAG_D="/proj/bolinc/users/x_laubr/tmp/barakuda/ORCA1.L75_ece32b/ORCA1.L75-${EXP}"
  208. #export NN_RNF="runoffs"
  209. export MM_FILE="/proj/bolinc/users/x_laubr/tmp/barakuda/test/mesh_mask.nc"
  210. export TRANSPORT_SECTION_FILE="boo"
  211. export LMOCLAT="boo" ; export NN_SSH="boo" ; export NN_SSS="boo" ; export NN_S="boo"
  212. export NN_MLD="boo" ; export NN_SST="boo" ; export NN_T="boo"
  213. export NN_FWF="wfo" ; # name of net freshwater flux (E-P-R) in "FILE_FLX_SUFFIX" file...
  214. export NN_EMP="emp_oce" ; # name of E-P in "FILE_FLX_SUFFIX" file...
  215. export NN_P="precip" ; # name of P in "FILE_FLX_SUFFIX" file...
  216. export NN_RNF="XXX" ; # name of continental runoffs in "FILE_FLX_SUFFIX" file...
  217. export FILE_DEF_BOXES="/home/x_laubr/DEV/barakuda/data/def_boxes_convection_ORCA1.txt"
  218. cd ${DIAG_D}/
  219. python /home/x_laubr/DEV/barakuda/python/exec/plot_time_series.py mean_fwf
  220. fi
  221. if [ ${irnf} -eq 1 ]; then
  222. export ORCA="ORCA1.L75"
  223. export EXP="LB03"
  224. export DIAG_D="/proj/bolinc/users/x_laubr/tmp/barakuda/ORCA1.L75_ece32b/ORCA1.L75-${EXP}"
  225. export NN_RNF="runoffs"
  226. export MM_FILE="/proj/bolinc/users/x_laubr/tmp/barakuda/test/mesh_mask.nc"
  227. python exec/runoffs.py 1997 1999
  228. fi