Index: LMDZ.3.3/branches/rel-LF/libf/phylmd/ini_histmth.h
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/phylmd/ini_histmth.h	(revision 486)
+++ LMDZ.3.3/branches/rel-LF/libf/phylmd/ini_histmth.h	(revision 506)
@@ -1,3 +1,18 @@
       IF (ok_mensuel) THEN
+c
+        IF(region.EQ.'3d') THEN
+         zsto = dtime
+         zout = dtime * ecrit_mth
+c
+c zsto1: pour des valeurs "instantannees" mensuelles
+         zsto1 = dtime * ecrit_mth
+c zsto2: pour des flux radiatifs calcules tous les 2 heures
+         zsto2 = dtime * radpas
+         PRINT*,' zsto,zsto1,zsto2,zout=',zsto, zsto1, zsto2,zout
+        ELSEIF(region.EQ.'1d') THEN
+          zsto = dtime
+c         zout = dtime
+          zout = dtime *4.
+        ENDIF
 c
          idayref = day_ref
@@ -14,5 +29,10 @@
          CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlat,zx_lat)
          CALL histbeg("histmth.nc", iim,zx_lon(:,1), jjmp1,zx_lat(1,:),
-     .                 1,iim,1,jjmp1, itau_phy, zjulian, dtime, 
+c071103
+c    .                 1,iim,1,jjmp1, 
+     .                 imin_debut,nbpti,
+     .                 jmin_debut,nbptj,
+c071103
+     .                 itau_phy, zjulian, dtime, 
      .                 nhori, nid_mth)
          write(*,*)'Mensuel ', itau_phy, zjulian
@@ -22,7 +42,6 @@
 c    .              klev, znivsig, nvert)
 c
-         zsto = dtime
-         zout = dtime * ecrit_mth
-c
+c
+      IF(lev_histmth.GE.1) THEN
          CALL histdef(nid_mth, "phis", "Surface geop. height", "-",
      .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
@@ -33,4 +52,9 @@
      .                "once",  zsto,zout)
 c
+           call histdef(nid_mth, "pourc_"//clnsurf(is_ter), 
+     $         "Fraction "//clnsurf(is_ter), "W/m2",  
+     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
+     $         "once", zsto,zout)
+c
 c Champs 2D:
 c
@@ -46,5 +70,30 @@
      .                iim,jjmp1,nhori, 1,1,1, -99, 32,
      .                "ave(X)", zsto,zout)
-c
+c ENSEMBLES BEG
+         CALL histdef(nid_mth, "t2m_min", "Temp. 2m min.",
+     .                "K",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                t2mincels, zsto,zout)
+c
+         CALL histdef(nid_mth, "t2m_max", "Temp. 2m max.",
+     .                "K",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                t2maxcels, zsto,zout)
+c
+c        CALL histdef(nid_mth, "tsoil", "Sfce soil Temperature",
+c    .                "K",
+c    .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+c    .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "wind10m","10-m wind speed","m/s",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "sicf", "Sea-ice fraction", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+
+c
+c ENSEMBLES END
          CALL histdef(nid_mth, "q2m", "Specific humidity 2m", "Kg/Kg",
      .                iim,jjmp1,nhori, 1,1,1, -99, 32,
@@ -58,5 +107,4 @@
      .                iim,jjmp1,nhori, 1,1,1, -99, 32,
      .                "ave(X)", zsto,zout)
-c
 c
          CALL histdef(nid_mth, "psol", "Surface Pressure", "Pa",
@@ -74,28 +122,35 @@
       endif
 c
+         CALL histdef(nid_mth, "ndayrain", 
+     .                "Number of day with rain (liq+sol)", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "inst(X)", zsto1,zout)
+c
          CALL histdef(nid_mth, "precip", "Precipitation Totale liq+sol", 
-     .                "kg/(s*m2)",
+     .                "Kg/(s*m2)",
      .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
      .                "ave(X)", zsto,zout)
 c
          CALL histdef(nid_mth, "plul", "Large-scale Precip.", 
-     .   "kg/(s*m2)",
+     .   "Kg/(s*m2)",
      .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
      .                "ave(X)", zsto,zout)
 c
          CALL histdef(nid_mth, "pluc", "Convective Precip.", 
-     .   "kg/(s*m2)",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "snow", "Snow fall", "kg/(s*m2)",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "snow_mass", "Snow Mass", "kg/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "evap", "Evaporation", "kg/(s*m2)",
+     .   "Kg/(s*m2)",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "snow", "Snow fall", "Kg/(s*m2)",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "snow_mass", "Snow Mass", "Kg/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+cIM: 071003 evap(Kg/m2/s) ==> evap(mm/day)
+        CALL histdef(nid_mth, "evap", "Evaporation", "kg/(s*m2)",
+c       CALL histdef(nid_mth, "evap", "Evaporation", "mm/day", 
      .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
      .                "ave(X)", zsto,zout)
@@ -105,39 +160,121 @@
      .                "ave(X)", zsto,zout)
 c
+         CALL histdef(nid_mth, "tops0", "Solar rad. at TOA", "W/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
          CALL histdef(nid_mth, "topl", "IR rad. at TOA", "W/m2",
      .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
      .                "ave(X)", zsto,zout)
 c
+         CALL histdef(nid_mth, "topl0", "IR rad. at TOA", "W/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "SWupTOA", "SWup at TOA","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth, "SWupTOAclr", 
+     .                "SWup clear sky at TOA","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth, "SWdnTOA", "SWdn at TOA","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth, "SWdnTOAclr", 
+     .                "SWdn clear sky at TOA","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth, "SWup200", "SWup at 200hPa","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth, "SWup200clr", 
+     .                "SWup clear sky at 200hPa","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth, "SWdn200", "SWdn at 200hPa","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth, "SWdn200clr", 
+     .                "SWdn clear sky at 200hPa","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth, "LWup200", "LWup at 200hPa","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth, "LWup200clr", 
+     .                "LWup clear sky at 200hPa","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth, "LWdn200", "LWdn at 200hPa","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth, "LWdn200clr", 
+     .                "LWdn clear sky at 200hPa","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
          CALL histdef(nid_mth, "sols", "Solar rad. at surf.", "W/m2",
      .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
      .                "ave(X)", zsto,zout)
 c
+         CALL histdef(nid_mth, "sols0", "Solar rad. at surf.", "W/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
          CALL histdef(nid_mth, "soll", "IR rad. at surface", "W/m2",
      .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
      .                "ave(X)", zsto,zout)
-cIM: 071003
+c
+         CALL histdef(nid_mth, "soll0", "IR rad. at surface", "W/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "SWupSFC", "SWup at surface","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth, "SWupSFCclr", 
+     .                "SWup clear sky at surface","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth, "SWdnSFC", "SWdn at surface","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth, "SWdnSFCclr", 
+     .                "SWdn clear sky at surface","W/m2",
+     .                iim,jjmp1,nhori, 1,1,1,-99,
+     .                32, "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth,"LWupSFC","Upwd. IR rad. at surface", 
+     .                "W/m2", iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto2,zout)
+c
          CALL histdef(nid_mth,"LWdnSFC","Down. IR rad. at surface", 
      .                "W/m2", iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-cIM: 071003
-         CALL histdef(nid_mth,"LWupSFC","Upwd. IR rad. at surface", 
+     .                "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth,"LWupSFCclr",
+     .                "CS Upwd. IR rad. at surface", 
      .                "W/m2", iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "tops0", "Solar rad. at TOA", "W/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "topl0", "IR rad. at TOA", "W/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "sols0", "Solar rad. at surf.", "W/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "soll0", "IR rad. at surface", "W/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
+     .                "ave(X)", zsto2,zout)
+c
+         CALL histdef(nid_mth,"LWdnSFCclr",
+     .                "Down. CS IR rad. at surface", 
+     .                "W/m2", iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto2,zout)
 c
          CALL histdef(nid_mth, "bils", "Surf. total heat flux", "W/m2",
@@ -166,13 +303,29 @@
 c
          CALL histdef(nid_mth, "fqcalving","Ice Calving",
-     .                "kg/m2/s",iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
+     .                "Kg/m2/s",iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+cIM: 171003
+         DO nsrf = 1, nbsrf
+           call histdef(nid_mth, "taux_"//clnsurf(nsrf), 
+     $         "Zonal wind stress"//clnsurf(nsrf), "Pa",  
+     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
+     $         "ave(X)", zsto,zout)
+
+           call histdef(nid_mth, "tauy_"//clnsurf(nsrf), 
+     $         "Meridional xind stress "//clnsurf(nsrf), "Pa",  
+     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
+     $         "ave(X)", zsto,zout)
+         ENDDO
+cIM: 171003
+c
+cIM       if ( lev_histday.gt.1 ) then
          DO nsrf = 1, nbsrf
 C
+          IF(nsrf.GT.1) THEN
            call histdef(nid_mth, "pourc_"//clnsurf(nsrf), 
      $         "Fraction "//clnsurf(nsrf), "W/m2",  
      $         iim,jjmp1,nhori, 1,1,1, -99, 32,
      $         "ave(X)", zsto,zout)
+          ENDIF !nsrf.GT.1
 C
            call histdef(nid_mth, "tsol_"//clnsurf(nsrf), 
@@ -194,10 +347,10 @@
      $         "LW "//clnsurf(nsrf), "W/m2",
      $         iim,jjmp1,nhori, 1,1,1, -99, 32,
-     $         "ave(X)", zsto,zout)
+     $         "ave(X)", zsto2,zout)
 c
            call histdef(nid_mth, "fsw_"//clnsurf(nsrf),
      $         "SW "//clnsurf(nsrf), "W/m2",
      $         iim,jjmp1,nhori, 1,1,1, -99, 32,
-     $         "ave(X)", zsto,zout)
+     $         "ave(X)", zsto2,zout)
 C
            call histdef(nid_mth, "wbils_"//clnsurf(nsrf),
@@ -206,13 +359,194 @@
      $         "ave(X)", zsto,zout)
 C
-           call histdef(nid_mth, "taux_"//clnsurf(nsrf), 
-     $         "Zonal wind stress"//clnsurf(nsrf), "Pa",  
-     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
-     $         "ave(X)", zsto,zout)
-
-           call histdef(nid_mth, "tauy_"//clnsurf(nsrf), 
-     $         "Meridional xind stress "//clnsurf(nsrf), "Pa",  
-     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
-     $         "ave(X)", zsto,zout)
+         END DO
+cIM         endif !lev_histday
+c
+         CALL histdef(nid_mth, "cdrm", "Momentum drag coef.", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "cdrh", "Heat drag coef.", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "cldl", "Low-level cloudiness", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "cldm", "Mid-level cloudiness", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "cldh", "High-level cloudiness", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "cldt", "Total cloudiness", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth,"cldq","Cloud liquid water path","Kg/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+cIM: 071003
+         CALL histdef(nid_mth,"lwp","Cloud water path","Kg/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth,"iwp","Cloud ice water path","Kg/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+cIM: 071003
+c
+         CALL histdef(nid_mth, "ue", "Zonal energy transport", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "ve", "Merid energy transport", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "uq", "Zonal humidity transport", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "vq", "Merid humidity transport", "-",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
+     .                "ave(X)", zsto,zout)
+cKE43
+      IF(iflag_con.GE.3) THEN ! sb
+c
+         CALL histdef(nid_mth, "cape", "Conv avlbl pot ener", "J/Kg",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "pbase", "Cld base pressure", "hPa",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "ptop", "Cld top pressure", "hPa",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "fbase", "Cld base mass flux", "Kg/m2/s",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "prw", "Precipitable water", "Kg/m2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+      ENDIF !iflag_con .GE. 3
+c34EK
+c
+c Champs interpolles sur des niveaux de pression
+         DO k=1, nlevENS
+          CALL histdef(nid_mth, "u"//clev(k),
+     .                 "Zonal wind"//clev(k)//"mb","m/s",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+          CALL histdef(nid_mth, "v"//clev(k),
+     .                 "Meridional wind"//clev(k)//"mb","m/s",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+          CALL histdef(nid_mth, "w"//clev(k),
+     .                 "Vertical wind"//clev(k)//"mb","m/s",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+          CALL histdef(nid_mth, "phi"//clev(k),
+     .                 "Geopotential"//clev(k)//"mb","m2/s2",
+     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
+c
+         ENDDO
+      ENDIF !lev_histmth.GE.1
+c
+      IF(lev_histmth.GE.2) THEN
+c
+c Champs 3D:
+c
+c
+         CALL histdef(nid_mth,"lwcon","Cloud water content","Kg/Kg",
+     .                iim,jjmp1,nhori, klev,1,klev, nvert, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth,"iwcon","Cloud ice water content","Kg/Kg",
+     .                iim,jjmp1,nhori, klev,1,klev, nvert, 32, 
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "temp", "Air temperature", "K",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "ovap", "Specific humidity", "Kg/Kg",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+c        CALL histdef(nid_mth,"wvap","Water vapor mixing ratio","Kg/Kg",
+c    .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+c    .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "geop", "Geopotential height", "m",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "vitu", "Zonal wind", "m/s",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "vitv", "Meridional wind", "m/s",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "vitw", "Vertical wind", "m/s",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "pres", "Air pressure", "Pa",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+        CALL histdef(nid_mth, "rneb", "Cloud fraction", "-",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "rnebcon", "Convective Cloud Fraction"
+     .                , "-",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "rhum", "Relative humidity", "-",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "ozone", "Ozone concentration", "-",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "upwd", "saturated updraft", "Kg/m2/s",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "dtphy", "Physics dT", "K/s",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "dqphy", "Physics dQ", "Kg/Kg/s",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+c#define histmthNMC
+c#ifdef histmthNMC
+c#include "ini_histmthNMC.h"
+c#endif
+c
+      ENDIF !lev_histmth.GE.2
+c
+      IF(lev_histmth.GE.3) THEN
+c
+        DO nsrf=1, nbsrf
 c
            call histdef(nid_mth, "albe_"//clnsurf(nsrf), 
@@ -229,10 +563,6 @@
      .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
      .                "ave(X)", zsto,zout)
-
-         END DO
-C
-c        CALL histdef(nid_mth, "sicf", "Sea-ice fraction", "-",
-c    .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-c    .                "ave(X)", zsto,zout)
+c
+	 ENDDO !nsrf=1, nbsrf
 c
          CALL histdef(nid_mth, "albs", "Surface albedo", "-",
@@ -243,84 +573,15 @@
      .                "ave(X)", zsto,zout)
 c
-         CALL histdef(nid_mth, "cdrm", "Momentum drag coef.", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "cdrh", "Heat drag coef.", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "cldl", "Low-level cloudiness", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "cldm", "Mid-level cloudiness", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "cldh", "High-level cloudiness", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "cldt", "Total cloudiness", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth,"cldq","Cloud liquid water path","Kg/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-cIM: 071003
-         CALL histdef(nid_mth,"lwp","Cloud water path","Kg/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth,"iwp","Cloud ice water path","Kg/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-cIM: 071003
-         CALL histdef(nid_mth,"lwcon","Cloud water content","Kg/Kg",
-     .                iim,jjmp1,nhori, klev,1,klev, nvert, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth,"iwcon","Cloud ice water content","Kg/Kg",
-     .                iim,jjmp1,nhori, klev,1,klev, nvert, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "ue", "Zonal energy transport", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "ve", "Merid energy transport", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "uq", "Zonal humidity transport", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "vq", "Merid humidity transport", "-",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
-     .                "ave(X)", zsto,zout)
-cKE43
-      IF (iflag_con .GE. 3) THEN ! sb
-c
-         CALL histdef(nid_mth, "cape", "Conv avlbl pot ener", "J/Kg",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "pbase", "Cld base pressure", "hPa",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "ptop", "Cld top pressure", "hPa",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "fbase", "Cld base mass flux", "Kg/m2/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-c
-         CALL histdef(nid_mth, "upwd", "saturated updraft", "Kg/m2/s",
+      ENDIF !lev_histmth.GE.3
+c
+      IF(lev_histmth.GE.4) THEN
+c
+         CALL histdef(nid_mth, "clwcon", 
+     .                "Convective Cloud Liquid water content"
+     .                , "Kg/Kg",
+     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
+     .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth,"Ma","undilute adiab updraft","Kg/m2/s",
      .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
      .                "ave(X)", zsto,zout)
@@ -331,75 +592,4 @@
 c
          CALL histdef(nid_mth, "dnwd0", "unsat. downdraft", "Kg/m2/s",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth,"Ma","undilute adiab updraft","Kg/m2/s",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "prw", "Precipitable water", "kg/m2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-      ENDIF
-c34EK
-c
-c Champs 3D:
-c
-         CALL histdef(nid_mth, "temp", "Air temperature", "K",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "ovap", "Specific humidity", "Kg/Kg",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-cIM: 071003
-         CALL histdef(nid_mth,"wvap","Water vapor mixing ratio","Kg/Kg",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "geop", "Geopotential height", "m",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "vitu", "Zonal wind", "m/s",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "vitv", "Meridional wind", "m/s",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "vitw", "Vertical wind", "m/s",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "pres", "Air pressure", "Pa",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "rneb", "Cloud fraction", "-",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "rnebcon", "Convective Cloud Fraction"
-     .                , "-",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "rhum", "Relative humidity", "-",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "clwcon", "Cloud Liquid water content"
-     .                , "kg/kg",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "oliq", "Liquid water content", "kg/kg",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "dtphy", "Physics dT", "K/s",
      .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
      .                "ave(X)", zsto,zout)
@@ -519,8 +709,4 @@
          ENDIF
 C
-         CALL histdef(nid_mth, "ozone", "Ozone concentration", "-",
-     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
-     .                "ave(X)", zsto,zout)
-c
          if (nqmax.GE.3) THEN
          DO iq=1,nqmax-2
@@ -537,73 +723,5 @@
          ENDIF
 c
-         CALL histdef(nid_mth, "SWupTOA", "SWup at TOA","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "SWupSFC", "SWup at surface","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "SWdnTOA", "SWdn at TOA","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "SWdnSFC", "SWdn at surface","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "SWupTOAclr", 
-     .                "SWup clear sky at TOA","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "SWupSFCclr", 
-     .                "SWup clear sky at surface","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "SWdnTOAclr", 
-     .                "SWdn clear sky at TOA","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "SWdnSFCclr", 
-     .                "SWdn clear sky at surface","W/m2",
-     .                iim,jjmp1,nhori, 1,1,1,-99,
-     .                32, "ave(X)", zsto,zout)
-
-c Champs interpolles sur des niveaux de pression
-
-         CALL histdef(nid_mth, "u850", "Zonal wind 850mb", "m/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-
-         CALL histdef(nid_mth, "v850", "Meridional wind 850mb", "m/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-c
-         CALL histdef(nid_mth, "u500", "Zonal wind 500mb", "m/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-
-         CALL histdef(nid_mth, "v500", "Meridional wind 500mb", "m/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-
-         CALL histdef(nid_mth, "u200", "Zonal wind 200mb", "m/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-
-         CALL histdef(nid_mth, "v200", "Meridional wind 200mb", "m/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-
-         CALL histdef(nid_mth, "phi500","Geopotentiel à 500mb","m2/s2",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
-
-         CALL histdef(nid_mth, "w500", "Vertical wind 500mb", "Pa/s",
-     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
-     .                "ave(X)", zsto,zout)
+      ENDIF !lev_histmth.GE.4
 c
          CALL histend(nid_mth)
