Index: XIOS/xios_training/hands-on-6/TP_src/Makefile
===================================================================
--- XIOS/xios_training/hands-on-6/TP_src/Makefile	(revision 2046)
+++ XIOS/xios_training/hands-on-6/TP_src/Makefile	(revision 2046)
@@ -0,0 +1,22 @@
+# Compilateur
+FC = mpif90 
+# Variables
+XIOS_DIR =../xios_build
+# Includes
+FCFLAGS= -I$(XIOS_DIR)/inc  -I$(NETCDF_INCDIR) -I$(NETCDFFORTRAN_INCDIR) -I$(MPI_INCDIR)
+# Librairies
+LDFLAGS = -L$(XIOS_DIR)/lib -L$(NETCDF_LIBDIR) -L$(NETCDFFORTRAN_LIBDIR) -lxios -lnetcdff -lnetcdf -lstdc++
+
+all: test_tp6
+
+%: %.o
+	$(FC) -o $@.exe $^ $(LDFLAGS)
+
+%.o: %.f90
+	$(FC) $(FCFLAGS) -c $<
+
+clean:
+	rm -f *.exe
+	rm -f *.o *.mod *.MOD
+	rm -f xios_client_*.out
+	rm -f xios_client_*.err
Index: XIOS/xios_training/hands-on-6/TP_src/iodef.xml
===================================================================
--- XIOS/xios_training/hands-on-6/TP_src/iodef.xml	(revision 2046)
+++ XIOS/xios_training/hands-on-6/TP_src/iodef.xml	(revision 2046)
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<simulation>
+ <context id="test">
+   <calendar type="Gregorian" time_origin="2021-01-01" start_date="2021-03" />
+
+   <domain_definition>
+     <domain id="domain" type="rectilinear" ni_glo="20" nj_glo="20"/>
+   </domain_definition>
+
+   <grid_definition>
+     <grid id="grid">
+       <domain domain_ref="domain"/>
+     </grid>
+   </grid_definition>
+   
+   <field_definition>
+     <field id="temp" name="temperature" operation="instant" grid_ref="grid"/>
+   </field_definition>
+
+   <file_definition>
+     <file id="output" name="output" output_freq="1h" type="one_file" >
+       <field field_ref="temp" />
+     </file>
+
+  </file_definition>
+
+ </context>
+
+  <context id="xios">
+     <variable_definition>
+        <variable_group id="parameters" >
+          <variable id="print_file" type="bool">true</variable>
+        </variable_group>
+     </variable_definition>
+  </context>
+
+</simulation>
+
Index: XIOS/xios_training/hands-on-6/TP_src/job.sh
===================================================================
--- XIOS/xios_training/hands-on-6/TP_src/job.sh	(revision 2046)
+++ XIOS/xios_training/hands-on-6/TP_src/job.sh	(revision 2046)
@@ -0,0 +1,18 @@
+#!/bin/bash
+#MSUB -o output.out
+#MSUB -e error.err
+#MSUB -eo
+#MSUB -c 1
+#MSUB -n 4
+#MSUB -X
+#MSUB -x
+#MSUB -T 1800
+#MSUB -q skylake
+#MSUB -A gen0826
+#MSUB -Q test
+#MSUB -m work,scratch
+cd $BRIDGE_MSUB_PWD
+source ../xios_build/arch.env
+
+
+ccc_mprun ./test_tp6.exe
Index: XIOS/xios_training/hands-on-6/TP_src/test_tp6.f90
===================================================================
--- XIOS/xios_training/hands-on-6/TP_src/test_tp6.f90	(revision 2046)
+++ XIOS/xios_training/hands-on-6/TP_src/test_tp6.f90	(revision 2046)
@@ -0,0 +1,108 @@
+PROGRAM test_tp6
+
+  USE xios
+  IMPLICIT NONE
+  INCLUDE "mpif.h"
+  INTEGER :: rank
+  INTEGER :: size
+  INTEGER :: ierr
+
+  CHARACTER(len=*),PARAMETER :: id="client"
+  INTEGER :: comm
+  TYPE(xios_duration) :: dtime
+  TYPE(xios_date) :: date
+  CHARACTER(len=20) :: date_str
+  INTEGER :: ni_glo
+  INTEGER :: nj_glo
+
+  INTEGER :: i,j,l
+
+  CHARACTER(len=20) :: domain_type
+  DOUBLE PRECISION, ALLOCATABLE :: lonvalue(:)
+  DOUBLE PRECISION, ALLOCATABLE :: latvalue(:)
+
+  DOUBLE PRECISION, ALLOCATABLE :: temp(:,:)
+  INTEGER :: ts
+
+  INTEGER :: ni, ibegin, nj, jbegin
+  real :: ri, rj
+
+  CALL MPI_INIT(ierr)
+
+
+
+  CALL xios_initialize(id,return_comm=comm)
+
+  CALL MPI_COMM_RANK(comm,rank,ierr)
+  CALL MPI_COMM_SIZE(comm,size,ierr)
+
+  
+  CALL xios_context_initialize("test",comm)
+  
+  
+  
+  dtime%hour = 1
+  CALL xios_set_timestep(dtime)
+
+
+  
+  CALL xios_get_domain_attr("domain", type = domain_type)
+  CALL xios_get_domain_attr("domain", ni_glo = ni_glo, nj_glo=nj_glo)
+  
+  ni = ni_glo/size
+  ibegin = rank*ni
+  nj = nj_glo
+  jbegin=0
+
+  CALL xios_set_domain_attr("domain", ni=ni, ibegin=ibegin, nj=nj, jbegin=jbegin) 
+  ALLOCATE(lonvalue(ni))
+  ALLOCATE(latvalue(nj))
+
+  DO i=1,ni 
+    lonvalue(i) = -180 + (rank*ni+i) * 360/ni_glo
+  ENDDO
+  
+  DO j=1, nj
+    latvalue(j) = -90 + j * 180/nj_glo
+  ENDDO
+
+  CALL xios_set_domain_attr("domain", lonvalue_1d=lonvalue,latvalue_1d=latvalue)
+
+
+  ALLOCATE(temp(ni, nj))
+
+
+  CALL xios_close_context_definition()
+  
+  call random_seed()
+
+  DO ts=1,480
+    CALL xios_update_calendar(ts)
+
+    call random_number(ri)
+    call random_number(rj)
+
+    if ((MOD(ts,24) .LE. 12) .AND. (MOD(ts,24) .GE. 1)) then
+      temp(:,:) = MOD(ts,24)+ri
+    else if (MOD(ts,24) .EQ. 0) then
+      temp(:,:) = 0+rj
+    else
+      temp(:,:) = 24-MOD(ts,24)
+    endif
+
+    CALL xios_send_field("temp", temp)
+  ENDDO
+  CALL xios_context_finalize()
+
+  DEALLOCATE(lonvalue)
+  DEALLOCATE(latvalue)
+  DEALLOCATE(temp)
+
+  CALL MPI_COMM_FREE(comm, ierr)
+
+  CALL xios_finalize()
+
+  CALL MPI_FINALIZE(ierr)
+
+END PROGRAM test_tp6
+
Index: XIOS/xios_training/hands-on-6/answer/iodef.xml_1
===================================================================
--- XIOS/xios_training/hands-on-6/answer/iodef.xml_1	(revision 2046)
+++ XIOS/xios_training/hands-on-6/answer/iodef.xml_1	(revision 2046)
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<simulation>
+ <context id="test">
+   <calendar type="Gregorian" time_origin="2021-01-01" start_date="2021-03" />
+
+   <domain_definition>
+     <domain id="domain" type="rectilinear" ni_glo="20" nj_glo="20"/>
+   </domain_definition>
+
+   <grid_definition>
+     <grid id="grid">
+       <domain domain_ref="domain"/>
+     </grid>
+   </grid_definition>
+   
+   <field_definition>
+     <field id="temp" name="temperature" operation="instant" grid_ref="grid"/>
+   </field_definition>
+
+   <file_definition>
+     <file id="output" name="output" output_freq="1h" type="one_file" >
+       <field field_ref="temp" />
+     </file>
+
+     <file name="output_wmax" output_freq="7d" type="one_file" >
+       <field field_ref="temp" name="weekly_max_at_noon" operation="maximum" freq_offset="11h" freq_op="1d"/>
+     </file>
+
+     <file name="output_wmin" output_freq="7d" type="one_file" >
+       <field field_ref="temp" name="weekly_min_at_midnight" operation="minimum" freq_offset="23h" freq_op="1d"/>
+     </file>
+
+  </file_definition>
+
+ </context>
+
+  <context id="xios">
+     <variable_definition>
+        <variable_group id="parameters" >
+          <variable id="print_file" type="bool">true</variable>
+        </variable_group>
+     </variable_definition>
+  </context>
+
+</simulation>
+
Index: XIOS/xios_training/hands-on-6/answer/iodef.xml_2
===================================================================
--- XIOS/xios_training/hands-on-6/answer/iodef.xml_2	(revision 2046)
+++ XIOS/xios_training/hands-on-6/answer/iodef.xml_2	(revision 2046)
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<simulation>
+ <context id="test">
+   <calendar type="Gregorian" time_origin="2021-01-01" start_date="2021-03" />
+
+   <domain_definition>
+     <domain id="domain" type="rectilinear" ni_glo="20" nj_glo="20"/>
+   </domain_definition>
+
+   <grid_definition>
+     <grid id="grid">
+       <domain domain_ref="domain"/>
+     </grid>
+   </grid_definition>
+   
+   <field_definition>
+     <field id="temp" name="temperature" operation="instant" grid_ref="grid"/>
+     <field id="temp2" field_ref="temp"> temp*temp </field>
+   </field_definition>
+
+   <file_definition>
+     <file id="output" name="output" output_freq="1h" type="one_file" >
+       <field field_ref="temp" />
+     </file>
+
+     <file name="output_wmax" output_freq="7d" type="one_file" >
+       <field field_ref="temp" name="weekly_max_at_noon" operation="maximum" freq_offset="11h" freq_op="1d"/>
+     </file>
+
+     <file name="output_wmin" output_freq="7d" type="one_file" >
+       <field field_ref="temp" name="weekly_min_at_midnight" operation="minimum" freq_offset="23h" freq_op="1d"/>
+     </file>
+
+     <file name="output_v" output_freq="1d" type="one_file" >
+       <field id="sigma_T" operation="instant" freq_op="1d" grid_ref="grid"> sqrt(@temp2-@temp*@temp) </field>
+     </file>
+
+  </file_definition>
+
+ </context>
+
+  <context id="xios">
+     <variable_definition>
+        <variable_group id="parameters" >
+          <variable id="print_file" type="bool">true</variable>
+        </variable_group>
+     </variable_definition>
+  </context>
+
+</simulation>
+
