Index: LMDZ.3.3/branches/rel-LF/libf/phylmd/write_histmth.h
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/phylmd/write_histmth.h	(revision 486)
+++ LMDZ.3.3/branches/rel-LF/libf/phylmd/write_histmth.h	(revision 506)
@@ -3,7 +3,5 @@
       ndex2d = 0
       ndex3d = 0
-c
-c Champs 2D:
-c
+
          zsto = dtime
          zout = dtime * ecrit_mth
@@ -11,4 +9,9 @@
 
       i = NINT(zout/zsto)
+c
+      IF(lev_histmth.GE.1) THEN
+c
+c Champs 2D:
+c
       CALL gr_fi_ecrit(1,klon,iim,jjmp1,pphis,zx_tmp_2d)
       CALL histwrite(nid_mth,"phis",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
@@ -17,5 +20,10 @@
       CALL gr_fi_ecrit(1,klon,iim,jjmp1,paire,zx_tmp_2d)
       CALL histwrite(nid_mth,"aire",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-
+c
+      zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, is_ter)
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+      CALL histwrite(nid_mth,"pourc_"//clnsurf(is_ter),itau_w,
+     $      zx_tmp_2d,iim*jjmp1,ndex2d)
+c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, slp,zx_tmp_2d)
       CALL histwrite(nid_mth,"slp",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
@@ -27,4 +35,38 @@
       CALL histwrite(nid_mth,"t2m",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
+c ENSEMBLES BEG
+      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zt2m,zx_tmp_2d)
+      CALL histwrite(nid_mth,"t2m_min",itau_w,zx_tmp_2d,
+     .               iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zt2m,zx_tmp_2d)
+      CALL histwrite(nid_mth,"t2m_max",itau_w,zx_tmp_2d,
+     .               iim*jjmp1,ndex2d)
+c
+c     CALL gr_fi_ecrit(1,klon,iim,jjmp1,ftsoil(:,1,is_ter),zx_tmp_2d)
+c     CALL gr_fi_ecrit(1,klon,iim,jjmp1,ftsol(:,is_ter),zx_tmp_2d)
+c     CALL gr_fi_ecrit(1,klon,iim,jjmp1,ztsol,zx_tmp_2d)
+c     CALL histwrite(nid_mth,"tsoil",itau_w,zx_tmp_2d,
+c    .               iim*jjmp1,ndex2d)
+c
+      DO i=1, klon
+       zx_tmp_fi2d(i)=SQRT(zu10m(i)*zu10m(i)+zv10m(i)*zv10m(i))
+      ENDDO 
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite(nid_mth,"wind10m",itau_w,zx_tmp_2d,
+     $     iim*jjmp1,ndex2d)
+c
+      DO i = 1, klon
+         zx_tmp_fi2d(i) = pctsrf(i,is_sic)
+      ENDDO
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite(nid_mth,"sicf",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+c     CALL gr_fi_ecrit(klev,klon,iim,jjmp1, t_seri, zx_tmp_3d)
+c     CALL histwrite(nid_mth,"temp",itau_w,zx_tmp_3d,
+c    .                                   iim*jjmp1*klev,ndex3d)
+c
+c ENSEMBLES END
+c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zq2m,zx_tmp_2d)
       CALL histwrite(nid_mth,"q2m",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
@@ -57,4 +99,8 @@
       CALL histwrite(nid_mth,"precip",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, nday_rain,zx_tmp_2d)
+      CALL histwrite(nid_mth,"ndayrain",itau_w,zx_tmp_2d,
+     $               iim*jjmp1,ndex2d)
+c
       DO i = 1, klon
          zx_tmp_fi2d(i) = rain_lsc(i) + snow_lsc(i)
@@ -77,6 +123,7 @@
 c
 cIM: 071003
-      zx_tmp_fi2d(1:klon)=evap(1:klon)*86400.
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
+c     zx_tmp_fi2d(1:klon)=evap(1:klon)*86400.
+c     CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, evap,zx_tmp_2d)
       CALL histwrite(nid_mth,"evap",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
@@ -84,38 +131,141 @@
       CALL histwrite(nid_mth,"tops",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, topsw0,zx_tmp_2d)
+      CALL histwrite(nid_mth,"tops0",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, toplw,zx_tmp_2d)
       CALL histwrite(nid_mth,"topl",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, toplw0,zx_tmp_2d)
+      CALL histwrite(nid_mth,"topl0",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+c     zx_tmp_fi2d(1 : klon) = ZFSUP( 1 : klon, klevp1)
+cIM 080304   zx_tmp_fi2d(1 : klon) = swup ( 1 : klon, 2 )
+      zx_tmp_fi2d(1 : klon) = swup ( 1 : klon, klevp1 )
+      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite(nid_mth, "SWupTOA",itau_w,zx_tmp_2d,
+     .                               iim*jjmp1,ndex2d)
+c
+c
+c      zx_tmp_fi2d(1 : klon) = ZFSUP0( 1 : klon, klevp1)
+cIM 080304   zx_tmp_fi2d(1 : klon) = swup0 ( 1 : klon, 2 )
+      zx_tmp_fi2d(1 : klon) = swup0 ( 1 : klon, klevp1 )
+      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite(nid_mth, "SWupTOAclr",itau_w,zx_tmp_2d,
+     .                               iim*jjmp1,ndex2d)
+c
+c      zx_tmp_fi2d(1 : klon) = ZFSDN( 1 : klon, klevp1)
+cIM 080304   zx_tmp_fi2d(1 : klon) = swdn ( 1 : klon, 2 )
+      zx_tmp_fi2d(1 : klon) = swdn ( 1 : klon, klevp1 )
+      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite(nid_mth, "SWdnTOA",itau_w,zx_tmp_2d,
+     .                               iim*jjmp1,ndex2d)
+c
+c      zx_tmp_fi2d(1 : klon) = ZFSDN0( 1 : klon, klevp1)
+cIM 080304   zx_tmp_fi2d(1 : klon) = swdn0 ( 1 : klon, 2 )
+      zx_tmp_fi2d(1 : klon) = swdn0 ( 1 : klon, klevp1 )
+      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite(nid_mth, "SWdnTOAclr",itau_w,zx_tmp_2d,
+     .                               iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, SWup200,zx_tmp_2d)
+      CALL histwrite(nid_mth,"SWup200",itau_w,zx_tmp_2d,
+     $     iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, SWup200clr,zx_tmp_2d)
+      CALL histwrite(nid_mth,"SWup200clr",itau_w,zx_tmp_2d,
+     $     iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, SWdn200,zx_tmp_2d)
+      CALL histwrite(nid_mth,"SWdn200",itau_w,zx_tmp_2d,
+     $     iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, SWdn200clr,zx_tmp_2d)
+      CALL histwrite(nid_mth,"SWdn200clr",itau_w,zx_tmp_2d,
+     $     iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, LWup200,zx_tmp_2d)
+      CALL histwrite(nid_mth,"LWup200",itau_w,zx_tmp_2d,
+     $     iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, LWup200clr,zx_tmp_2d)
+      CALL histwrite(nid_mth,"LWup200clr",itau_w,zx_tmp_2d,
+     $     iim*jjmp1,ndex2d)
+c
+      zx_tmp_fi2d(1:klon)=-1*LWdn200(1:klon)
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite(nid_mth,"LWdn200",itau_w,zx_tmp_2d,
+     $     iim*jjmp1,ndex2d)
+c
+      zx_tmp_fi2d(1:klon)=-1*LWdn200clr(1:klon)
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite(nid_mth,"LWdn200clr",itau_w,zx_tmp_2d,
+     $     iim*jjmp1,ndex2d)
+c
+c200 END 
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, solsw,zx_tmp_2d)
       CALL histwrite(nid_mth,"sols",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, solsw0,zx_tmp_2d)
+      CALL histwrite(nid_mth,"sols0",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollw,zx_tmp_2d)
       CALL histwrite(nid_mth,"soll",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollwdown,zx_tmp_2d)
-      CALL histwrite(nid_mth,"LWdnSFC",itau_w,zx_tmp_2d,iim*jjmp1,
-     .               ndex2d)
-cIM: 071003
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollw0,zx_tmp_2d)
+      CALL histwrite(nid_mth,"soll0",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+c      zx_tmp_fi2d(1 : klon) = ZFSUP( 1 : klon, 1)
+      zx_tmp_fi2d(1 : klon) = swup ( 1 : klon, 1 )
+      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite(nid_mth, "SWupSFC",itau_w,zx_tmp_2d,
+     .                               iim*jjmp1,ndex2d)
+c
+c      zx_tmp_fi2d(1 : klon) = ZFSUP0( 1 : klon, 1)
+      zx_tmp_fi2d(1 : klon) = swup0 ( 1 : klon, 1 )
+      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite(nid_mth, "SWupSFCclr",itau_w,zx_tmp_2d,
+     .                               iim*jjmp1,ndex2d)
+c
+c      zx_tmp_fi2d(1 : klon) = ZFSDN( 1 : klon, 1)
+      zx_tmp_fi2d(1 : klon) = swdn ( 1 : klon, 1 )
+      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite(nid_mth, "SWdnSFC",itau_w,zx_tmp_2d,
+     .                               iim*jjmp1,ndex2d)
+c
+c      zx_tmp_fi2d(1 : klon) = ZFSDN0( 1 : klon, 1)
+      zx_tmp_fi2d(1 : klon) = swdn0 ( 1 : klon, 1 )
+      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite(nid_mth, "SWdnSFCclr",itau_w,zx_tmp_2d,
+     .                               iim*jjmp1,ndex2d)
+c
       zx_tmp_fi2d(1:klon)=sollw(1:klon)+sollwdown(1:klon)
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d, zx_tmp_2d)
       CALL histwrite(nid_mth,"LWupSFC",itau_w,zx_tmp_2d,iim*jjmp1,
      .               ndex2d)
-cLWupSFC
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, topsw0,zx_tmp_2d)
-      CALL histwrite(nid_mth,"tops0",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, toplw0,zx_tmp_2d)
-      CALL histwrite(nid_mth,"topl0",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, solsw0,zx_tmp_2d)
-      CALL histwrite(nid_mth,"sols0",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollw0,zx_tmp_2d)
-      CALL histwrite(nid_mth,"soll0",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      zx_tmp_fi2d(1:klon)=sollw0(1:klon)+sollwdownclr(1:klon)
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d, zx_tmp_2d)
+      CALL histwrite(nid_mth,"LWupSFCclr",itau_w,zx_tmp_2d,iim*jjmp1,
+     .               ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollwdown,zx_tmp_2d)
+      CALL histwrite(nid_mth,"LWdnSFC",itau_w,zx_tmp_2d,iim*jjmp1,
+     .               ndex2d)
+c
+      DO i=1, klon
+       sollwdownclr(i)=lwdn0(i,1)
+      ENDDO !i=1, klon
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, sollwdownclr,zx_tmp_2d)
+      CALL histwrite(nid_mth,"LWdnSFCclr",itau_w,zx_tmp_2d,
+     $               iim*jjmp1,ndex2d)
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, bils,zx_tmp_2d)
       CALL histwrite(nid_mth,"bils",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, sens,zx_tmp_2d)
+      zx_tmp_fi2d(1:klon)=-1*sens(1:klon)
+c     CALL gr_fi_ecrit(1, klon,iim,jjmp1, sens,zx_tmp_2d)
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
       CALL histwrite(nid_mth,"sens",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
@@ -144,43 +294,6 @@
        CALL histwrite(nid_mth,"fqcalving",itau_w,zx_tmp_2d,iim*jjmp1,
      $                ndex2d)
-c
-
-      DO nsrf = 1, nbsrf
-CYYY
-        zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)
-        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"pourc_"//clnsurf(nsrf),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d) 
-C 
-        zx_tmp_fi2d(1 : klon) = ftsol( 1 : klon, nsrf)
-        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"tsol_"//clnsurf(nsrf),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d)
-C
-        zx_tmp_fi2d(1 : klon) = fluxt( 1 : klon, 1, nsrf)
-        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"sens_"//clnsurf(nsrf),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d)
-C
-        zx_tmp_fi2d(1 : klon) = fluxlat( 1 : klon, nsrf)
-        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"lat_"//clnsurf(nsrf),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d) 
-C
-        zx_tmp_fi2d(1 : klon) = fsollw( 1 : klon, nsrf)
-        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"flw_"//clnsurf(nsrf),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-        zx_tmp_fi2d(1 : klon) = fsolsw( 1 : klon, nsrf)
-        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"fsw_"//clnsurf(nsrf),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d)
-C
-        zx_tmp_fi2d(1 : klon) = wfbils( 1 : klon, nsrf)
-        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
-        CALL histwrite(nid_mth,"wbils_"//clnsurf(nsrf),itau_w,
-     $      zx_tmp_2d,iim*jjmp1,ndex2d)
-C
+cIM: 171003
+       DO nsrf = 1, nbsrf
         zx_tmp_fi2d(1 : klon) = fluxu( 1 : klon, 1, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
@@ -192,5 +305,224 @@
         CALL histwrite(nid_mth,"tauy_"//clnsurf(nsrf),itau_w,
      $      zx_tmp_2d,iim*jjmp1,ndex2d)
+       ENDDO
+cIM: 171003
+c
+cIM      if ( lev_histday.gt.1 ) then
+      DO nsrf = 1, nbsrf
+CYYY
+       IF(nsrf.GT.1) THEN
+        zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)
+        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite(nid_mth,"pourc_"//clnsurf(nsrf),itau_w,
+     $      zx_tmp_2d,iim*jjmp1,ndex2d) 
+       ENDIF !nsrf.GT.1
 C 
+        zx_tmp_fi2d(1 : klon) = ftsol( 1 : klon, nsrf)
+        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite(nid_mth,"tsol_"//clnsurf(nsrf),itau_w,
+     $      zx_tmp_2d,iim*jjmp1,ndex2d)
+C
+        zx_tmp_fi2d(1 : klon) = fluxt( 1 : klon, 1, nsrf)
+        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite(nid_mth,"sens_"//clnsurf(nsrf),itau_w,
+     $      zx_tmp_2d,iim*jjmp1,ndex2d)
+C
+        zx_tmp_fi2d(1 : klon) = fluxlat( 1 : klon, nsrf)
+        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite(nid_mth,"lat_"//clnsurf(nsrf),itau_w,
+     $      zx_tmp_2d,iim*jjmp1,ndex2d) 
+C
+        zx_tmp_fi2d(1 : klon) = fsollw( 1 : klon, nsrf)
+        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite(nid_mth,"flw_"//clnsurf(nsrf),itau_w,
+     $      zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+        zx_tmp_fi2d(1 : klon) = fsolsw( 1 : klon, nsrf)
+        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite(nid_mth,"fsw_"//clnsurf(nsrf),itau_w,
+     $      zx_tmp_2d,iim*jjmp1,ndex2d)
+C
+        zx_tmp_fi2d(1 : klon) = wfbils( 1 : klon, nsrf)
+        CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
+        CALL histwrite(nid_mth,"wbils_"//clnsurf(nsrf),itau_w,
+     $      zx_tmp_2d,iim*jjmp1,ndex2d)
+C
+
+      END DO  
+cIM      endif !lev_histday
+
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cdragm,zx_tmp_2d)
+      CALL histwrite(nid_mth,"cdrm",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cdragh,zx_tmp_2d)
+      CALL histwrite(nid_mth,"cdrh",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldl,zx_tmp_2d)
+      CALL histwrite(nid_mth,"cldl",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldm,zx_tmp_2d)
+      CALL histwrite(nid_mth,"cldm",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldh,zx_tmp_2d)
+      CALL histwrite(nid_mth,"cldh",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldt,zx_tmp_2d)
+      CALL histwrite(nid_mth,"cldt",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldq,zx_tmp_2d)
+      CALL histwrite(nid_mth,"cldq",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      zx_tmp_fi2d(1:klon) = flwp(1:klon)
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite(nid_mth,"lwp",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      zx_tmp_fi2d(1:klon) = fiwp(1:klon)
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
+      CALL histwrite(nid_mth,"iwp",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, ue,zx_tmp_2d)
+      CALL histwrite(nid_mth,"ue",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, ve,zx_tmp_2d)
+      CALL histwrite(nid_mth,"ve",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, uq,zx_tmp_2d)
+      CALL histwrite(nid_mth,"uq",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, vq,zx_tmp_2d)
+      CALL histwrite(nid_mth,"vq",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+cKE43
+      IF (iflag_con.GE.3) THEN ! sb
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cape,zx_tmp_2d)
+      CALL histwrite(nid_mth,"cape",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1,pbase,zx_tmp_2d)
+      CALL histwrite(nid_mth,"pbase",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1,ema_pct,zx_tmp_2d)
+      CALL histwrite(nid_mth,"ptop",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1,ema_cbmf,zx_tmp_2d)
+      CALL histwrite(nid_mth,"fbase",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+c34EK
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, prw,zx_tmp_2d)
+      CALL histwrite(nid_mth,"prw",itau_w,zx_tmp_2d,
+     .               iim*jjmp1,ndex2d)
+c
+      ENDIF !iflag_con.GE.3
+c
+c
+c
+c  Champs interpolles sur des niveaux de pression
+      DO k=1, nlevENS
+c
+        CALL gr_fi_ecrit(1, klon,iim,jjmp1, ulev(:,k),zx_tmp_2d)
+        CALL histwrite(nid_mth,"u"//clev(k),itau_w,zx_tmp_2d,
+     $       iim*jjmp1,ndex2d)
+c
+        CALL gr_fi_ecrit(1, klon,iim,jjmp1, vlev(:,k),zx_tmp_2d)
+        CALL histwrite(nid_mth,"v"//clev(k),itau_w,zx_tmp_2d,
+     $       iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, wlev(:,k),zx_tmp_2d)
+      CALL histwrite(nid_mth,"w"//clev(k),itau_w,zx_tmp_2d,
+     $     iim*jjmp1,ndex2d)
+c
+      CALL gr_fi_ecrit(1, klon,iim,jjmp1, philev(:,k),zx_tmp_2d)
+      CALL histwrite(nid_mth,"phi"//clev(k),itau_w,zx_tmp_2d,
+     $     iim*jjmp1,ndex2d)
+c
+      ENDDO !nlevENS
+      ENDIF !lev_histmth.GE.1
+c
+      IF(lev_histmth.GE.2) THEN
+c
+c Champs 3D:
+C
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, flwc,zx_tmp_3d)
+      CALL histwrite(nid_mth,"lwcon",itau_w,zx_tmp_3d,
+     .               iim*jjmp1*klev,ndex3d)
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, fiwc,zx_tmp_3d)
+      CALL histwrite(nid_mth,"iwcon",itau_w,zx_tmp_3d,
+     .               iim*jjmp1*klev,ndex3d)
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, t_seri, zx_tmp_3d)
+      CALL histwrite(nid_mth,"temp",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
+c
+c#ifdef histmthNMC
+c#include "write_histmthNMC.h"
+c#endif
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, qx(1,1,ivap), zx_tmp_3d)
+      CALL histwrite(nid_mth,"ovap",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
+c
+cIM: 071003
+c     zx_tmp_fi3d(1:klon,1:klev)=qx(1:klon,1:klev,ivap)/
+c    .                         (1-qx(1:klon,1:klev,ivap))
+c     CALL gr_fi_ecrit(klev,klon,iim,jjmp1, zx_tmp_fi3d, zx_tmp_3d)
+c     CALL histwrite(nid_mth,"wvap",itau_w,zx_tmp_3d,
+c    .                                   iim*jjmp1*klev,ndex3d)
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, zphi, zx_tmp_3d)
+      CALL histwrite(nid_mth,"geop",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, u_seri, zx_tmp_3d)
+      CALL histwrite(nid_mth,"vitu",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, v_seri, zx_tmp_3d)
+      CALL histwrite(nid_mth,"vitv",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, omega, zx_tmp_3d)
+      CALL histwrite(nid_mth,"vitw",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, pplay, zx_tmp_3d)
+      CALL histwrite(nid_mth,"pres",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, cldfra, zx_tmp_3d)
+      CALL histwrite(nid_mth,"rneb",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, rnebcon, zx_tmp_3d)
+      CALL histwrite(nid_mth,"rnebcon",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, zx_rh, zx_tmp_3d)
+      CALL histwrite(nid_mth,"rhum",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, wo, zx_tmp_3d)
+      CALL histwrite(nid_mth,"ozone",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
+c
+cIM 22.03.04 BEG
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_t, zx_tmp_3d)
+      CALL histwrite(nid_mth,"dtphy",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_qx(:,:,ivap), 
+     .                 zx_tmp_3d)
+      CALL histwrite(nid_mth,"dqphy",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
+cIM 22.03.04 END
+c
+      ENDIF !lev_histmth.GE.2
+c
+      IF(lev_histmth.GE.3) THEN
+c
+       DO nsrf=1, nbsrf
+c
         zx_tmp_fi2d(1 : klon) = falbe( 1 : klon, nsrf)
         CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d , zx_tmp_2d)
@@ -207,79 +539,25 @@
       CALL histwrite(nid_mth,"ages_"//clnsurf(nsrf),itau_w
      $    ,zx_tmp_2d,iim*jjmp1,ndex2d)
-
-      END DO  
-cXXX      DO i = 1, klon
-cXXX         zx_tmp_fi2d(i) = pctsrf(i,is_sic)
-cXXX      ENDDO
-cXXX      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-cXXX      CALL histwrite(nid_mth,"sicf",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
+      ENDDO !nsrf=1, nbsrf
 c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, albsol,zx_tmp_2d)
       CALL histwrite(nid_mth,"albs",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+c
       CALL gr_fi_ecrit(1, klon,iim,jjmp1, albsollw,zx_tmp_2d)
       CALL histwrite(nid_mth,"albslw",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
 c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cdragm,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cdrm",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cdragh,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cdrh",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldl,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cldl",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldm,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cldm",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldh,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cldh",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldt,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cldt",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cldq,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cldq",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      zx_tmp_fi2d(1:klon) = flwp(1:klon)
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_mth,"lwp",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      zx_tmp_fi2d(1:klon) = fiwp(1:klon)
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_mth,"iwp",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, flwc,zx_tmp_3d)
-      CALL histwrite(nid_mth,"lwcon",itau_w,zx_tmp_3d,
-     .               iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, fiwc,zx_tmp_3d)
-      CALL histwrite(nid_mth,"iwcon",itau_w,zx_tmp_3d,
-     .               iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, ue,zx_tmp_2d)
-      CALL histwrite(nid_mth,"ue",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, ve,zx_tmp_2d)
-      CALL histwrite(nid_mth,"ve",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, uq,zx_tmp_2d)
-      CALL histwrite(nid_mth,"uq",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, vq,zx_tmp_2d)
-      CALL histwrite(nid_mth,"vq",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-cKE43
-      IF (iflag_con .GE. 3) THEN ! sb
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, cape,zx_tmp_2d)
-      CALL histwrite(nid_mth,"cape",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1,pbase,zx_tmp_2d)
-      CALL histwrite(nid_mth,"pbase",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1,ema_pct,zx_tmp_2d)
-      CALL histwrite(nid_mth,"ptop",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1,ema_cbmf,zx_tmp_2d)
-      CALL histwrite(nid_mth,"fbase",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+      ENDIF !lev_histmth.GE.3
+c
+c
+      IF(lev_histmth.GE.4) THEN
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, clwcon0, zx_tmp_3d)
+      CALL histwrite(nid_mth,"clwcon",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
+c
+      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, Ma, zx_tmp_3d)
+      CALL histwrite(nid_mth,"Ma",itau_w,zx_tmp_3d,
+     .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, upwd, zx_tmp_3d)
@@ -295,74 +573,4 @@
      .                                   iim*jjmp1*klev,ndex3d)
 c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, Ma, zx_tmp_3d)
-      CALL histwrite(nid_mth,"Ma",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, prw,zx_tmp_2d)
-      CALL histwrite(nid_mth,"prw",itau_w,zx_tmp_2d,
-     .               iim*jjmp1,ndex2d)
-c
-      ENDIF
-c34EK
-c
-c Champs 3D:
-C
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, t_seri, zx_tmp_3d)
-      CALL histwrite(nid_mth,"temp",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, qx(1,1,ivap), zx_tmp_3d)
-      CALL histwrite(nid_mth,"ovap",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-cIM: 071003
-      zx_tmp_fi3d(1:klon,1:klev)=qx(1:klon,1:klev,ivap)/
-     .                         (1-qx(1:klon,1:klev,ivap))
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, zx_tmp_fi3d, zx_tmp_3d)
-      CALL histwrite(nid_mth,"wvap",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, zphi, zx_tmp_3d)
-      CALL histwrite(nid_mth,"geop",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, u_seri, zx_tmp_3d)
-      CALL histwrite(nid_mth,"vitu",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, v_seri, zx_tmp_3d)
-      CALL histwrite(nid_mth,"vitv",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, omega, zx_tmp_3d)
-      CALL histwrite(nid_mth,"vitw",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, pplay, zx_tmp_3d)
-      CALL histwrite(nid_mth,"pres",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, cldfra, zx_tmp_3d)
-      CALL histwrite(nid_mth,"rneb",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, rnebcon, zx_tmp_3d)
-      CALL histwrite(nid_mth,"rnebcon",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, zx_rh, zx_tmp_3d)
-      CALL histwrite(nid_mth,"rhum",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, clwcon0, zx_tmp_3d)
-      CALL histwrite(nid_mth,"clwcon",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, cldliq, zx_tmp_3d)
-      CALL histwrite(nid_mth,"oliq",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-c
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_t, zx_tmp_3d)
-      CALL histwrite(nid_mth,"dtphy",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
 c
       CALL gr_fi_ecrit(klev,klon,iim,jjmp1, d_t_dyn, zx_tmp_3d)
@@ -504,8 +712,4 @@
       ENDIF
 C
-      CALL gr_fi_ecrit(klev,klon,iim,jjmp1, wo, zx_tmp_3d)
-      CALL histwrite(nid_mth,"ozone",itau_w,zx_tmp_3d,
-     .                                   iim*jjmp1*klev,ndex3d)
-c
       IF (nqmax.GE.3) THEN
       DO iq=1,nqmax-2
@@ -522,77 +726,5 @@
       ENDIF
 c
-c     zx_tmp_fi2d(1 : klon) = ZFSUP( 1 : klon, klevp1)
-      zx_tmp_fi2d(1 : klon) = swup ( 1 : klon, 2 )
-      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_mth, "SWupTOA",itau_w,zx_tmp_2d,
-     .                               iim*jjmp1,ndex2d)
-c
-c      zx_tmp_fi2d(1 : klon) = ZFSUP( 1 : klon, 1)
-      zx_tmp_fi2d(1 : klon) = swup ( 1 : klon, 1 )
-      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_mth, "SWupSFC",itau_w,zx_tmp_2d,
-     .                               iim*jjmp1,ndex2d)
-c
-c      zx_tmp_fi2d(1 : klon) = ZFSDN( 1 : klon, klevp1)
-      zx_tmp_fi2d(1 : klon) = swdn ( 1 : klon, 2 )
-      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_mth, "SWdnTOA",itau_w,zx_tmp_2d,
-     .                               iim*jjmp1,ndex2d)
-c
-c      zx_tmp_fi2d(1 : klon) = ZFSDN( 1 : klon, 1)
-      zx_tmp_fi2d(1 : klon) = swdn ( 1 : klon, 1 )
-      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_mth, "SWdnSFC",itau_w,zx_tmp_2d,
-     .                               iim*jjmp1,ndex2d)
-c
-c      zx_tmp_fi2d(1 : klon) = ZFSUP0( 1 : klon, klevp1)
-      zx_tmp_fi2d(1 : klon) = swup0 ( 1 : klon, 2 )
-      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_mth, "SWupTOAclr",itau_w,zx_tmp_2d,
-     .                               iim*jjmp1,ndex2d)
-c
-c      zx_tmp_fi2d(1 : klon) = ZFSUP0( 1 : klon, 1)
-      zx_tmp_fi2d(1 : klon) = swup0 ( 1 : klon, 1 )
-      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_mth, "SWupSFCclr",itau_w,zx_tmp_2d,
-     .                               iim*jjmp1,ndex2d)
-c
-c      zx_tmp_fi2d(1 : klon) = ZFSDN0( 1 : klon, klevp1)
-      zx_tmp_fi2d(1 : klon) = swdn0 ( 1 : klon, 2 )
-      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_mth, "SWdnTOAclr",itau_w,zx_tmp_2d,
-     .                               iim*jjmp1,ndex2d)
-c
-c      zx_tmp_fi2d(1 : klon) = ZFSDN0( 1 : klon, 1)
-      zx_tmp_fi2d(1 : klon) = swdn0 ( 1 : klon, 1 )
-      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
-      CALL histwrite(nid_mth, "SWdnSFCclr",itau_w,zx_tmp_2d,
-     .                               iim*jjmp1,ndex2d)
-c
-c  Champs interpolles sur des niveaux de pression
-
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, u850,zx_tmp_2d)
-      CALL histwrite(nid_mth,"u850",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, v850,zx_tmp_2d)
-      CALL histwrite(nid_mth,"v850",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, u500,zx_tmp_2d)
-      CALL histwrite(nid_mth,"u500",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, v500,zx_tmp_2d)
-      CALL histwrite(nid_mth,"v500",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, u200,zx_tmp_2d)
-      CALL histwrite(nid_mth,"u200",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, v200,zx_tmp_2d)
-      CALL histwrite(nid_mth,"v200",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, phi500,zx_tmp_2d)
-      CALL histwrite(nid_mth,"phi500",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
-
-      CALL gr_fi_ecrit(1, klon,iim,jjmp1, w500,zx_tmp_2d)
-      CALL histwrite(nid_mth,"w500",itau_w,zx_tmp_2d,iim*jjmp1,ndex2d)
+      ENDIF !lev_histmth.GE.4
 c
       if (ok_sync) then
