Index: /TOOLS/ConsoGENCMIP6/bin/old/conso_gencmip6_v5
===================================================================
--- /TOOLS/ConsoGENCMIP6/bin/old/conso_gencmip6_v5	(revision 2443)
+++ /TOOLS/ConsoGENCMIP6/bin/old/conso_gencmip6_v5	(revision 2443)
@@ -0,0 +1,243 @@
+#!/bin/bash
+#
+# cron pour garder trace de la compta et des volumes de fichiers crees
+# a executer chaque matin a 6h00
+# ======================================================================
+#. /etc/profile
+
+
+# Functions
+# =========
+function get_gencmip6 {
+  ccc_myproject | sed -e'1,/gencmip6/d' | grep -m 1 $1
+}
+
+function get_gencmip6_login {
+  ccc_myproject | sed -n -e'/gencmip6/,/^$/p' | head -n -1 | tail -n +3
+}
+
+
+# Default values
+# ==============
+fg_dry=false
+fg_verbose=false
+
+fg_all=true
+fg_param=true
+fg_login=true
+fg_bilan=true
+fg_store=true
+
+# Get arguments from command line
+# ===============================
+while getopts :hdaltsv Opt ; do
+  case $Opt in
+    h)
+      echo "usage: $0 [-h]Â [-a] [-b] [-l] [-s] [-d] [-v]"
+      echo ""
+      echo "options :"
+      echo "  -h : print this help and exit"
+      echo "  -d : dry run, no file produced"
+      echo "  -a : produce all files (default)"
+      echo "  -p : produce param file"
+      echo "  -b : produce bilan file"
+      echo "  -l : produce login file"
+      echo "  -s : produce store file"
+      echo "  -v : verbose"
+      exit 0 ;;
+    d)
+      fg_dry=true
+      ;;
+    a)
+      fg_all=true
+      ;;
+    t)
+      fg_bilan=true
+      fg_all=false
+      fg_param=false
+      fg_login=false
+      fg_store=false
+      ;;
+    l)
+      fg_login=true
+      fg_all=false
+      fg_param=false
+      fg_bilan=false
+      fg_store=false
+      ;;
+    s)
+      fg_store=true
+      fg_all=false
+      fg_param=false
+      fg_login=false
+      fg_bilan=false
+      ;;
+    p)
+      fg_param=true
+      fg_all=false
+      fg_login=false
+      fg_bilan=false
+      fg_store=false
+      ;;
+    v)
+      fg_verbose=true
+      ;;
+    :)
+      echo "$0: -"${OPTARG}" option: missing value"
+      exit 1
+      ;;
+    \?)
+      echo "$0: -"${OPTARG}" option: not supported"
+      exit 1
+      ;;
+  esac
+done
+shift $(($OPTIND-1))
+
+echo "fg_all   = $fg_all"
+echo "fg_param = $fg_param"
+echo "fg_login = $fg_login"
+echo "fg_bilan = $fg_bilan"
+echo "fg_store = $fg_store"
+
+# Files and directories
+# =====================
+LOCAL_DIR="/ccc/cont003/home/dsm/p86ipsl/ConsoGENCMIP6/output"
+SAVE_DIR="/ccc/work/cont003/dsm/p86ipsl/ConsoGENCMIP6/"
+
+if ( ${fg_dry} ) ; then
+  OUT_PARAM="/dev/stdout"
+  OUT_LOGIN="/dev/stdout"
+  OUT_BILAN="/dev/stdout"
+  OUT_STORE="/dev/stdout"
+else
+  OUT_PARAM="OUT_CONSO_PARAM_v4"
+  OUT_LOGIN="OUT_CONSO_LOGIN_v4"
+  OUT_BILAN="OUT_CONSO_BILAN_v4"
+  OUT_STORE="OUT_CONSO_STORE_v4"
+fi
+
+#Today=$( date +%F )
+Today=$( ccc_myproject | grep gencmip6 | gawk '{print $NF}' )
+
+
+# Produce files
+# =============
+
+cd ${LOCAL_DIR}
+
+# 1- Parametres du projet
+# -----------------------
+echo "OUT_CONSO_PARAM"
+
+echo "{" > ${OUT_PARAM}
+ccc_myproject | grep gencmip6 | \
+    gawk '{printf "  \"project\": \"%s\",\n", $4}' \
+    >> ${OUT_PARAM}
+get_gencmip6 deadline | \
+    gawk '{printf "  \"deadline\": \"%10s\",\n", $NF}' \
+    >> ${OUT_PARAM}
+get_gencmip6 Allocated | \
+    gawk '{printf "  \"alloc\": %10.2f,\n", $NF}' \
+    >> ${OUT_PARAM}
+echo "}" >> ${OUT_PARAM}
+
+# 2- Conso totale par jour
+# ------------------------
+# on garde le total, date en tete en accumulant dans le fichier : 
+#Â OUT_CONSO_BILAN
+# if ( ${fg_all} || ${fg_bilan} ) ; then
+#   printf "%10s " ${Today} >> ${OUT_BILAN}
+#   get_gencmip6 Total | \
+#       gawk '{printf "    %s %10.2f hours ", "total", $2}' \
+#       >> ${OUT_BILAN}
+#   get_gencmip6 Allocated | \
+#       gawk '{printf "    %s %10.2f hours ", "alloc", $2}' \
+#       >> ${OUT_BILAN}
+#   get_gencmip6 Suggested | \
+#       gawk '{printf "    %s %7s ", "use_theo", $NF}' \
+#       >> ${OUT_BILAN}
+#   get_gencmip6 Real | \
+#       gawk '{printf "    %s %7s ", "use_real", $NF}' \
+#       >> ${OUT_BILAN}
+#   printf "\n" >> ${OUT_BILAN}
+# fi
+
+if ( ${fg_all} || ${fg_bilan} ) ; then
+  echo "OUT_CONSO_BILAN"
+
+  printf "%10s " ${Today} >> ${OUT_BILAN}
+  get_gencmip6 Total | \
+      gawk '{printf " %10.2f", $2}' \
+      >> ${OUT_BILAN}
+  get_gencmip6 Real | \
+      gawk '{printf " %7s", $NF}' \
+      >> ${OUT_BILAN}
+  get_gencmip6 Suggested | \
+      gawk '{printf " %7s", $NF}' \
+      >> ${OUT_BILAN}
+  printf "\n" >> ${OUT_BILAN}
+fi
+
+# 2b- Conso theorique par jour
+# ----------------------------
+# on garde le total, date en tete en accumulant dans le fichier : 
+#Â OUT_CONSO_UTHEO
+if ( ${fg_all} || ${fg_bilan} ) ; then
+  echo "OUT_CONSO_UTHEO"
+
+  printf "%10s " ${Today} >> ${OUT_BILAN}
+  get_gencmip6 Suggested | \
+      gawk '{printf " %7s", $NF}' \
+      >> ${OUT_BILAN}
+  printf "\n" >> ${OUT_BILAN}
+fi
+
+# 3- Conso par login (HOME)
+# -------------------------
+# on garde la trace de chaque login, date en tete, en remplacant le 
+#Â fichier a chaque fois : OUT_CONSO_LOGIN
+if ( ${fg_all} || ${fg_login} ) ; then
+  echo "OUT_CONSO_LOGIN"
+
+#   get_gencmip6_login | \
+#       gawk -v Today=$Today '{printf "%10s %-10s %10.2f hours\n", Today, $1, $2}' \
+#       > ${OUT_LOGIN}
+
+  printf "%-10s %-9s %-10s\n"  "date" "login" "conso(hours)" > ${OUT_LOGIN}
+  get_gencmip6_login | \
+      gawk -v Today=$Today '{printf "%10s %-10s %10.2f\n", Today, $1, $2}' \
+      >> ${OUT_LOGIN}
+fi
+
+# 4- volume cree sur STORE
+# ------------------------
+# par login qui a consomme, en remplacant le fichier a chaque fois : 
+#Â OUT_CONSO_STORE
+if ( ${fg_all} || ${fg_store} ) ; then
+  echo "OUT_CONSO_STORE"
+
+  printf "%-10s %-10s %6s %s\n" "date" "login"  "size" "dirname" > ${OUT_LOGIN}
+  for login in $( get_gencmip6_login | \
+                  gawk '{if ($NF != 0.00) print $1}' ) ; do
+    for dirname in $( ls -d $(ccc_home -A -u ${login})/IGCM_OUT/* ) ; do
+      # printf "%10s %-10s %6s %s\n" \
+      #        ${Today} ${login} \
+      #        $( du -sbh ${dirname} )
+      printf "%10s %-10s %6s %s\n" \
+             ${Today} ${login} \
+             $( du -sbh ${dirname} )
+    done
+  done >> ${OUT_STORE}
+fi
+
+# Save files (WORK)
+# =================
+if ( ! ${fg_dry} ) ; then
+  Suffix=$( echo ${Today} | sed 's/-//g' )
+  cp ${OUT_PARAM} ${SAVE_DIR}/${OUT_PARAM}_${Suffix}
+  cp ${OUT_LOGIN} ${SAVE_DIR}/${OUT_LOGIN}_${Suffix}
+  cp ${OUT_BILAN} ${SAVE_DIR}/${OUT_BILAN}_${Suffix}
+  cp ${OUT_STORE} ${SAVE_DIR}/${OUT_STORE}_${Suffix}
+fi
+
Index: /TOOLS/ConsoGENCMIP6/bin/plot_bilan.py
===================================================================
--- /TOOLS/ConsoGENCMIP6/bin/plot_bilan.py	(revision 2442)
+++ /TOOLS/ConsoGENCMIP6/bin/plot_bilan.py	(revision 2443)
@@ -213,9 +213,9 @@
                linewidth=1, markersize=8,
                solid_capstyle="round", solid_joinstyle="round",
-               label="conso thÃ©orique (%)")
+               label="conso\nthÃ©orique (%)")
   ax_theo.plot(xcoord, real_uses, line_style, color="forestgreen",
                linewidth=1, markersize=8,
                solid_capstyle="round", solid_joinstyle="round",
-               label="conso rÃ©elle (%)")
+               label="conso\nrÃ©elle (%)")
 
 
@@ -227,8 +227,27 @@
   # -------------------
   # 1) Range
+  conso_max = np.nanmax(consos)
   if args.max:
-    ymax = gencmip6.alloc
+    ymax = np.nanmax(consos)  # + np.nanmax(consos)*.1
   else:
-    ymax = np.nanmax(consos) + np.nanmax(consos)*.1
+    ymax = 2. * conso_per_day
+
+  if conso_max > ymax:
+    ax_conso.annotate(
+      "{:.2e} heures".format(conso_max),
+      ha="left",
+      va="top",
+      fontsize="xx-small",
+      bbox=dict(boxstyle="round", fc="w", ec="0.5", color="gray",),
+      xy=(np.nanargmax(consos)+1.2, ymax),
+      textcoords="axes fraction",
+      xytext=(0.01, 0.9),
+      arrowprops=dict(
+        arrowstyle="->",
+        shrinkA=0,
+        shrinkB=0,
+        color="gray",
+      ),
+    )
 
   xmin, xmax = xcoord[0]-1, xcoord[-1]+1
@@ -260,6 +279,10 @@
   ax_conso.set_yticks(yticks)
 
+  ax_theo.spines["right"].set_color("indianred")
+  ax_theo.tick_params(colors="indianred")
+  ax_theo.yaxis.label.set_color("indianred")
+
   ax_conso.axhline(y=conso_per_day, color="blue", alpha=0.5,
-                   label="conso journaliÃšre idÃ©ale (heures)")
+                   label="conso journaliÃšre\nidÃ©ale (heures)")
 
   for x, d in zip(xcoord, dates):
