Index: /branches/2017/dev_merge_2017/NEMOGCM/CONFIG/ORCA2_LIM3_PISCES/EXP00/file_def_nemo-lim.xml
===================================================================
--- /branches/2017/dev_merge_2017/NEMOGCM/CONFIG/ORCA2_LIM3_PISCES/EXP00/file_def_nemo-lim.xml	(revision 9432)
+++ /branches/2017/dev_merge_2017/NEMOGCM/CONFIG/ORCA2_LIM3_PISCES/EXP00/file_def_nemo-lim.xml	(revision 9433)
@@ -33,4 +33,5 @@
        <!-- heat -->
        <field field_ref="icetemp"          name="sitemp" />
+       <field field_ref="snwtemp"          name="sntemp" />
        <field field_ref="icettop"          name="sittop" />
        <field field_ref="icetbot"          name="sitbot" />
@@ -85,5 +86,7 @@
        <field field_ref="icesalt_cat"      name="sisalcat"/>
        <field field_ref="icetemp_cat"      name="sitemcat"/>
-       
+       <field field_ref="snwtemp_cat"      name="sntemcat"/>
+       <field field_ref="icettop_cat"      name="sitopcat"/>
+
      </file>
      
Index: /branches/2017/dev_merge_2017/NEMOGCM/CONFIG/SHARED/field_def_nemo-lim.xml
===================================================================
--- /branches/2017/dev_merge_2017/NEMOGCM/CONFIG/SHARED/field_def_nemo-lim.xml	(revision 9432)
+++ /branches/2017/dev_merge_2017/NEMOGCM/CONFIG/SHARED/field_def_nemo-lim.xml	(revision 9433)
@@ -42,4 +42,5 @@
 	 <!-- heat -->
          <field id="icetemp"      long_name="Mean ice temperature"                                                                                              unit="degC" />
+         <field id="snwtemp"      long_name="Mean snow temperature"                                                                                             unit="degC" />
          <field id="icettop"      long_name="temperature at the ice surface"                                                                                    unit="degC" />
          <field id="icetbot"      long_name="temperature at the ice bottom"                                                                                     unit="degC" />
@@ -165,4 +166,5 @@
          <field id="icetemp_cat"  long_name="Ice temperature per category"                      unit="degC"   grid_ref="grid_T_3D_ncatice" />
          <field id="snwtemp_cat"  long_name="Snow temperature per category"                     unit="degC"   grid_ref="grid_T_3D_ncatice" />
+         <field id="icettop_cat"  long_name="Ice/snow surface temperature per category"         unit="degC"   grid_ref="grid_T_3D_ncatice" />
          <field id="iceapnd_cat"  long_name="Ice melt pond concentration per category"          unit="%"      grid_ref="grid_T_3D_ncatice" /> 
          <field id="icehpnd_cat"  long_name="Ice melt pond thickness per category"              unit="m"      grid_ref="grid_T_3D_ncatice" /> 
Index: /branches/2017/dev_merge_2017/NEMOGCM/NEMO/LIM_SRC_3/ice.F90
===================================================================
--- /branches/2017/dev_merge_2017/NEMOGCM/NEMO/LIM_SRC_3/ice.F90	(revision 9432)
+++ /branches/2017/dev_merge_2017/NEMOGCM/NEMO/LIM_SRC_3/ice.F90	(revision 9433)
@@ -145,4 +145,5 @@
    !! sm_i        |      -      |    Mean sea ice salinity        | ppt   |
    !! tm_i        |      -      |    Mean sea ice temperature     | K     |
+   !! tm_s        |      -      |    Mean snow    temperature     | K     |
    !! et_i        !      -      !    Total ice enthalpy           | J/m2  | 
    !! et_s        !      -      !    Total snow enthalpy          | J/m2  | 
@@ -340,4 +341,5 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   et_i , et_s  !: ice and snow total heat content
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   tm_i         !: mean ice temperature over all categories
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   tm_s         !: mean snw temperature over all categories
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   bvm_i        !: brine volume averaged over all categories
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sm_i         !: mean sea ice salinity averaged over all categories [PSU]
@@ -458,5 +460,5 @@
       ALLOCATE( u_ice(jpi,jpj) , v_ice(jpi,jpj) ,                                      &
          &      vt_i (jpi,jpj) , vt_s (jpi,jpj) , at_i(jpi,jpj) , ato_i(jpi,jpj) ,     &
-         &      et_i (jpi,jpj) , et_s (jpi,jpj) , tm_i(jpi,jpj) , bvm_i(jpi,jpj) ,     &
+         &      et_i (jpi,jpj) , et_s (jpi,jpj) , tm_i(jpi,jpj) , tm_s (jpi,jpj) , bvm_i(jpi,jpj) ,  &
          &      sm_i (jpi,jpj) , tm_su(jpi,jpj) , hm_i(jpi,jpj) , hm_s (jpi,jpj) ,     &
          &      om_i (jpi,jpj) , tau_icebfr(jpi,jpj)                             , STAT=ierr(ii) )
Index: /branches/2017/dev_merge_2017/NEMOGCM/NEMO/LIM_SRC_3/icevar.F90
===================================================================
--- /branches/2017/dev_merge_2017/NEMOGCM/NEMO/LIM_SRC_3/icevar.F90	(revision 9432)
+++ /branches/2017/dev_merge_2017/NEMOGCM/NEMO/LIM_SRC_3/icevar.F90	(revision 9433)
@@ -24,8 +24,9 @@
    !!                        - vt_s(jpi,jpj)
    !!                        - at_i(jpi,jpj)
-   !!                        - et_s(jpi,jpj)  !total snow heat content
-   !!                        - et_i(jpi,jpj)  !total ice thermal content 
-   !!                        - sm_i(jpi,jpj) !mean ice salinity
-   !!                        - tm_i (jpi,jpj) !mean ice temperature
+   !!                        - et_s(jpi,jpj)  total snow heat content
+   !!                        - et_i(jpi,jpj)  total ice thermal content 
+   !!                        - sm_i(jpi,jpj)  mean ice salinity
+   !!                        - tm_i(jpi,jpj)  mean ice temperature
+   !!                        - tm_s(jpi,jpj)  mean snw temperature
    !!======================================================================
    !! History :   -   ! 2006-01 (M. Vancoppenolle) Original code
@@ -91,5 +92,5 @@
       !
       INTEGER ::   ji, jj, jk, jl   ! dummy loop indices
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   z1_at_i, z1_vt_i
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   z1_at_i, z1_vt_i, z1_vt_s
       !!-------------------------------------------------------------------
       !
@@ -108,5 +109,5 @@
       IF( kn > 1 ) THEN
          !
-         ALLOCATE( z1_at_i(jpi,jpj) , z1_vt_i(jpi,jpj) )
+         ALLOCATE( z1_at_i(jpi,jpj) , z1_vt_i(jpi,jpj) , z1_vt_s(jpi,jpj) )
          WHERE( at_i(:,:) > epsi20 )   ;   z1_at_i(:,:) = 1._wp / at_i(:,:)
          ELSEWHERE                     ;   z1_at_i(:,:) = 0._wp
@@ -114,4 +115,7 @@
          WHERE( vt_i(:,:) > epsi20 )   ;   z1_vt_i(:,:) = 1._wp / vt_i(:,:)
          ELSEWHERE                     ;   z1_vt_i(:,:) = 0._wp
+         END WHERE
+         WHERE( vt_s(:,:) > epsi20 )   ;   z1_vt_s(:,:) = 1._wp / vt_s(:,:)
+         ELSEWHERE                     ;   z1_vt_s(:,:) = 0._wp
          END WHERE
          !
@@ -127,7 +131,11 @@
          !
          tm_i(:,:) = 0._wp
+         tm_s(:,:) = 0._wp
          DO jl = 1, jpl
             DO jk = 1, nlay_i
                tm_i(:,:) = tm_i(:,:) + r1_nlay_i * t_i (:,:,jk,jl) * v_i(:,:,jl) * z1_vt_i(:,:)
+            END DO
+            DO jk = 1, nlay_s
+               tm_s(:,:) = tm_s(:,:) + r1_nlay_s * t_s (:,:,jk,jl) * v_s(:,:,jl) * z1_vt_s(:,:)
             END DO
          END DO
@@ -138,7 +146,8 @@
             tm_si(:,:) = rt0
             tm_i (:,:) = rt0
-         END WHERE
-
-         DEALLOCATE( z1_at_i , z1_vt_i )
+            tm_s (:,:) = rt0
+         END WHERE
+
+         DEALLOCATE( z1_at_i , z1_vt_i , z1_vt_s )
       ENDIF
       !
Index: /branches/2017/dev_merge_2017/NEMOGCM/NEMO/LIM_SRC_3/icewri.F90
===================================================================
--- /branches/2017/dev_merge_2017/NEMOGCM/NEMO/LIM_SRC_3/icewri.F90	(revision 9432)
+++ /branches/2017/dev_merge_2017/NEMOGCM/NEMO/LIM_SRC_3/icewri.F90	(revision 9433)
@@ -50,6 +50,6 @@
       REAL(wp) ::   z2da, z2db, zrho1, zrho2
       REAL(wp), DIMENSION(jpi,jpj)     ::   z2d !  2D workspace
-      REAL(wp), DIMENSION(jpi,jpj)     ::   zmsk00, zmsk05, zmsk15 ! O%, 5% and 15% concentration mask
-      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zmsk00l        ! cat masks
+      REAL(wp), DIMENSION(jpi,jpj)     ::   zmsk00, zmsk05, zmsk15, zmsksn ! O%, 5% and 15% concentration mask and snow mask
+      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zmsk00l, zmsksnl               ! cat masks
       !
       ! Global ice diagnostics (SIMIP)
@@ -72,4 +72,5 @@
             zmsk05(ji,jj) = MAX( 0._wp , SIGN( 1._wp , at_i(ji,jj) - 0.05_wp ) ) ! 1 if 5% ice , 0 if less
             zmsk15(ji,jj) = MAX( 0._wp , SIGN( 1._wp , at_i(ji,jj) - 0.15_wp ) ) ! 1 if 15% ice, 0 if less
+            zmsksn(ji,jj) = MAX( 0._wp , SIGN( 1._wp , vt_s(ji,jj) - epsi06  ) ) ! 1 if snow   , 0 if no snow
          END DO
       END DO
@@ -78,4 +79,5 @@
             DO ji = 1, jpi
                zmsk00l(ji,jj,jl)  = MAX( 0._wp , SIGN( 1._wp , a_i(ji,jj,jl) - epsi06 ) )
+               zmsksnl(ji,jj,jl)  = MAX( 0._wp , SIGN( 1._wp , v_s(ji,jj,jl) - epsi06 ) )
             END DO
          END DO
@@ -93,5 +95,5 @@
       ! general fields
       IF( iom_use('icemass'  ) )   CALL iom_put( "icemass", rhoic * vt_i * zmsk00 )   ! Ice mass per cell area 
-      IF( iom_use('snwmass'  ) )   CALL iom_put( "snwmass", rhosn * vt_s * zmsk00 )   ! Snow mass per cell area
+      IF( iom_use('snwmass'  ) )   CALL iom_put( "snwmass", rhosn * vt_s * zmsksn )   ! Snow mass per cell area
       IF( iom_use('icepres'  ) )   CALL iom_put( "icepres", zmsk00                )   ! Ice presence (1 or 0) 
       IF( iom_use('iceconc'  ) )   CALL iom_put( "iceconc", at_i  * zmsk00        )   ! ice concentration
@@ -102,5 +104,5 @@
       IF( iom_use('iceage'   ) )   CALL iom_put( "iceage" , om_i  * zmsk00 / rday )   ! ice age
       IF( iom_use('icehnew'  ) )   CALL iom_put( "icehnew", ht_i_new              )   ! new ice thickness formed in the leads
-      IF( iom_use('snwvolu'  ) )   CALL iom_put( "snwvolu", vt_s  * zmsk00        )   ! snow volume
+      IF( iom_use('snwvolu'  ) )   CALL iom_put( "snwvolu", vt_s  * zmsksn        )   ! snow volume
       IF( iom_use('icefrb') ) THEN
          z2d(:,:) = ( zrho1 * hm_i(:,:) - zrho2 * hm_s(:,:) )                                         
@@ -119,9 +121,10 @@
       ! heat
       IF( iom_use('icetemp'  ) )   CALL iom_put( "icetemp", ( tm_i  - rt0 ) * zmsk00 )   ! ice mean temperature
+      IF( iom_use('snwtemp'  ) )   CALL iom_put( "snwtemp", ( tm_s  - rt0 ) * zmsksn )   ! snw mean temperature
       IF( iom_use('icettop'  ) )   CALL iom_put( "icettop", ( tm_su - rt0 ) * zmsk00 )   ! temperature at the ice surface
       IF( iom_use('icetbot'  ) )   CALL iom_put( "icetbot", ( t_bo  - rt0 ) * zmsk00 )   ! temperature at the ice bottom
       IF( iom_use('icetsni'  ) )   CALL iom_put( "icetsni", ( tm_si - rt0 ) * zmsk00 )   ! temperature at the snow-ice interface
       IF( iom_use('icehc'    ) )   CALL iom_put( "icehc"  ,  -et_i          * zmsk00 )   ! ice heat content
-      IF( iom_use('snwhc'    ) )   CALL iom_put( "snwhc"  ,  -et_s          * zmsk00 )   ! snow heat content
+      IF( iom_use('snwhc'    ) )   CALL iom_put( "snwhc"  ,  -et_s          * zmsksn )   ! snow heat content
 
       ! momentum
@@ -147,13 +150,14 @@
       IF( iom_use('iceconc_cat' ) )   CALL iom_put( "iceconc_cat" , a_i * zmsk00l                                              )   ! area for categories
       IF( iom_use('icethic_cat' ) )   CALL iom_put( "icethic_cat" , h_i * zmsk00l                                              )   ! thickness for categories
-      IF( iom_use('snwthic_cat' ) )   CALL iom_put( "snwthic_cat" , h_s * zmsk00l                                              )   ! snow depth for categories
+      IF( iom_use('snwthic_cat' ) )   CALL iom_put( "snwthic_cat" , h_s * zmsksnl                                              )   ! snow depth for categories
       IF( iom_use('icesalt_cat' ) )   CALL iom_put( "icesalt_cat" , s_i * zmsk00l                                              )   ! salinity for categories
       IF( iom_use('iceage_cat'  ) )   CALL iom_put( "iceage_cat"  , o_i * zmsk00l / rday                                       )   ! ice age
       IF( iom_use('icetemp_cat' ) )   CALL iom_put( "icetemp_cat" , ( SUM( t_i(:,:,:,:), dim=3 ) * r1_nlay_i - rt0 ) * zmsk00l )   ! ice temperature
-      IF( iom_use('snwtemp_cat' ) )   CALL iom_put( "snwtemp_cat" , ( SUM( t_s(:,:,:,:), dim=3 ) * r1_nlay_s - rt0 ) * zmsk00l )   ! snow temperature
-      IF( iom_use('icebrv_cat'  ) )   CALL iom_put( "icebrv_cat"  , bv_i * 100. * zmsk00l                                      )   ! brine volume
-      IF( iom_use('iceapnd_cat' ) )   CALL iom_put( "iceapnd_cat" , a_ip        * zmsk00l                                      )   ! melt pond frac for categories
-      IF( iom_use('icehpnd_cat' ) )   CALL iom_put( "icehpnd_cat" , h_ip        * zmsk00l                                      )   ! melt pond frac for categories
-      IF( iom_use('iceafpnd_cat') )   CALL iom_put( "iceafpnd_cat", a_ip_frac   * zmsk00l                                      )   ! melt pond frac for categories
+      IF( iom_use('snwtemp_cat' ) )   CALL iom_put( "snwtemp_cat" , ( SUM( t_s(:,:,:,:), dim=3 ) * r1_nlay_s - rt0 ) * zmsksnl )   ! snow temperature
+      IF( iom_use('icettop_cat' ) )   CALL iom_put( "icettop_cat" , ( t_su - rt0 ) * zmsk00l                                   )   ! surface temperature
+      IF( iom_use('icebrv_cat'  ) )   CALL iom_put( "icebrv_cat"  ,   bv_i * 100.  * zmsk00l                                   )   ! brine volume
+      IF( iom_use('iceapnd_cat' ) )   CALL iom_put( "iceapnd_cat" ,   a_ip         * zmsk00l                                   )   ! melt pond frac for categories
+      IF( iom_use('icehpnd_cat' ) )   CALL iom_put( "icehpnd_cat" ,   h_ip         * zmsk00l                                   )   ! melt pond frac for categories
+      IF( iom_use('iceafpnd_cat') )   CALL iom_put( "iceafpnd_cat",   a_ip_frac    * zmsk00l                                   )   ! melt pond frac for categories
 
       !------------------
