Index: trunk/libIGCM/AA_metrics_LMDZ
===================================================================
--- trunk/libIGCM/AA_metrics_LMDZ	(revision 1201)
+++ trunk/libIGCM/AA_metrics_LMDZ	(revision 1202)
@@ -133,5 +133,5 @@
 IGCM_sys_MkdirWork ${RUN_DIR}
 IGCM_sys_Cd ${RUN_DIR}
-IGCM_sys_MkdirWork METRICS
+IGCM_sys_MkdirWork METRICS/SE_${YEARS}
 
 #==================================
@@ -146,34 +146,44 @@
 
 #==================================
-# Appropriate configuration
-#==================================
-IGCM_sys_Cp ${PCMDI_MP}/work_install_v2.11/PCMDI_METRICS/doc/parameter_files/input_parameters_LMDZ_PCMDI_template.py template.py
-
-#==================================
-# Configure template
-#==================================
-IGCM_comp_modifyFile template.py path_and_filename \'./${config_UserChoices_JobName}_SE_${YEARS}_1M_histmth.nc\'
-IGCM_comp_modifyFile template.py filename \'${config_UserChoices_JobName}_SE_${YEARS}_1M_histmth.nc\'
-IGCM_comp_modifyFile template.py attributes_provided \'IPSL_Extended\'
-IGCM_comp_modifyFile template.py Login  \'${LOGIN}\'
-IGCM_comp_modifyFile template.py model_versions \'\[${config_UserChoices_TagName}\]\'
-IGCM_comp_modifyFile template.py experiment  \'${config_UserChoices_ExperimentName}\'
-IGCM_comp_modifyFile template.py realization \'${config_UserChoices_JobName}\'
-IGCM_comp_modifyFile template.py project_id \'IPSL\-${config_UserChoices_SpaceName}\'
-IGCM_comp_modifyFile template.py ModelFreeSpace \'${config_UserChoices_LongName}\'
-IGCM_comp_modifyFile template.py case_id \'SE_${YEARS}\'
-IGCM_comp_modifyFile template.py obs_data_path  \'${PCMDI_MP}/references-for-metrics/obs\'
-IGCM_comp_modifyFile template.py metrics_output_path \'${RUN_DIR}/METRICS\'
-IGCM_comp_modifyFile template.py model_clims_interpolated_output \'${RUN_DIR}\'
-
-#==================================
-# Compute metrics
-#==================================
-python ${PCMDI_MP}/work_install_v2.11/PCMDI_METRICS/bin/pcmdi_metrics_driver.py -p template.py
-
-#==================================
-# Export metrics to prodiguer system
-#==================================
-IGCM_debug_sendAMQP_Metrics METRICS/SE_${YEARS}
+# Group of metrics we will compute
+#==================================
+#GroupsOfMetrics='LMDZ_PCMDI LMDZ_JetLat' 
+GroupsOfMetrics='LMDZ_PCMDI' 
+
+for metricsGroupName in ${GroupsOfMetrics} ; do
+
+  #==================================
+  # Appropriate configuration
+  #==================================
+  IGCM_sys_Cp ${PCMDI_MP}/work_install_v2.11/PCMDI_METRICS/doc/parameter_files/input_parameters_${metricsGroupName}_template.py template.py
+
+  #==================================
+  # Configure template
+  #==================================
+  IGCM_comp_modifyFile template.py path_and_filename \'./${config_UserChoices_JobName}_SE_${YEARS}_1M_histmth.nc\'
+  IGCM_comp_modifyFile template.py filename \'${config_UserChoices_JobName}_SE_${YEARS}_1M_histmth.nc\'
+  IGCM_comp_modifyFile template.py attributes_provided \'IPSL_Extended\'
+  IGCM_comp_modifyFile template.py Login  \'${LOGIN}\'
+  IGCM_comp_modifyFile template.py model_versions \[\'${config_UserChoices_TagName}\'\]
+  IGCM_comp_modifyFile template.py experiment  \'${config_UserChoices_ExperimentName}\'
+  IGCM_comp_modifyFile template.py realization \'${config_UserChoices_JobName}\'
+  IGCM_comp_modifyFile template.py project_id \'IPSL\-${config_UserChoices_SpaceName}\'
+  IGCM_comp_modifyFile template.py ModelFreeSpace \'${config_UserChoices_LongName}\'
+  IGCM_comp_modifyFile template.py case_id \'${metricsGroupName}\'
+  IGCM_comp_modifyFile template.py obs_data_path  \'${PCMDI_MP}/references-for-metrics/obs\'
+  IGCM_comp_modifyFile template.py metrics_output_path \'${RUN_DIR}/SE_${YEARS}\'
+  IGCM_comp_modifyFile template.py model_clims_interpolated_output \'${RUN_DIR}\'
+
+  #==================================
+  # Compute metrics
+  #==================================
+  python ${PCMDI_MP}/work_install_v2.11/PCMDI_METRICS/bin/pcmdi_metrics_driver.py -p template.py
+
+  #==================================
+  # Export metrics to mongoDB system
+  #==================================
+  IGCM_debug_sendAMQP_Metrics METRICS/SE_${YEARS}/${metricsGroupName} ${metricsGroupName}
+
+done
 
 #==================================
Index: trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh
===================================================================
--- trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh	(revision 1201)
+++ trunk/libIGCM/libIGCM_debug/libIGCM_debug.ksh	(revision 1202)
@@ -184,5 +184,6 @@
 #D-function IGCM_debug_sendAMQP_Metrics
 #D- * Purpose: Take over AMQP C client using mail as a message recipient
-#D- * One argument : Directory where metrics.json files can be found
+#D- * Two arguments : - Directory where metrics.json files can be found
+#D- *                 - Metrics Group Name. metrics will be added to this group
 #D- * Attach encoded metrics.json files.
 
@@ -195,5 +196,5 @@
     code=7100
     # Usual AMQP message to route messages on server side
-    encodedBody=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" |  base64 -w 0 )
+    encodedBody=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"metricsGroupName\":\"${2}\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" |  base64 -w 0 )
     # send mail
     attachmentsOptions=""
@@ -596,5 +597,5 @@
         genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"activity\":\"IPSL\",\"name\":\"${config_UserChoices_JobName}\",\"cumulPeriod\":\"${CumulPeriod}\",\"experiment\":\"${config_UserChoices_ExperimentName}\",\"space\":\"${config_UserChoices_SpaceName}\",\"model\":\"${config_UserChoices_TagName}\",\"startDate\":\"${config_UserChoices_DateBegin}\",\"endDate\":\"${config_UserChoices_DateEnd}\",\"login\":\"${LOGIN}\",\"centre\":\"${CENTER}\",\"machine\":\"${MASTER}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" )
         # RabbitMQ message body with specific fields associated message codes treated here
-        Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" )
+        Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"accountingProject\":\"${PROJECT}\",\"jobWarningDelay\":\"${jobWarningDelay}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" )
         # Fill the rabbitMQ queue (the config.card in use will be sent)
         IGCM_debug_sendAMQP activate
@@ -627,5 +628,5 @@
       genericSimulationID=$( echo "\"msgApplication\":\"monitoring\",\"msgProducer\":\"libigcm\",\"cumulPeriod\":\"${CumulPeriod}\",\"simuid\":\"${simuid}\",\"jobuid\":\"${jobuid}\"" )
       # RabbitMQ message body with specific fields associated message codes treated here
-      Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" )
+      Body=$( echo "{${genericSimulationID},\"msgCode\":\"${code}\",\"accountingProject\":\"${PROJECT}\",\"jobWarningDelay\":\"${jobWarningDelay}\",\"msgUID\":\"$(uuidgen)\",\"msgTimestamp\":\"$( date +"%Y-%m-%dT%H:%M:%S.%N%z" )\"}" )
       # Fill the rabbitMQ queue
       IGCM_debug_sendAMQP
