Index: branches/ORCHIDEE_2_2/ORCHIDEE/src_sechiba/routing_native.f90
===================================================================
--- branches/ORCHIDEE_2_2/ORCHIDEE/src_sechiba/routing_native.f90	(revision 8393)
+++ branches/ORCHIDEE_2_2/ORCHIDEE/src_sechiba/routing_native.f90	(revision 8394)
@@ -109,6 +109,43 @@
     USE routing_native_flow_mod
     IMPLICIT NONE     
+     
+      CALL xios_set_field_attr("basinmap",enabled=.FALSE.)
+      CALL xios_set_field_attr("nbrivers",enabled=.FALSE.)
+      CALL xios_set_field_attr("riversret",enabled=.FALSE.)
+      CALL xios_set_field_attr("hydrographs",enabled=.TRUE.)
+      CALL xios_set_field_attr("htuhgmon",enabled=.FALSE.)
+      CALL xios_set_field_attr("fastr",enabled=.TRUE.)
+      CALL xios_set_field_attr("slowr",enabled=.TRUE.)
+      CALL xios_set_field_attr("streamr",enabled=.TRUE.)
+      CALL xios_set_field_attr("laker",enabled=.FALSE.)
+      CALL xios_set_field_attr("lake_overflow",enabled=.FALSE.)
+      CALL xios_set_field_attr("mask_coast",enabled=.FALSE.)
+      CALL xios_set_field_attr("pondr",enabled=.FALSE.)
+      CALL xios_set_field_attr("floodr",enabled=.FALSE.)
+      CALL xios_set_field_attr("slowflow",enabled=.FALSE.)
+      CALL xios_set_field_attr("delfastr",enabled=.FALSE.)
+      CALL xios_set_field_attr("delslowr",enabled=.FALSE.)
+      CALL xios_set_field_attr("delstreamr",enabled=.FALSE.)
+      CALL xios_set_field_attr("dellaker",enabled=.FALSE.)
+      CALL xios_set_field_attr("delpondr",enabled=.FALSE.)
+      CALL xios_set_field_attr("delfloodr",enabled=.FALSE.)
+      CALL xios_set_field_attr("irrigmap",enabled=.FALSE.)
+      CALL xios_set_field_attr("swampmap",enabled=.FALSE.)
+      CALL xios_set_field_attr("wbr_stream",enabled=.FALSE.)
+      CALL xios_set_field_attr("wbr_fast",enabled=.FALSE.)
+      CALL xios_set_field_attr("wbr_slow",enabled=.FALSE.)
+      CALL xios_set_field_attr("wbr_lake",enabled=.FALSE.)
+      CALL xios_set_field_attr("reinfiltration",enabled=.FALSE.)
+      CALL xios_set_field_attr("irrigation",enabled=.FALSE.)
+      CALL xios_set_field_attr("netirrig",enabled=.FALSE.)
+      CALL xios_set_field_attr("SurfStor",enabled=.FALSE.)
+      CALL xios_set_field_attr("htutempmon",enabled=.FALSE.)
+      CALL xios_set_field_attr("streamlimit",enabled=.FALSE.)
+      CALL xios_set_field_attr("StreamT_TotTend",enabled=.FALSE.)
+      CALL xios_set_field_attr("StreamT_AdvTend",enabled=.FALSE.)
+      CALL xios_set_field_attr("StreamT_RelTend",enabled=.FALSE.)
 
      CALL routing_flow_xios_initialize
+
      
    END SUBROUTINE routing_native_xios_initialize
@@ -387,5 +424,5 @@
 
     USE routing_native_flow_mod,ONLY : routing_flow_make_mean, routing_flow_main, riverflow_mean, coastalflow_mean, lakeinflow_mean, &
-                                routing_flow_get, routing_flow_set
+                                routing_flow_get, routing_flow_set, routing_flow_diags
     USE routing_native_irrig_mod, ONLY: irrigation_mean_make, irrigation_main, irrigation_get
     USE routing_native_lake_mod, ONLY: routing_lake_mean_make, routing_lake_route_coast, routing_lake_main
@@ -451,5 +488,5 @@
        returnflow_mean(:)=0
  
-       CALL routing_flow_main(dt_routing)
+       CALL routing_flow_main(dt_routing, contfrac)
 
        CALL routing_flow_get(coastalflow_mean=coastalflow)
@@ -472,4 +509,6 @@
     CALL irrigation_get(irrigation_mean=irrigation)
 
+    
+    CALL routing_flow_diags(dt_sechiba) ! output routing flow diagnostics on orchidee grid
 
     returnflow  = returnflow/dt_routing*dt_sechiba
@@ -478,5 +517,5 @@
     irrigation = irrigation/dt_routing*dt_sechiba
     
-    CALL xios_send_field("irrigation", irrigation/dt_sechiba)
+    CALL xios_orchidee_send_field("irrigation", irrigation/dt_sechiba)
     
     returnflow(:) = 0
Index: branches/ORCHIDEE_2_2/ORCHIDEE/src_sechiba/routing_native_flow.f90
===================================================================
--- branches/ORCHIDEE_2_2/ORCHIDEE/src_sechiba/routing_native_flow.f90	(revision 8393)
+++ branches/ORCHIDEE_2_2/ORCHIDEE/src_sechiba/routing_native_flow.f90	(revision 8394)
@@ -18,4 +18,5 @@
   PUBLIC :: routing_flow_xios_initialize, routing_flow_set, routing_flow_get, routing_flow_main
   PUBLIC :: routing_flow_initialize, routing_flow_finalize, routing_flow_clear, routing_flow_make_mean
+  PUBLIC :: routing_flow_diags
   PUBLIC :: compute_coastline
     
@@ -45,5 +46,19 @@
 
   REAL(r_std),SAVE,ALLOCATABLE,PUBLIC,PROTECTED,TARGET :: stream_reservoir_r(:)       !! Water amount in the stream reservoir (kg) - (local routing grid)
-  !$OMP THREADPRIVATE(stream_reservoir_r) 
+  !$OMP THREADPRIVATE(stream_reservoir_r)
+
+  
+  REAL(r_std),SAVE,ALLOCATABLE,PUBLIC,PROTECTED,TARGET :: fast_diag(:)         !! Diag on water amount in the fast reservoir (kg/m^2) - (orchidee grid)
+  !$OMP THREADPRIVATE(fast_diag)
+
+  REAL(r_std),SAVE,ALLOCATABLE,PUBLIC,PROTECTED,TARGET:: slow_diag(:)          !! Diag on water amount in the slow reservoir (kg/m^2) - (orchidee grid)
+  !$OMP THREADPRIVATE(slow_diag)
+
+  REAL(r_std),SAVE,ALLOCATABLE,PUBLIC,PROTECTED,TARGET :: stream_diag(:)       !! Diag on water amount in the stream reservoir (kg/m^2) - (orchidee grid)
+  !$OMP THREADPRIVATE(stream_diag) 
+
+  REAL(r_std),SAVE,ALLOCATABLE,PUBLIC,PROTECTED,TARGET :: hydrographs_diag(:)       !! Diag on water amount in the stream reservoir (kg/m^2) - (orchidee grid)
+  !$OMP THREADPRIVATE(hydrographs_diag) 
+
   
   REAL(r_std),SAVE,ALLOCATABLE,PUBLIC,PROTECTED :: riverflow_mean(:)         !! Water amount in the stream reservoir (kg) - (local routing grid)
@@ -252,4 +267,6 @@
 
   SUBROUTINE routing_flow_initialize(kjit, rest_id, nbpt_, dt_routing, contfrac, nbpt_r_, riverflow, coastalflow)
+  USE grid, ONLY : area
+  USE xios
   IMPLICIT NONE
     INTEGER ,INTENT(IN)                     :: kjit           
@@ -273,5 +290,5 @@
     !
     ALLOCATE (lakeinflow_mean(nbpt), stat=ier)
-    IF (ier /= 0) CALL ipslerr_p(3,'routing_simple_init_1','Pb in allocate for lakeinflow_mean','','')
+    IF (ier /= 0) CALL ipslerr_p(3,'routing_flow_initialize','Pb in allocate for lakeinflow_mean','','')
     var_name = 'lakeinflow'
     CALL ioconf_setatt_p('UNITS', 'Kg/dt')
@@ -281,5 +298,5 @@
 
     ALLOCATE (riverflow_mean(nbpt), stat=ier)
-    IF (ier /= 0) CALL ipslerr_p(3,'routing_simple_init_1','Pb in allocate for riverflow_mean','','')
+    IF (ier /= 0) CALL ipslerr_p(3,'routing_flow_initialize','Pb in allocate for riverflow_mean','','')
     var_name = 'riverflow'
     CALL ioconf_setatt_p('UNITS', 'Kg/dt')
@@ -289,5 +306,5 @@
 
     ALLOCATE (coastalflow_mean(nbpt), stat=ier)
-    IF (ier /= 0) CALL ipslerr_p(3,'routing_simple_init_1','Pb in allocate for coastalflow_mean','','')
+    IF (ier /= 0) CALL ipslerr_p(3,'routing_flow_initialize','Pb in allocate for coastalflow_mean','','')
     var_name = 'coastalflow'
     CALL ioconf_setatt_p('UNITS', 'Kg/dt')
@@ -299,5 +316,64 @@
     coastalflow(:) =  coastalflow_mean(:)
 
- END SUBROUTINE routing_flow_initialize
+    CALL routing_flow_initialize_diag(kjit, rest_id, contfrac)
+
+  END SUBROUTINE routing_flow_initialize
+
+  SUBROUTINE routing_flow_initialize_diag(kjit, rest_id, contfrac)
+    USE xios
+    USE grid, ONLY : area 
+    IMPLICIT NONE
+    INTEGER ,INTENT(IN)                     :: kjit           
+    INTEGER ,INTENT(IN)                     :: rest_id           
+    REAL(r_std), INTENT(IN)                 :: contfrac(nbpt)       !! fraction of land
+    INTEGER :: ier    
+    CHARACTER(LEN=80)   :: var_name       !! To store variables names for I/O (unitless)
+     
+    
+    REAL(r_std) :: contfrac_mpi(nbp_mpi)
+    REAL(r_std) :: area_mpi(nbp_mpi)
+    REAL(r_std) :: fast_diag_mpi(nbp_mpi)
+    REAL(r_std) :: slow_diag_mpi(nbp_mpi)
+    REAL(r_std) :: stream_diag_mpi(nbp_mpi)
+    REAL(r_std) :: hydrographs_diag_mpi(nbp_mpi)
+
+    CALL gather_omp(contfrac, contfrac_mpi)
+    CALL gather_omp(area, area_mpi)
+  
+    IF (is_omp_root) THEN
+      ALLOCATE(fast_diag(nbpt), stat=ier)
+      IF (ier /= 0) CALL ipslerr_p(3,'routing_flow_initialize_diag','Pb in allocate for fast_diag','','')
+      ALLOCATE(slow_diag(nbpt), stat=ier)
+      IF (ier /= 0) CALL ipslerr_p(3,'routing_flow_initialize_diag','Pb in allocate for slow_diag','','')
+      ALLOCATE(stream_diag(nbpt), stat=ier)
+      IF (ier /= 0) CALL ipslerr_p(3,'routing_flow_initialize_diag','Pb in allocate for stream_diag','','')
+
+
+      CALL xios_send_field("routing_fast_diag0_r", fast_reservoir_r)
+      CALL xios_recv_field("routing_fast_diag0", fast_diag_mpi)
+      CALL xios_send_field("routing_slow_diag0_r", slow_reservoir_r)
+      CALL xios_recv_field("routing_slow_diag0", slow_diag_mpi)
+      CALL xios_send_field("routing_stream_diag0_r", stream_reservoir_r)
+      CALL xios_recv_field("routing_stream_diag0", stream_diag_mpi)
+
+      fast_diag_mpi=fast_diag_mpi/(area_mpi*contfrac_mpi)      !! kg => kg/m^2
+      slow_diag_mpi=slow_diag_mpi/(area_mpi*contfrac_mpi)      !! kg => kg/m^2
+      stream_diag_mpi=stream_diag_mpi/(area_mpi*contfrac_mpi)  !! kg => kg/m^2
+    ENDIF
+    
+    CALL scatter_omp(fast_diag_mpi,fast_diag)
+    CALL scatter_omp(slow_diag_mpi,slow_diag)
+    CALL scatter_omp(stream_diag_mpi,stream_diag)
+    
+    ALLOCATE(hydrographs_diag(nbpt), stat=ier)
+    IF (ier /= 0) CALL ipslerr_p(3,'routing_flow_initialize_diag','Pb in allocate for hydrographs_diag','','')
+ 
+    var_name = 'hydrographs'
+    CALL ioconf_setatt_p('UNITS', 'kg/dt_sechiba')
+    CALL ioconf_setatt_p('LONG_NAME','Hydrograph at outlow of grid')
+    CALL restget_p (rest_id, var_name, nbp_glo, 1, 1, kjit, .TRUE., hydrographs_diag, "gather", nbp_glo, index_g)
+    CALL setvar_p (hydrographs_diag, val_exp, 'NO_KEYWORD', zero)
+
+  END SUBROUTINE routing_flow_initialize_diag
 
 
@@ -1636,6 +1712,10 @@
   
     REAL,ALLOCATABLE :: station_lonlat(:,:)  
-    INTEGER,ALLOCATABLE :: station_prec(:)  
-
+    REAL,ALLOCATABLE :: station_prec(:)  
+    REAL,ALLOCATABLE :: station_area(:)  
+    INTEGER :: station_index_prec, station_index_prec_i, station_index_prec_j
+    INTEGER :: station_index_area, station_index_area_i, station_index_area_j
+    LOGICAL :: has_lonlat
+    LOGICAL :: has_area
     INTEGER ::i,j,r,k
   
@@ -1651,6 +1731,6 @@
 
     CHARACTER(LEN=256) :: str_station_ind
-    REAL :: lon_a,lat_a,lon_b,lat_b,dist,max_area, max_max_area, min_dist
-    INTEGER :: min_dist_index
+    REAL :: lon_a,lat_a,lon_b,lat_b,dist,max_area, max_max_area, min_dist, min_area, min_min_area
+    INTEGER :: min_dist_index, min_dist_index_i, min_dist_index_j
     INTEGER :: ierr
 
@@ -1666,13 +1746,21 @@
     ALLOCATE(station_index(nb_station)) 
     ALLOCATE(station_prec(nb_station)) 
-    
+    ALLOCATE(station_area(nb_station))
+
     DO k=1,nb_station
       WRITE(str_station_ind,*) k
       str_station_ind=ADJUSTL(str_station_ind)
       CALL getin("station"//TRIM(str_station_ind)//"_id",station(k))
+      station_lonlat(k,:) = 1.1e10
+      has_lonlat=.TRUE.
       CALL getin("station"//TRIM(str_station_ind)//"_coor",station_lonlat(k,:))
+      IF (station_lonlat(k,1)>1e10 .OR. station_lonlat(k,2)>1e10) has_lonlat=.FALSE.
       station_prec(k)=50000
       CALL getin("station"//TRIM(str_station_ind)//"_prec",station_prec(k))
-      
+      station_area(k) = -1
+      has_area=.TRUE.
+      CALL getin("station"//TRIM(str_station_ind)//"_area",station_area(k))
+      IF (station_area(k)==-1) has_area=.FALSE.
+
       lon_a = station_lonlat(k,1)*Pi/180.
       lat_a = station_lonlat(k,2)*Pi/180.
@@ -1680,4 +1768,6 @@
       max_area=0
       min_dist=HUGE(min_dist)
+      min_area=HUGE(min_area)
+
       DO j=1,nj 
         DO i=1,ni
@@ -1691,10 +1781,24 @@
                 min_dist=dist
                 min_dist_index = r
+                min_dist_index_i = i
+                min_dist_index_j = j
               ENDIF
-          
+              
               IF (basins_area_r(r) > max_area) THEN
                 max_area = basins_area_r(r)
-                station_index(k) = r
+                station_index_prec = r
+                station_index_prec_i = i
+                station_index_prec_j = j
               ENDIF
+
+              IF (has_area) THEN
+                IF (ABS(basins_area_r(r)-station_area(k)*1e6) < min_area) THEN
+                  min_area = ABS(basins_area_r(r)-station_area(k)*1e6)
+                  station_index_area = r
+                  station_index_area_i = i
+                  station_index_area_j = j
+                ENDIF
+              ENDIF
+
             ENDIF
           ENDIF
@@ -1703,10 +1807,35 @@
 
       CALL MPI_ALLREDUCE(max_area, max_max_area, 1, MPI_REAL_ORCH, MPI_MAX, MPI_COMM_ORCH, ierr)
-      IF (max_area /= max_max_area) station_index(k)=-1
-      IF (max_area == 0) station_index(k)=-1
-      
-!      PRINT*,"Station ",TRIM(station(k))," old coor :",lon(min_dist_index),lat(min_dist_index)," basin_area (km2)", basins_area_r(min_dist_index)/1000/1000 
-!      PRINT*,"Station ",TRIM(station(k)),"new coor ",lon(station_index(k)),lat(station_index(k))," basin_area(km2) ", basins_area_r(station_index(k))/1000/1000
-    ENDDO
+      IF (max_area /= max_max_area) station_index_prec=-1
+      IF (max_area == 0) station_index_prec=-1
+      
+      IF (has_area) THEN
+        CALL MPI_ALLREDUCE(min_area, min_min_area, 1, MPI_REAL_ORCH, MPI_MIN, MPI_COMM_ORCH, ierr)
+        IF (min_area /= min_min_area) station_index_area=-1
+        IF (min_area == HUGE(min_area)) station_index_area=-1
+      ELSE
+        station_index_area=-1
+      ENDIF
+
+      IF (station_index_prec/=-1) THEN
+        PRINT*,"Found station ",TRIM(station(k))," based on coordinates lon-lat",lon(min_dist_index_i),lat(min_dist_index_j), &
+               " with basin_area (km2) ", basins_area_r(min_dist_index)/1000/1000
+        PRINT*,"=> at coordinate ",lon(station_index_prec_i),lat(station_index_prec_j)," basin_area(km2) ", &
+                                   basins_area_r(station_index_prec)/1000/1000
+      ENDIF
+      
+      IF (station_index_area/=-1) THEN
+        PRINT*,"Found station ",TRIM(station(k))," based on basin area (km2)", station_area(k)
+        PRINT*,"=> at coordinate ",lon(station_index_area_i),lat(station_index_area_j)," basin_area(km2) ", &
+                                   basins_area_r(station_index_area)/1000/1000
+      ENDIF
+
+      IF (station_index_area/=-1 ) THEN
+        station_index(k) = station_index_area
+      ELSE
+        station_index(k) = station_index_prec
+      ENDIF
+
+   ENDDO
     
     CALL xios_get_calendar_type(calendar_type)
@@ -1749,5 +1878,5 @@
   END SUBROUTINE initialize_stations
 
-  SUBROUTINE routing_flow_main(dt_routing) !
+  SUBROUTINE routing_flow_main(dt_routing, contfrac) !
     
     USE xios
@@ -1760,4 +1889,5 @@
     !! 0.1 Input variables
     REAL(r_std), INTENT (in)                     :: dt_routing                !! Routing time step (s)
+    REAL(r_std), INTENT (in)                     :: contfrac(nbpt)                !! Routing time step (s)
 
     !! 0.4 Local variables
@@ -1769,11 +1899,15 @@
     REAL(r_std)                                  :: coastalflow(nbp_mpi)           
     REAL(r_std)                                  :: lakeinflow(nbp_mpi)            
-    REAL(r_std)                                  :: fast_diag_mpi(nbp_mpi)          
-    REAL(r_std)                                  :: slow_diag_mpi(nbp_mpi)        
-    REAL(r_std)                                  :: stream_diag_mpi(nbp_mpi)         
     REAL(r_std)                                  :: area_mpi(nbp_mpi) ! cell area         
+    REAL(r_std)                                  :: contfrac_mpi(nbp_mpi) ! cell area         
     REAL(r_std)                                  :: flow_coast(nbp_mpi)          
     REAL(r_std)                                  :: flow_lake(nbp_mpi)          
-
+    
+    ! diags
+    REAL(r_std)                                  :: fast_diag_mpi(nbp_mpi)  
+    REAL(r_std)                                  :: slow_diag_mpi(nbp_mpi)  
+    REAL(r_std)                                  :: stream_diag_mpi(nbp_mpi)  
+    REAL(r_std)                                  :: hydrographs_diag_mpi(nbp_mpi)  
+   
     ! from input model -> routing_grid
     REAL(r_std)                      :: runoff_r(nbpt_r)              !! Grid-point runoff (kg/m^2/dt)
@@ -1823,5 +1957,5 @@
     CALL gather_omp(drainage_mean, drainage)
     CALL gather_omp(area, area_mpi)
-
+    CALL gather_omp(contfrac, contfrac_mpi)
 
     IF (is_omp_root) THEN
@@ -2092,14 +2226,49 @@
         CALL xios_send_field(TRIM(station(k)),value)
       ENDDO
-      CALL xios_orchidee_change_context("orchidee")
+
+      CALL xios_orchidee_change_context("orchidee")  !! return on orchidee context
+
+      
+      !!! for orchidee history diag
+
+      CALL xios_send_field("routing_fast_diag_r", fast_reservoir_r)
+      CALL xios_recv_field("routing_fast_diag", fast_diag_mpi)
+      CALL xios_send_field("routing_slow_diag_r", slow_reservoir_r)
+      CALL xios_recv_field("routing_slow_diag", slow_diag_mpi)
+      CALL xios_send_field("routing_stream_diag_r", stream_reservoir_r)
+      CALL xios_recv_field("routing_stream_diag", stream_diag_mpi)
+      CALL xios_send_field("routing_hydrographs_diag_r", hydrographs_r+lakeinflow_r+coastalflow_r+riverflow_r)
+      CALL xios_recv_field("routing_hydrographs_diag", hydrographs_diag_mpi)
+
+      fast_diag_mpi=fast_diag_mpi/(area_mpi*contfrac_mpi)      !! kg => kg/m^2
+      slow_diag_mpi=slow_diag_mpi/(area_mpi*contfrac_mpi)      !! kg => kg/m^2
+      stream_diag_mpi=stream_diag_mpi/(area_mpi*contfrac_mpi)  !! kg => kg/m^2
+      hydrographs_diag_mpi = hydrographs_diag_mpi/1000.
+
     ENDIF ! is_omp_root
 
-    CALL scatter_omp(riverflow,riverflow_mean)
-    CALL scatter_omp(coastalflow,coastalflow_mean)
-    CALL scatter_omp(lakeinflow,lakeinflow_mean)
-
+    CALL scatter_omp(riverflow, riverflow_mean)
+    CALL scatter_omp(coastalflow, coastalflow_mean)
+    CALL scatter_omp(lakeinflow, lakeinflow_mean)
+    CALL scatter_omp(fast_diag_mpi, fast_diag)
+    CALL scatter_omp(slow_diag_mpi, slow_diag)
+    CALL scatter_omp(stream_diag_mpi, stream_diag)
+    CALL scatter_omp(hydrographs_diag_mpi, hydrographs_diag)
+    
     CALL routing_flow_reset_mean
     
   END SUBROUTINE routing_flow_main
+
+  SUBROUTINE routing_flow_diags(dt_sechiba)
+  USE xios
+  IMPLICIT NONE
+    REAL(r_std) :: dt_sechiba
+
+    CALL xios_orchidee_send_field("fastr",fast_diag)  
+    CALL xios_orchidee_send_field("slowr",slow_diag)
+    CALL xios_orchidee_send_field("streamr",stream_diag)
+    CALL xios_orchidee_send_field("hydrographs",hydrographs_diag*dt_sechiba)
+
+  END SUBROUTINE routing_flow_diags
 
 
@@ -2132,9 +2301,11 @@
        CALL xios_send_field("stream_reservoir_restart",stream_reservoir_r)
     ENDIF
-
+    
     CALL restput_p (rest_id, 'riverflow', nbp_glo, 1, 1, kjit, riverflow_mean, 'scatter',  nbp_glo, index_g)
     CALL restput_p (rest_id, 'coastalflow', nbp_glo, 1, 1, kjit, coastalflow_mean, 'scatter',  nbp_glo, index_g)
     CALL restput_p (rest_id, 'lakeinflow', nbp_glo, 1, 1, kjit, lakeinflow_mean, 'scatter',  nbp_glo, index_g)
     CALL routing_flow_finalize_mean(kjit, rest_id)
+    
+    CALL routing_flow_finalize_diag(kjit, rest_id)
 
     CALL xios_orchidee_change_context("orchidee_routing_out")
@@ -2144,4 +2315,13 @@
   END SUBROUTINE routing_flow_finalize
 
+  SUBROUTINE routing_flow_finalize_diag(kjit, rest_id)
+    USE ioipsl
+    IMPLICIT NONE
+    INTEGER, INTENT(IN) :: kjit
+    INTEGER, INTENT(IN) :: rest_id
+    
+     CALL restput_p (rest_id, 'hydrographs', nbp_glo, 1, 1, kjit, hydrographs_diag, 'scatter',  nbp_glo, index_g)
+
+  END SUBROUTINE routing_flow_finalize_diag
 
   !! ================================================================================================================================
Index: branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/context_routing_native_orchidee.xml
===================================================================
--- branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/context_routing_native_orchidee.xml	(revision 8393)
+++ branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/context_routing_native_orchidee.xml	(revision 8394)
@@ -70,4 +70,5 @@
        <field field_ref="routing_irrigation" />
        <field field_ref="routing_basins_area" operation="once"/>
+       <field field_ref="routing_stream_diag" operation="average" />
 
 
@@ -92,4 +93,5 @@
        <field id="basins_riverflow" axis_ref="basins"  operation="instant"/>
        <field field_ref="routing_basins_area" operation="once"/>
+       <field field_ref="routing_stream_diag_r" operation="average" />
     </field_group>
 
@@ -225,17 +227,42 @@
       <field id="routing_stream_reservoir_r" domain_ref="routing_domain" operation="instant" />
 
-      <field id="routing_fast_reservoir"     field_ref="routing_fast_reservoir_r"  domain_ref="domain_landpoints_routing" operation="instant" />
-      <field id="routing_slow_reservoir"     field_ref="routing_slow_reservoir_r"   domain_ref="domain_landpoints_routing" operation="instant" />
-      <field id="routing_stream_reservoir"   field_ref="routing_stream_reservoir_r" domain_ref="domain_landpoints_routing" operation="instant" />
+      <field id="routing_fast_reservoir"     field_ref="routing_fast_reservoir_r"   domain_ref="domain_landpoints_routing"  operation="instant" read_access="true" />
+      <field id="routing_slow_reservoir"     field_ref="routing_slow_reservoir_r"   domain_ref="domain_landpoints_routing" operation="instant" read_access="true"/>
+      <field id="routing_stream_reservoir"   field_ref="routing_stream_reservoir_r" domain_ref="domain_landpoints_routing" operation="instant" read_access="true"/>
       <field id="routing_hydrographs_r"      domain_ref="routing_domain" operation="instant" />
 
       <field id="routing_lakeinflow_r" domain_ref="routing_domain" operation="instant" />
-      <field id="routing_lakeinflow"   domain_ref="domain_landpoints" operation="instant" />
+      <field id="routing_lakeinflow"   domain_ref="domain_landpoints" operation="instant" read_access="true"/>
 
       <field id="routing_coastalflow_r" domain_ref="routing_domain" operation="instant" />
-      <field id="routing_coastalflow"   domain_ref="domain_landpoints" operation="instant" />
+      <field id="routing_coastalflow"   domain_ref="domain_landpoints" operation="instant" read_access="true"/>
 
       <field id="routing_riverflow_r" domain_ref="routing_domain" operation="instant" />
-      <field id="routing_riverflow"   domain_ref="domain_landpoints" operation="instant" />    
+      <field id="routing_riverflow"   domain_ref="domain_landpoints" operation="instant" read_access="true"/>    
+      
+     <!-- orchidee diag -->
+     <field id="routing_fast_diag0_r"   domain_ref="routing_domain" operation="instant" />
+     <field id="routing_fast_diag0"     field_ref="routing_fast_diag0_r"   domain_ref="domain_landpoints_routing" operation="instant" read_access="true"/>
+     
+     <field id="routing_slow_diag0_r"   domain_ref="routing_domain" operation="instant" />
+     <field id="routing_slow_diag0"     field_ref="routing_slow_diag0_r"   domain_ref="domain_landpoints_routing" operation="instant" read_access="true"/>
+     
+     <field id="routing_stream_diag0_r"   domain_ref="routing_domain" operation="instant" />
+     <field id="routing_stream_diag0"     field_ref="routing_stream_diag0_r"   domain_ref="domain_landpoints_routing" operation="instant" read_access="true"/>
+
+
+     <field id="routing_fast_diag_r"   domain_ref="routing_domain" operation="instant" />
+     <field id="routing_fast_diag"     field_ref="routing_fast_diag_r"   domain_ref="domain_landpoints_routing" operation="instant" read_access="true"/>
+     
+     <field id="routing_slow_diag_r"   domain_ref="routing_domain" operation="instant" />
+     <field id="routing_slow_diag"     field_ref="routing_slow_diag_r"   domain_ref="domain_landpoints_routing" operation="instant" read_access="true"/>
+     
+     <field id="routing_stream_diag_r"   domain_ref="routing_domain" operation="instant" />
+     <field id="routing_stream_diag"     field_ref="routing_stream_diag_r" domain_ref="domain_landpoints_routing" operation="instant" read_access="true"/>
+    
+     <field id="routing_hydrographs_diag_r"   domain_ref="routing_domain" operation="instant" />
+     <field id="routing_hydrographs_diag"     field_ref="routing_hydrographs_diag_r" domain_ref="domain_landpoints_routing" operation="instant" read_access="true"/>
+
+
   </field_definition>
   
