barakuda.sh 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974
  1. #!/usr/bin/env bash
  2. #==============================================================
  3. #
  4. # B A R A K U D A
  5. #
  6. # An OCEAN MONITORING python environment for NEMO
  7. #
  8. # L. Brodeau, 2009-2017
  9. #
  10. #===============================================================
  11. export script=barakuda
  12. [ -z ${BARAKUDA_ROOT+x} ] && export BARAKUDA_ROOT=${PWD}
  13. # Display available configs:
  14. list_conf="`\ls ${BARAKUDA_ROOT}/configs/config_*.sh | sed -e "s|${BARAKUDA_ROOT}/configs\/config_||g" -e s/'.sh'/''/g`"
  15. # User configs, potentially in the directory from which barakuda.sh is called:
  16. list_conf+=" `\ls ./config_*.sh 2>/dev/null | sed -e "s|.\/config_||g" -e s/'.sh'/''/g`"
  17. # Important bash functions:
  18. . ${BARAKUDA_ROOT}/src/bash/bash_functions.bash
  19. barakuda_init
  20. while getopts C:R:f:y:c:FeEh option ; do
  21. case $option in
  22. C) export CONFIG=${OPTARG} ;;
  23. R) export EXP=${OPTARG} ;;
  24. f) export IFREQ_SAV_YEARS=${OPTARG} ;;
  25. y) export YEAR0=${OPTARG} ; export LFORCE_YINI=true ;;
  26. c) export EXPREF=${OPTARG} ;;
  27. F) export LFORCEDIAG=true ;;
  28. e) export ISTAGE=2 ;;
  29. E) export ISTAGE=2 ; export l_clim_diag=true ;;
  30. h) barakuda_usage; exit ;;
  31. \?) barakuda_usage; exit ;;
  32. esac
  33. done
  34. barakuda_check
  35. # Time to source the config file:
  36. if [ -f ./config_${CONFIG}.sh ]; then
  37. # sourcing local configuration file if present:
  38. fconfig=./config_${CONFIG}.sh
  39. else
  40. # sourcing barakuda-distribution configuration file:
  41. fconfig=${BARAKUDA_ROOT}/configs/config_${CONFIG}.sh
  42. fi
  43. if [ -f ${fconfig} ]; then
  44. echo "Sourcing configuration file: ${fconfig} !"
  45. . ${fconfig}
  46. else
  47. echo "ERROR: cannot find file ${fconfig} !"; exit
  48. fi
  49. echo
  50. # If auto-submit experiment (ece_exp=10) then overides a few functions with:
  51. if [ ${ece_exp} -ge 10 ]; then
  52. echo "Sourcing ${BARAKUDA_ROOT}/src/bash/bash_functions_autosub.bash"
  53. . ${BARAKUDA_ROOT}/src/bash/bash_functions_autosub.bash
  54. fi
  55. # If 3D fieds are annual averaged then overides a few functions with:
  56. if [ ! "${ANNUAL_3D}" = "" ]; then
  57. . ${BARAKUDA_ROOT}/src/bash/bash_functions_1y.bash
  58. fi
  59. # List of CDFTOOLS executables needed for the diagnostics:
  60. export L_EXEC="cdfmaxmoc.x cdfmoc.x cdfvT.x cdftransportiz.x cdficeflux.x cdficediags.x cdfmhst.x cdfsigtrp.x"
  61. barakuda_setup
  62. echo
  63. echo " SETTINGS: "
  64. echo " *** CONFIG = ${CONFIG} "
  65. echo " *** NEMO_OUT_D = ${NEMO_OUT_D} "
  66. echo " *** CLIM_DIR = ${CLIM_DIR} "
  67. echo " *** TMP_DIR = ${TMP_DIR} "
  68. echo " *** GRID = ${ORCA} "
  69. echo " *** EXP = ${EXP} "
  70. echo " *** CPREF = ${CPREF} "
  71. echo " *** IFREQ_SAV_YEARS = ${IFREQ_SAV_YEARS} "
  72. echo " *** NCDF_DIR = ${NCDF_DIR} "
  73. echo
  74. if [ ${ISTAGE} -eq 1 ]; then
  75. barakuda_first_last_years ; # look at NEMO files to know what are first and last years available...
  76. echo ${IFREQ_SAV_YEARS} > ${DIAG_D}/numb_year_per_file.info
  77. echo ${YEAR_INI} > ${DIAG_D}/first_year.info
  78. else
  79. # -> this is stage 2 (plot generation) ISTAGE=2 !
  80. barakuda_init_plot
  81. fi
  82. cyear_ini=`printf "%04d" ${YEAR_INI}`
  83. cyear_end=`printf "%04d" ${YEAR_END}`
  84. # For proper python executables and scripts to be found:
  85. export PATH=${PYBRKD_EXEC_PATH}:${BARAKUDA_ROOT}/src/bash:${PYTHON_HOME}/bin:${PATH}
  86. # setup over
  87. ######################################################################################
  88. jyear=${YEAR_INI}
  89. fcompletion=${DIAG_D}/last_year_done.info
  90. if [ -f ${fcompletion} ]; then jyear=`cat ${fcompletion}`; ((jyear++)); fi
  91. cd ${TMP_DIR}/
  92. barakuda_import_mesh_mask ; # Importing mesh_mask (+basin) files...
  93. if [ ${ISTAGE} -eq 1 ]; then
  94. # Importing cdftools executables:
  95. for ex in ${L_EXEC}; do rsync -v ${BARAKUDA_ROOT}/cdftools_light/bin/${ex} . ; done
  96. fi
  97. # L O O P A L O N G Y E A R S
  98. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  99. lcontinue=true
  100. if ${LFORCEDIAG}; then lcontinue=false; fi
  101. while ${lcontinue}; do
  102. export cyear=`printf "%04d" ${jyear}`
  103. cpf=""
  104. if [ ${ISTAGE} -eq 1 ] && [ ${ece_exp} -gt 0 ]; then
  105. iy=$((${jyear}-${YEAR_INI}+1+${YEAR_INI}-${YEAR_INI_F}))
  106. dir_ece=`printf "%03d" ${iy}`
  107. echo " *** ${cyear} => dir_ece = ${dir_ece}"
  108. cpf="${dir_ece}/"
  109. fi
  110. i_get_file=0
  111. if [ $((${jyear}%${IFREQ_SAV_YEARS})) -eq 0 ]; then
  112. barakuda_check_year_is_complete ; # lcontinue might be updated to false!
  113. fi
  114. echo; echo
  115. export CRT1M=${CPREF}${cyear}${cmmdd1}_${cyear}${cmmdd2}
  116. if ${l_y2_j}; then export CRT1M=${CPREF}${cyear}${cmmdd1}_`printf "%04d" $((${jyear}+1))`${cmmdd2} ; fi
  117. if ${lcontinue}; then
  118. echo "Yeah! Year ${jyear} is saved..."; echo
  119. if [ ${ISTAGE} -eq 2 ]; then
  120. echo; echo "You cannot create figures and HTML pages yet!"
  121. echo " => finish treating the results first by launching barakuda.sh without the '-e' switch."
  122. exit
  123. fi
  124. echo; echo
  125. echo "*********************************************************************"
  126. echo " Experiment ${EXP}: Will generate diagnostics and data for year ${cyear}..."
  127. echo "*********************************************************************"
  128. echo; echo
  129. barakuda_import_files
  130. # Monthly files to work with for current year:
  131. ft1m=${CRT1M}_grid_T.nc
  132. fu1m=${CRT1M}_grid_U.nc
  133. fv1m=${CRT1M}_grid_V.nc
  134. fj1m=${CRT1M}_${FILE_ICE_SUFFIX}.nc ; # can be icemod or grid_T ....
  135. ff1m=${CRT1M}_${FILE_FLX_SUFFIX}.nc ; # file with surface fluxes
  136. #
  137. # Annual files to work with for current year:
  138. CRT1Y=`echo ${CRT1M} | sed -e s/"_${TSTAMP}_"/"_${ANNUAL_3D}_"/g`
  139. ft1y=${CRT1Y}_grid_T.nc
  140. fu1y=${CRT1Y}_grid_U.nc
  141. fv1y=${CRT1Y}_grid_V.nc
  142. fj1y=${CRT1Y}_${FILE_ICE_SUFFIX}.nc
  143. ff1y=${CRT1Y}_${FILE_FLX_SUFFIX}.nc
  144. CFG3D=${CRT1M}
  145. #
  146. # Files that contain the 3D fields (might be monthly or annaual sometimes (when "${ANNUAL_3D}" = "1y")
  147. ft3d=${ft1m}
  148. fu3d=${fu1m}
  149. fv3d=${fv1m}
  150. if [ "${ANNUAL_3D}" = "1y" ]; then
  151. [[ ${NEMO_SAVED_FILES_3D} =~ (^|[[:space:]])"grid_U"($|[[:space:]]) ]] \
  152. && CFG3D=${CRT1Y}; ft3d=${ft1y}; fu3d=${fu1y}; fv3d=${fv1y} \
  153. || echo "...default"
  154. echo ""
  155. fi
  156. fvt=${CFG3D}_VT.nc
  157. # -- time to compute diagnostics --
  158. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  159. # If coupled EC-Earth simu, attempting to compute ocean-averaged fluxes from IFS too (E, P, E-P)
  160. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  161. if [ ${ece_exp} -eq 2 ] && [ ${NBL} -eq 75 ] && [ ${i_do_ifs_flx} -eq 1 ]; then
  162. echo; echo; echo "Fluxes of freshwater at the surface from IFS..."
  163. echo " *** CALLING: extract_ifs_surf_fluxes.sh &"
  164. extract_ifs_surf_fluxes.sh &
  165. pid_flxl=$! ; echo
  166. fi
  167. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  168. # Computing time-series of spatially-averaged variables
  169. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  170. if [ ${i_do_mean} -eq 1 ]; then
  171. #
  172. echo; echo "3D-averaging for time series"
  173. echo " *** CALLING: mean_3d.py ${ft1m} ${jyear} T &"
  174. mean_3d.py ${ft1m} ${jyear} T &
  175. pid_mn3dt=$! ; echo
  176. #
  177. echo " *** CALLING: mean_3d.py ${ft1m} ${jyear} S &"
  178. mean_3d.py ${ft1m} ${jyear} S &
  179. pid_mn3ds=$! ; echo
  180. #
  181. echo; echo "2D-averaging for time series"
  182. echo " *** CALLING: mean_2d.py ${ft1m} ${jyear} &"
  183. mean_2d.py ${ft1m} ${jyear} &
  184. pid_mn2d=$! ; echo
  185. #
  186. echo; echo "2D-integration of some surface fluxes over basins"
  187. echo " *** CALLING: flux_int_basins.py ${ff1m} ${jyear} &"
  188. flux_int_basins.py ${ff1m} ${jyear} &
  189. pid_ssf=$! ; echo
  190. #
  191. fi
  192. # ~~~~~~~~~~~~~~~~~~~~~~~~~~
  193. # Creating VT file if needed
  194. # ~~~~~~~~~~~~~~~~~~~~~~~~~~
  195. if [ ${i_do_trsp} -gt 0 ] || [ ${i_do_mht} -eq 1 ]; then
  196. if [ ! -f ${fvt} ]; then
  197. echo; echo; echo " *** CALLING: ./cdfvT.x ${CFG3D} ${NN_T} ${NN_S} ${NN_U} ${NN_V} ${NN_U_EIV} ${NN_V_EIV} &"
  198. ./cdfvT.x ${CFG3D} ${NN_T} ${NN_S} ${NN_U} ${NN_V} ${NN_U_EIV} ${NN_V_EIV} &
  199. pid_vtvt=$! ; echo
  200. fi
  201. fi
  202. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  203. # 2D maps of NEMO - OBS for SST and SSS (for movies)
  204. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  205. if [ ${i_do_movi} -eq 1 ]; then
  206. echo; echo; echo "2D maps of NEMO - OBS for SST and SSS (for movies)"
  207. echo " *** CALLING: prepare_movies.py ${ft1m} ${jyear} sst &"
  208. prepare_movies.py ${ft1m} ${jyear} sst &
  209. pid_movt=$! ; echo
  210. echo " *** CALLING: prepare_movies.py ${ft1m} ${jyear} sss &"
  211. prepare_movies.py ${ft1m} ${jyear} sss &
  212. pid_movs=$! ; echo
  213. echo " *** CALLING: prepare_movies.py ${ft1m} ${jyear} mld &"
  214. prepare_movies.py ${ft1m} ${jyear} mld &
  215. pid_movm=$! ; echo
  216. echo " *** CALLING: prepare_movies.py ${fj1m} ${jyear} ice &"
  217. prepare_movies.py ${fj1m} ${jyear} ice &
  218. pid_movi=$! ; echo
  219. fi
  220. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  221. # Computing time-series of spatially-averaged variables
  222. # on boxes (saving the variable on 2D box too...
  223. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224. if [ ${i_do_ssx_box} -eq 1 ]; then
  225. echo; echo; echo "Box monthly values"
  226. echo " *** CALLING: ssx_boxes ${ft1m} ${jyear} ${NN_SST} ${NN_SSS} &"
  227. ssx_boxes.py ${ft1m} ${jyear} ${NN_SST} ${NN_SSS} &
  228. pid_boxa=$! ; echo
  229. fi
  230. #~~~~~~~
  231. # MOC
  232. #~~~~~~~
  233. if [ ${i_do_amoc} -eq 1 ]; then
  234. echo; echo; echo "MOC"
  235. rm -f moc.nc *.tmp
  236. echo " *** CALLING: ./cdfmoc.x ${fv3d} ${NN_V} ${NN_V_EIV} &"
  237. ./cdfmoc.x ${fv3d} ${NN_V} ${NN_V_EIV} &
  238. pid_amoc=$! ; echo
  239. fi
  240. #~~~~~~~~~~~~~~~~~~~~~~~~~~~
  241. # Transport by sigma-class
  242. #~~~~~~~~~~~~~~~~~~~~~~~~~~~
  243. if [ ${i_do_sigt} -eq 1 ]; then
  244. echo; echo
  245. if [ ! -f ./dens_section.dat ]; then
  246. if [ -f ${DENSITY_SECTION_FILE} ]; then
  247. echo "Copying ${DENSITY_SECTION_FILE} to here: `pwd` !"; cp ${DENSITY_SECTION_FILE} ./dens_section.dat
  248. else
  249. echo; echo "WARNING: Can't do Transport by sigma-class: ${DENSITY_SECTION_FILE} is missing!!!"
  250. fi
  251. fi
  252. echo " *** CALLING: ./cdfsigtrp.x ${ft3d} ${fu3d} ${fv3d} 24.8 28.6 19 ${jyear} ${DIAG_D} ${NN_T} ${NN_S} ${NN_U} ${NN_V} &"; echo
  253. ./cdfsigtrp.x ${ft3d} ${fu3d} ${fv3d} 24.8 28.6 19 ${jyear} ${DIAG_D} ${NN_T} ${NN_S} ${NN_U} ${NN_V} &
  254. pid_sigt=$! ; echo
  255. fi
  256. echo
  257. echo " Gonna wait for level #1 to be done !"
  258. wait ${pid_vtvt}
  259. #wait
  260. echo " .... diag level #1 done...." ; echo
  261. echo
  262. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  263. # Meridional heat and salt transport
  264. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  265. if [ ${i_do_mht} -eq 1 ]; then
  266. echo; echo; echo "Meridional transport of heat and salt"
  267. fo=${DIAG_D}/merid_transport_T_S_${CONFEXP}.nc
  268. if [ ! -f ${fvt} ]; then
  269. echo "WARNING: file ${fvt} is not here, skipping meridional transports section"
  270. else
  271. rm -f merid_heat_trp.dat merid_salt_trp.dat
  272. echo " *** CALLING: ./cdfmhst.x ${fvt} ${fo} ${jyear} &"
  273. ./cdfmhst.x ${fvt} ${fo} ${jyear} &
  274. pid_mhst=$! ; echo
  275. fi
  276. fi
  277. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  278. # VOLUME, HEAT and SALT transports through specified section
  279. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  280. if [ ${i_do_trsp} -gt 0 ]; then
  281. echo; echo; echo "Transports of volume, heat and salt through different sections"
  282. if [ -z ${TRANSPORT_SECTION_FILE} ]; then
  283. echo "Please specify which TRANSPORT_SECTION_FILE to use into the config file!" ; exit
  284. fi
  285. if [ ! -f ./transportiz.dat ]; then
  286. check_if_file ${TRANSPORT_SECTION_FILE}
  287. cp ${TRANSPORT_SECTION_FILE} ./transportiz.dat
  288. fi
  289. if [ ${i_do_trsp} -eq 1 ]; then z1_trsp="" ; z2_trsp=""; fi
  290. if [ ! -f ${fvt} ]; then
  291. echo "WARNING: file ${fvt} is not here, skipping transport section!"
  292. else
  293. # Breaking transportiz file in several files so we can go parallel!
  294. rm -f transportiz_*.dat
  295. break_downn_section_file.py ./transportiz.dat 2 ; # => Max. 2 sections per file
  296. list=`\ls transportiz_*.dat`
  297. for fs in ${list}; do
  298. echo " *** CALLING: ./cdftransportiz.x ${fs} ${CFG3D} ${NN_U} ${NN_V} ${NN_U_EIV} ${NN_V_EIV} ${jyear} ${DIAG_D} ${z1_trsp} ${z2_trsp} &"
  299. ./cdftransportiz.x ${fs} ${CFG3D} ${NN_U} ${NN_V} ${NN_U_EIV} ${NN_V_EIV} ${jyear} ${DIAG_D} ${z1_trsp} ${z2_trsp} &
  300. echo
  301. done
  302. fi
  303. fi
  304. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  305. # Solid freshwater transport through sections due to sea-ice drift
  306. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  307. if [ ${i_do_ice} -gt 0 ] && [ ${i_do_trsp_ice} -eq 1 ]; then
  308. echo; echo; echo "Solid freshwater transport through sections due to sea-ice drift"
  309. if [ -z ${TRANSPORT_SECTION_FILE_ICE} ]; then
  310. echo "Please specify which TRANSPORT_SECTION_FILE_ICE to use into the config file!" ; exit
  311. fi
  312. if [ ! -f ./transport_ice.dat ]; then
  313. check_if_file ${TRANSPORT_SECTION_FILE_ICE}
  314. cp ${TRANSPORT_SECTION_FILE_ICE} ./transport_ice.dat
  315. fi
  316. #
  317. # Breaking transportiz file in several files so we can go parallel!
  318. rm -f transport_ice_*.dat
  319. break_downn_section_file.py ./transport_ice.dat 2 ; # => Max. 2 sections per file
  320. list=`\ls transport_ice_*.dat`
  321. for fs in ${list}; do
  322. echo " *** CALLING: ./cdficeflux.x ${fs} ${fj1m} ${NN_ICEF} ${NN_ICEU} ${NN_ICEV} ${NN_ICET} ${jyear} ${DIAG_D} &"
  323. ./cdficeflux.x ${fs} ${fj1m} ${NN_ICEF} ${NN_ICEU} ${NN_ICEV} ${NN_ICET} ${jyear} ${DIAG_D} &
  324. echo
  325. done
  326. fi
  327. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  328. # Deep Mixed Volume (DMV) on a given box
  329. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  330. if [ ! -z ${i_do_dmv} ] && [ ${i_do_dmv} -gt 0 ]; then
  331. if [ -z ${FILE_DEF_BOXES} ]; then
  332. echo "Please specify a FILE_DEF_BOXES to use into the config file!" ; exit
  333. fi
  334. echo " *** CALLING: dmv.py ${ft1m} ${cyear} &"
  335. dmv.py ${ft1m} ${cyear} &
  336. pid_dmvl=$! ; echo
  337. fi
  338. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  339. # Budget and other stuffs on a given rectangular box!
  340. # It provides time-series depending only on time (not depth)
  341. # budget_rectangle_box.py
  342. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  343. if [ ${i_do_bb} -gt 0 ]; then
  344. echo; echo; echo "Budget and other stuffs on rectangular boxes!"
  345. if [ -z ${FILE_DEF_BOXES} ]; then
  346. echo "Please specify a FILE_DEF_BOXES to use into the config file!" ; exit
  347. fi
  348. echo " *** CALLING: budget_rectangle_box.py ${cyear} 100 uv &"
  349. budget_rectangle_box.py ${cyear} 100 uv &
  350. pid_bbbb=$! ; echo
  351. fi
  352. echo " Gonna wait for level #2 to be done !"
  353. wait ${pid_amoc} ; # moc needs to be done to call cdfmaxmoc.x ...
  354. echo
  355. echo " .... diag level #2 done...." ; echo ; echo
  356. #~~~~~~~~~~~
  357. # Max AMOC
  358. #~~~~~~~~~~~
  359. if [ ${i_do_amoc} -eq 1 ]; then
  360. if [ -z "${LMOCLAT}" ]; then
  361. echo "AMOC => specify latitude bands with variable LMOCLAT into the config file!!!"; exit
  362. fi
  363. for clat in ${LMOCLAT}; do
  364. cslat=`echo ${clat} | sed -e s/'-'/' '/g`
  365. echo " *** ./cdfmaxmoc.x moc.nc atl ${cslat} 500 1500 ${jyear} ${DIAG_D}"
  366. ./cdfmaxmoc.x moc.nc atl ${cslat} 500 1500 ${jyear} ${DIAG_D}
  367. done
  368. fi
  369. #~~~~~~~~~
  370. # SEA-ICE
  371. #~~~~~~~~~
  372. if [ ${i_do_ice} -eq 1 ]; then
  373. echo; echo; echo "Sea-ice extent and volume..." ; rm -f tmp_ice.nc
  374. echo "ncks -A -v ${NN_ICEF} ${fj1m} -o tmp_ice.nc"
  375. ncks -A -v ${NN_ICEF} ${fj1m} -o tmp_ice.nc
  376. ncrename -v ${NN_ICEF},ice_frac tmp_ice.nc
  377. coic=""
  378. if [ -z ${NN_ICET} ]; then
  379. coic="oic" ; # means only ice concentration available!
  380. else
  381. echo "ncks -A -v ${NN_ICET} ${fj1m} -o tmp_ice.nc"
  382. ncks -A -v ${NN_ICET} ${fj1m} -o tmp_ice.nc
  383. ncrename -v ${NN_ICET},ice_thic tmp_ice.nc
  384. fi
  385. echo " *** CALLING: ./cdficediags.x tmp_ice.nc ${jyear} ${DIAG_D} ${coic} &"
  386. ./cdficediags.x tmp_ice.nc ${jyear} ${DIAG_D} ${coic} &
  387. fi
  388. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  389. # Temperature and Salinity on cross meridional/zonal sections
  390. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  391. if [ ${i_do_sect} -eq 1 ]; then
  392. check_if_file ${TS_SECTION_FILE}
  393. lst_sec=`cat ${TS_SECTION_FILE} | grep -v -E '(^#|EOF)' | awk -F ' ' '{print $1}'`
  394. echo; echo; echo "Cross-sections on specified transects:"
  395. echo "${lst_sec}"; echo
  396. echo " *** CALLING: cross_sections.py ${ft3d} ${jyear} &"
  397. cross_sections.py ${ft3d} ${jyear} &
  398. echo
  399. fi
  400. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  401. # Vertical profiles of T,S and density horizontally averaged
  402. # on rectangular boxes defined into FILE_DEF_BOXES
  403. # => creates time-series function of time and depth
  404. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  405. if [ ${i_do_box_TS_z} -gt 0 ]; then
  406. if [ -z ${FILE_DEF_BOXES} ]; then
  407. echo "Please specify a FILE_DEF_BOXES to use into the config file!" ; exit
  408. fi
  409. echo " *** CALLING: prof_TS_z_box.py ${cyear} &"
  410. prof_TS_z_box.py ${cyear} &
  411. echo;echo
  412. fi
  413. # --- end of stuffs that can be launched in bg ---
  414. echo
  415. echo " Waiting for backround jobs for current year (${jyear}) !"
  416. wait ${pid_mn3dt} ${pid_mn3ds} ${pid_movt} ${pid_movs} ${pid_movm} ${pid_movi} ${pid_mn2d} ${pid_ssf} ${pid_flxl}
  417. wait
  418. echo " Done waiting for year ${cyear} !"
  419. if [ ${i_do_movi} -eq 1 ]; then rsync -rv movies ${DIAG_D}/ ; fi
  420. rm -f *.tmp broken_line_* tmp_ice.nc
  421. rm -f ${CRT1M}_*.nc ${CRT1Y}_*.nc ; #debug
  422. echo
  423. echo " ---- DIAGS ARE DONE FOR YEAR ${cyear} ! ---"
  424. echo "${cyear}" > ${fcompletion}
  425. echo; echo
  426. fi ; # if ${lcontinue}; then
  427. #if ${LFORCE_YEND}; then
  428. # if [ ${jyear} -eq ${YEARN} ]; then lcontinue=false; fi
  429. #fi
  430. wait
  431. ((jyear++))
  432. # end loop years...
  433. done ; # while ${lcontinue}; do
  434. # PREPARING HTML PAGE
  435. # ~~~~~~~~~~~~~~~~~~~
  436. l_pclim=false
  437. if [ ${ISTAGE} -eq 2 ]; then
  438. rm -rf ${DIAG_D}/${EXP}
  439. y1=`cat ${DIAG_D}/first_year.info`
  440. y2=`cat ${DIAG_D}/last_year_done.info`
  441. nby=$((${y2}-${y1}+1))
  442. # Agreement between last year from output files and 'fcompletion' file:
  443. ydum=`cat ${fcompletion}`
  444. if [ -z ${YEARN} ]; then
  445. # (if YEARN is not set...)
  446. if [ ! ${ydum} -eq ${YEAR_END} ]; then
  447. echo;
  448. echo "###################################################################"
  449. echo "ERROR: in ${fcompletion} last_year = ${ydum}"
  450. echo " and from stored files files last_year = ${YEAR_END} !"
  451. echo "###################################################################"
  452. echo
  453. exit
  454. fi
  455. fi
  456. echo; echo; echo "EXP ${EXP}: creating plots"; echo
  457. #cd ${BARAKUDA_ROOT}/
  458. cd ${DIAG_D}/
  459. echo
  460. if [ ${i_do_movi} -eq 1 ]; then
  461. if [ "${iffmpeg_x264}" = "1" ]; then
  462. # FFMPEG compiled with x264 mp4 support is available on host:
  463. cd movies/
  464. for cc in dsst dsss mld icen ices; do
  465. hh=520 ; # height of image in pixels
  466. if [ "${cc}" = "icen" ]; then hh=576; fi
  467. if [ "${cc}" = "ices" ]; then hh=456; fi
  468. echo " *** CALLING: images2mp4.sh ${cc} ${FIG_FORM} ${hh} 8 &"
  469. images2mp4.sh ${cc} ${FIG_FORM} ${hh} 8 &
  470. echo
  471. done
  472. cd ${DIAG_D}/
  473. else
  474. # Faling back on GIF, with 'convert' of imageMagick:
  475. idelay=$((120-${nby}*8))
  476. if [ ${idelay} -lt 10 ]; then idelay=10; fi
  477. rm -f *_${CONFEXP}.gif
  478. for cc in dsst dsss mld icen ices; do
  479. echo " *** CALLING: convert -delay ${idelay} -loop 0 movies/${cc}_*.png ${cc}_${CONFEXP}.gif &"
  480. convert -delay ${idelay} -loop 0 movies/${cc}_*.png ${cc}_${CONFEXP}.gif &
  481. echo
  482. done
  483. fi
  484. fi
  485. # 1D plots to perform
  486. # ~~~~~~~~~~~~~~~~~~~
  487. DIAG_1D_LIST=""
  488. if [ ${i_do_mean} -eq 1 ]; then
  489. DIAG_1D_LIST="${DIAG_1D_LIST} 3d_so mean_sos 3d_thetao mean_tos mean_zos"
  490. if [ ! "${NN_MLD}" = "X" ]; then DIAG_1D_LIST="${DIAG_1D_LIST} mean_mld"; fi
  491. if [ ! "${NN_QNET}" = "X" ]; then DIAG_1D_LIST="${DIAG_1D_LIST} mean_htf"; fi
  492. if [ ! "${NN_FWF}" = "X" ]; then DIAG_1D_LIST="${DIAG_1D_LIST} mean_fwf"; fi
  493. fi
  494. if [ ${i_do_amoc} -eq 1 ]; then DIAG_1D_LIST="${DIAG_1D_LIST} amoc"; fi
  495. if [ ${i_do_ice} -eq 1 ]; then DIAG_1D_LIST="${DIAG_1D_LIST} seaice"; fi
  496. if [ ${i_do_trsp} -gt 0 ] || [ ${i_do_trsp_ice} -eq 1 ]; then DIAG_1D_LIST="${DIAG_1D_LIST} transport_sections" ; fi
  497. dy=$((${YEAR_END}-${YEAR_INI}+1)) ; export YF2=$((${YEAR_END}+1))
  498. # Doing 1D plots
  499. # ~~~~~~~~~~~~~~
  500. echo ; echo; echo "Going to perform the following 1D plots:"
  501. echo " => ${DIAG_1D_LIST}"; echo
  502. for fd in ${DIAG_1D_LIST}; do
  503. echo " *** CALLING: plot_time_series.py ${fd}"
  504. plot_time_series.py ${fd} ; echo
  505. echo
  506. done
  507. echo ; echo ; echo
  508. if [ ${i_do_mean} -eq 1 ]; then
  509. # 5-month-running mean SST anomaly over Nino region 3.4 graph:
  510. echo " *** CALLING: plot_enso.py Nino34_${CONFEXP}.nc ${NN_SST}"
  511. plot_enso.py Nino34_${CONFEXP}.nc ${NN_SST}
  512. echo; echo
  513. # Hovmuller of temperature and salinity
  514. echo " *** CALLING: plot_hovm_tz.py"
  515. plot_hovm_tz.py
  516. echo; echo
  517. if [ ${nby} -ge 70 ]; then
  518. # AMO aka 11-year-running mean SST anomaly over North Atlantic (0-70N)
  519. echo " *** CALLING: plot_amo.py mean_SST_NAtl_${CONFEXP}.nc ${NN_SST}"
  520. plot_amo.py mean_SST_NAtl_${CONFEXP}.nc ${NN_SST}
  521. echo; echo
  522. fi
  523. fi
  524. if [ ${i_do_sigt} -eq 1 ]; then
  525. # Transport by sigma-class
  526. echo " *** CALLING: plot_trsp_sigma.py"
  527. plot_trsp_sigma.py
  528. echo; echo; echo
  529. fi
  530. if [ ${i_do_mht} -eq 1 ]; then
  531. #
  532. # Hovmullers of advective meridional heat/salt transport
  533. echo; echo
  534. echo " *** CALLING: plot_hovm_merid_trsp.py"
  535. plot_hovm_merid_trsp.py
  536. echo; echo; echo
  537. #
  538. fi
  539. echo; echo; echo
  540. if ${l_clim_diag} ; then
  541. ###########################################################################
  542. # Climatology over X years (12-month file average of X consecutive years)
  543. # => has to be built with the 'build_clim.sh' script
  544. ###########################################################################
  545. echo; echo; echo "Checking for presence of ${DIAG_D}/clim/last_clim..."
  546. if [ -f ${DIAG_D}/clim/last_clim ]; then
  547. cat ${DIAG_D}/clim/last_clim
  548. export CLIM_PER=`cat ${DIAG_D}/clim/last_clim`
  549. ftcli=${DIAG_D}/clim/mclim_${CONFEXP}_${CLIM_PER}_grid_T.nc4
  550. ficli=${DIAG_D}/clim/mclim_${CONFEXP}_${CLIM_PER}_${FILE_ICE_SUFFIX}.nc4
  551. fcsbc=${DIAG_D}/clim/mclim_${CONFEXP}_${CLIM_PER}_${FILE_FLX_SUFFIX}.nc4
  552. fclvt=${DIAG_D}/clim/aclim_${CONFEXP}_${CLIM_PER}_VT.nc4
  553. fcmoc=${DIAG_D}/clim/aclim_${CONFEXP}_${CLIM_PER}_MOC.nc4
  554. fcpsi=${DIAG_D}/clim/aclim_${CONFEXP}_${CLIM_PER}_PSI.nc4
  555. fccrl=${DIAG_D}/clim/aclim_${CONFEXP}_${CLIM_PER}_TCURL.nc4
  556. iclyear=`echo ${CLIM_PER} | sed -e s/'-'/' '/g`
  557. else
  558. echo; echo "ERROR => you set l_clim_diag to true (probably by using '-E') but no file 'last_clim' was found in:"
  559. echo " ${DIAG_D}/clim/"
  560. echo " => then use '-e' instead!"; echo
  561. exit
  562. fi
  563. echo; echo; echo "Checking for presence of ${ftcli}..."
  564. if [ -f ${ftcli} ]; then
  565. echo; echo;
  566. echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~"
  567. echo "* Climatologies found !!!"
  568. echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~"
  569. echo
  570. echo " => for years ${CLIM_PER}" ; echo " => using ${ftcli}"
  571. list_comp_2d="OBS"
  572. l_pclim=true
  573. lcomp_to_exp=false
  574. if [ ! -z ${EXPREF} ]; then
  575. lcomp_to_exp=true
  576. list_comp_2d="OBS ${EXPREF}"
  577. # Must check if climatology for exp ${EXPREF} is there:
  578. fclim_ref=`echo "${ftcli}" | sed -e "s|${EXP}|${EXPREF}|g"`
  579. check_if_file ${fclim_ref}
  580. echo "Going to compare also against exp ${fclim_ref}!"
  581. echo
  582. fi
  583. echo; echo
  584. for ff in ${F_T_OBS_3D_12} ${F_S_OBS_3D_12} ${F_SST_OBS_12}; do check_if_file ${ff} "name:${ff}"; done
  585. if [ ${i_do_ice} -gt 0 ]; then check_if_file ${F_ICE_OBS_12} "name:${F_ICE_OBS_12}" ; fi
  586. echo; echo
  587. #######################################
  588. # Diags that don't imply a comparison #
  589. #######################################
  590. export COMP2D="OBS"
  591. # Lat-Depth AMOC
  592. # ~~~~~~~~~~~~~~
  593. if [ -f ${fcmoc} ]; then
  594. echo; echo
  595. echo " Ploting lat-depth MOC !"
  596. cd ${DIAG_D}/
  597. export DIRS_2_EXP="${DIRS_2_EXP} moc"
  598. rm -rf moc; mkdir moc; cd moc/
  599. echo; echo; echo " *** CALLING: moc.py ${iclyear}"
  600. moc.py ${iclyear} &
  601. cd ../
  602. echo
  603. fi
  604. # March Mixed layer depth in Nordic Seas
  605. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  606. if [ `ipresent_var_in_ncf ${ftcli} ${NN_MLD}` -eq 1 ]; then
  607. echo; echo
  608. echo " Performing 2D mapping of March Mixed layer depth in Nordic Seas"
  609. cd ${DIAG_D}/
  610. export DIRS_2_EXP="${DIRS_2_EXP} mld"
  611. rm -rf mld; mkdir mld; cd mld/
  612. echo; echo; echo " *** CALLING: mld.py ${iclyear}"; echo
  613. mld.py ${iclyear} &
  614. cd ../
  615. echo
  616. fi
  617. # Sea-ice extent stereographic polar projection South and North
  618. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  619. if [ ${i_do_ice} -gt 0 ] && [ `ipresent_var_in_ncf ${ficli} ${NN_ICEF}` -eq 1 ]; then
  620. echo; echo
  621. echo " Performing 2D Sea-ice extent stereographic polar projection South and North"
  622. cd ${DIAG_D}/
  623. export DIRS_2_EXP="${DIRS_2_EXP} sea_ice"
  624. rm -rf sea_ice; mkdir sea_ice; cd sea_ice/
  625. echo; echo; echo " *** CALLING: ice.py ${iclyear}"; echo
  626. ice.py ${iclyear} &
  627. cd ../
  628. echo
  629. fi
  630. # Sea-surface height
  631. # ~~~~~~~~~~~~~~~~~~
  632. if [ `ipresent_var_in_ncf ${ftcli} ${NN_SSH}` -eq 1 ]; then
  633. echo; echo; echo " SSH map"
  634. export DIRS_2_EXP="${DIRS_2_EXP} ssh"
  635. cd ${DIAG_D}/
  636. rm -rf ssh; mkdir ssh; cd ssh/
  637. echo " *** CALLING: ssh.py ${iclyear}"; echo
  638. ssh.py ${iclyear} &
  639. cd ../ ; echo
  640. else
  641. echo; echo "WARNING: did not find ${NN_SSH} into ${ftcli} !!!!"; echo
  642. fi
  643. # Wind-stress module and curl
  644. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  645. if [ -f ${fccrl} ]; then
  646. echo; echo; echo " Wind-stress module and curl maps"
  647. if [ -x ${NN_TAUM} ]; then echo "ERROR: define variable NN_TAUM in ${fconfig}! ('X' if not present in NEMO output)"; exit; fi
  648. export DIRS_2_EXP="${DIRS_2_EXP} wind"
  649. cd ${DIAG_D}/
  650. rm -rf wind; mkdir wind; cd wind/
  651. echo " *** CALLING: wind.py ${iclyear}"; echo
  652. wind.py ${iclyear} &
  653. cd ../ ; echo
  654. else
  655. echo
  656. echo "WARNING: did not find file ${fccrl} !!!"
  657. echo " or did not find ${NN_TAUM} into ${fcsbc} !!!!"
  658. echo
  659. fi
  660. # Zonally-averaged surface heat fluxes
  661. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ lolo
  662. if [ -f ${fcsbc} ]; then
  663. echo; echo; echo " Zonally-averaged surface heat fluxes"
  664. if [ -x ${NN_QSOL} ]; then echo "ERROR: define variable NN_QSOL in ${fconfig}! ('X' if not present in NEMO output)"; exit; fi
  665. export DIRS_2_EXP="${DIRS_2_EXP} sfluxes"
  666. cd ${DIAG_D}/
  667. rm -rf sfluxes; mkdir sfluxes; cd sfluxes/
  668. echo " *** CALLING: sfluxes.py ${iclyear}"; echo
  669. sfluxes.py ${iclyear} &
  670. cd ../ ; echo
  671. else
  672. echo
  673. echo "WARNING: did not find file ${fcsbc} !!!"
  674. echo " or did not find ${NN_QSOL} into ${fcsbc} !!!!"
  675. echo
  676. fi
  677. ##################################################
  678. # Diags that imply a comparison against "COMP2D" #
  679. ##################################################
  680. cd ${DIAG_D}/
  681. rm -rf temp_sal
  682. for COMP2D in ${list_comp_2d}; do
  683. export COMP2D=${COMP2D}
  684. echo; echo; echo "Clim. comparisons against ${COMP2D}"
  685. if [ "${COMP2D}" = "${EXPREF}" ]; then
  686. export F_T_OBS_3D_12=${fclim_ref}; check_if_file ${F_T_OBS_3D_12} "name:F_T_OBS_3D_12"
  687. export F_S_OBS_3D_12=${fclim_ref}; check_if_file ${F_S_OBS_3D_12} "name:F_S_OBS_3D_12"
  688. export F_SST_OBS_12=${fclim_ref} ; check_if_file ${F_SST_OBS_12} "name:F_SST_OBS_12"
  689. if [ ${i_do_ice} -gt 0 ]; then export F_ICE_OBS_12=${fclim_ref} ; check_if_file ${F_ICE_OBS_12} "name:F_ICE_OBS_12"; fi
  690. fi
  691. # Temperature and Salinity
  692. # ~~~~~~~~~~~~~~~~~~~~~~~~
  693. echo; echo
  694. echo " Creating maps and cross-sections (i_do_sect) of Temperature and Salinity"
  695. cd ${DIAG_D}/
  696. export DIRS_2_EXP="${DIRS_2_EXP} temp_sal"
  697. DIRS_2_EXP_RREF="${DIRS_2_EXP_RREF} temp_sal"
  698. mkdir -p temp_sal; cd temp_sal/
  699. echo; echo; echo " *** CALLING: temp_sal.py ${iclyear} &"; echo
  700. temp_sal.py ${iclyear} &
  701. cd ../
  702. echo
  703. done ; # for COMP2D in ${list_comp_2d}; do
  704. wait
  705. else
  706. echo; echo
  707. echo " No Climatologies found ...";
  708. echo " => you can use 'build_clim.sh' to build a climato of your experiment"
  709. echo; echo
  710. fi
  711. fi ; # if ${l_clim_diag}
  712. wait
  713. # Time for HTML stuff!
  714. export HTML_DIR=${DIAG_D}/${EXP}
  715. mkdir -p ${HTML_DIR}
  716. cd ${DIAG_D}/
  717. # Moving all figures to HTML_DIR:
  718. for fp in ${FIG_FORM} svg mp4 gif; do mv -f *.${fp} ${HTML_DIR}/ >/dev/null 2>/dev/null ; done
  719. mv -f ./merid_transport/*.${FIG_FORM} ${HTML_DIR}/ >/dev/null 2>/dev/null
  720. mv -f ${DIAG_D}/movies/movie_*.mp4 ${HTML_DIR}/ >/dev/null 2>/dev/null
  721. # Sign with logo?
  722. #cd ${HTML_DIR}/
  723. #list=`\ls *.png`
  724. #for ff in ${list}; do
  725. # sign_image ${ff} n_${ff}
  726. # mv -f n_${ff} ${ff}
  727. #done
  728. cd ${DIAG_D}/
  729. . ${BARAKUDA_ROOT}/src/bash/build_html.bash
  730. wait
  731. # Building main index.html
  732. build_index_html
  733. # If climatology built, sub 2D html pages
  734. if ${l_pclim}; then
  735. build_sub_html
  736. fi
  737. #==================================================================
  738. wait ; # likely waiting for the creation of the GIFs....
  739. echo; echo
  740. cp ${BARAKUDA_ROOT}/src/html/conf_*.html ${HTML_DIR}/
  741. if [ ${ece_exp} -eq 0 ]; then
  742. cp -L ${BARAKUDA_ROOT}/src/html/logo.*g ${HTML_DIR}/
  743. else
  744. cp -L ${BARAKUDA_ROOT}/src/html/logo_ece.svg ${HTML_DIR}/logo.svg
  745. cp -L ${BARAKUDA_ROOT}/src/html/logo_ece.png ${HTML_DIR}/logo.png
  746. fi
  747. mv -f index.html namelist*.html ${HTML_DIR}/
  748. cp -r ${DIRS_2_EXP} ${HTML_DIR}/ >/dev/null 2>/dev/null
  749. echo; echo; echo
  750. if [ ${ihttp} -eq 1 ]; then
  751. echo "Preparing to export to remote host!"; echo
  752. send_dir=`basename ${HTML_DIR}`
  753. tar cvf ${send_dir}.tar ${send_dir}
  754. ssh ${RUSER}@${RHOST} "mkdir -p ${RWWWD}"
  755. scp ${send_dir}.tar ${RUSER}@${RHOST}:${RWWWD}/
  756. ssh ${RUSER}@${RHOST} "cd ${RWWWD}/; rm -rf ${send_dir}; tar xf ${send_dir}.tar 2>/dev/null; rm -f ${send_dir}.tar; \
  757. chmod -R a+r ${send_dir}; cd ${send_dir}/"
  758. echo; echo
  759. echo "Diagnostic page installed on http://${RHOST}${RWWWD}/${send_dir}/ !"
  760. echo "( Also browsable on local host in ${DIAG_D}/${send_dir} )"
  761. rm -f ${send_dir}.tar
  762. else
  763. if [ ${ihttp} -eq 0 ]; then
  764. echo "Diagnostic page installed in ${HTML_DIR}/"
  765. echo " => you can view it with a web browser..."
  766. else
  767. echo "Error: \"ihttp\" must be either 0 or 1 !"
  768. fi
  769. fi
  770. echo; echo
  771. rm -rf *.eps
  772. else
  773. echo
  774. echo "Diagnostics built and saved! (${DIAG_D})"
  775. echo "Re-Run \"${script}.sh\" adding the \"-e\" or \"-E\" switch to create figure and HTML page..."
  776. echo
  777. fi
  778. rm -rf ${TMP_DIR} 2>/dev/null ; #debug
  779. echo