c
c $Header$
c
      IF (ok_journe) THEN
c
       zstophy = dtime
       zstoday= ecrit_day
       zout = ecrit_day
c
         idayref = day_ref
         CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)
c
         CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlon,zx_lon)
         DO i = 1, iim
            zx_lon(i,1) = rlon(i+1)
            zx_lon(i,jjmp1) = rlon(i+1)
         ENDDO
         DO ll=1,klev
            znivsig(ll)=float(ll)
         ENDDO
         CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlat,zx_lat)
         CALL histbeg("histday", iim,zx_lon(:,1), jjmp1,zx_lat(1,:),
     .                 1,iim,1,jjmp1, itau_phy, zjulian, dtime, 
     .                 nhori, nid_day)
         CALL histvert(nid_day, "presnivs", "Vertical levels", "mb",
     .                 klev, presnivs/100., nvert)
c
       IF(lev_histday.GE.1) THEN
c
         CALL histdef(nid_day, "phis", "Surface geop. height", "m2/s2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "once", zstophy,zout)
c
         CALL histdef(nid_day, "aire", "Grid area", "-",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "once", zstophy,zout)
c
         CALL histdef(nid_day, "contfracATM","% sfce ter+lic ","-",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "once", zstophy,zout)
c
         CALL histdef(nid_day, "contfracOR","% sfce terre OR", "-",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "once", zstophy,zout)
c
c Champs 2D:
c
         CALL histdef(nid_day, "tsol", "Surface Temperature", "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "t2m", "Temperature 2m", "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
c Champs retires momentannéement en attendant un hypothetique
c debugage

         CALL histdef(nid_day, "t2m_min", "Temp. 2m min.",
     .                "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                t2mincels, zstophy,zout)
c
         CALL histdef(nid_day, "t2m_max", "Temp. 2m max.",
     .                "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                t2maxcels, zstophy,zout)
c
         CALL histdef(nid_day, "plul", "Large-scale Precip.",
     .   "kg/(s*m2)",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "pluc", "Convective Precip.",
     .   "kg/(s*m2)",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "snowl", "Solid Large-scale Precip.",
     .   "kg/(m2*s)",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         IF(1.EQ.0) THEN !snowc=0.
         CALL histdef(nid_day, "snowc", "Solid Convective Precip.",
     .   "kg/(m2*s)",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
         ENDIF !snowc=0.
c
         CALL histdef(nid_day, "flat", "Latent heat flux", "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "sicf", "Sea-ice fraction", "-",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "inst(X)", zstoday,zout)
c
         CALL histdef(nid_day, "q2m", "Specific humidity", "kg/kg",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "u10m", "Vent zonal 10m", "m/s",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "v10m", "Vent meridien 10m", "m/s",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "wind10m","10-m wind speed","m/s",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "wind10max", "10-m wind speed max.",
     .                "m/s",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                t2maxcels, zstophy,zout)
c
         CALL histdef(nid_day, "psol", "Surface Pressure", "Pa",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "precip","Precipitation Totale liq+sol"
     .                , "kg/(s*m2)",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "snowf", "Snow fall", "kg/(m2*s)",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
c        CALL histdef(nid_day, "snow_mass", "Snow Mass", "kg/m2",
c    .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
c    .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "evap", "Evaporation", "kg/(m2*s)",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "tops", "Solar rad. at TOA", "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "topl", "IR rad. at TOA", "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "sols", "Net Solar rad. at surf.", 
     .                "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "soll", "Net IR rad. at surface", "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "cldl", "Low-level cloudiness", "-",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "cldm", "Mid-level cloudiness", "-",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "cldh", "High-level cloudiness", "-",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "cldt", "Total cloudiness", "-",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "cldq", "Cloud liquid water path", 
     .                "kg/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "prw", "Precipitable water", "kg/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
c  Champs dynamiques sur niveaux de pression
c
c        DO k=1, nlevENS
         DO k=1, nlevSTD
c
c        bb=clevSTD(k)
c
         IF(k.GE.2.AND.k.LE.12) bb2=clevSTD(k)
         IF(k.GE.13.AND.k.LE.17) bb3=clevSTD(k)
c         aa=clevSTD(k)
c         bb2=clevSTD(k)
c        ENDIF
c
         IF(bb2.EQ."850".OR.bb2.EQ."700"
     .   .OR.bb2.EQ."500".OR.bb2.EQ."200") THEN
c
          CALL histdef(nid_day, "u"//bb2,
     .                 "Zonal wind "//bb2//"mb","m/s",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "inst(X)", zout,zout)
c
          CALL histdef(nid_day, "v"//bb2,
     .                 "Meridional wind "//bb2//"mb","m/s",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "inst(X)", zout,zout)
c
         ENDIF !(bb2.EQ."850".OR.bb2.EQ."700".OR.bb2.EQ."500".OR.bb2.EQ."200") THEN
c
         IF(bb2.EQ."500") THEN
c
         CALL histdef(nid_day, "w"//bb2, "Vertical wind "//bb2//"mb",
     .                "m/s",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "inst(X)", zout,zout)
c
         CALL histdef(nid_day,"phi"//bb2, "Geopotential "//bb2//"mb",
     .                "m",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "inst(X)", zout,zout)
c
         ENDIF !(bb2.EQ."500")
c
         ENDDO !nlevSTD
c
         CALL histdef(nid_day, "slp", "Sea Level Pressure", "Pa",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "cape_max", "CAPE max.",
     .                "J/kg",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                capemaxcels, zstophy,zout)
c
         CALL histdef(nid_day, "solldown", "Down. IR rad. at surface", 
     .                "W/m2", iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "sens", "Sensible heat flux", "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "SWdnSFC", "SWdn at surface","W/m2",
     .                iim,jjmp1,nhori, 1,1,1,-99,
     .                32, "ave(X)", zstophy,zout)
c
cIM diagnostiques flux ocean-atm ou ocean-glace de mer
cIM pour utilisation dans un modele de "slab" ocean
c
         IF (OCEAN.EQ.'force ') THEN
c
          CALL histdef(nid_day, "lmt_bils", 
     .         "Bilan au sol atmosphere forcee", "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         ELSE IF (OCEAN.EQ.'slab  ') THEN
c
          CALL histdef(nid_day, "slab_bils",
     .                "Bilan au sol slab", "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
          CALL histdef(nid_day, "tslab", "Slab SST ", "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
          CALL histdef(nid_day, "seaice", "Slab seaice", "kg/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
          CALL histdef(nid_day, "siceh", "Slab seaice height", "m",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         ENDIF !OCEAN.EQ.force/slab
c
         CALL histdef(nid_day, "fluxo",
     .                "Flux turbulents ocean-atmosphere", "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "fluxg",
     .                "Flux ocean-glace de mer", "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
      ENDIF !lev_histday.GE.1
c
      IF (lev_histday.GE.2) THEN
c
         CALL histdef(nid_day, "bils", "Surf. total heat flux", "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "fder", "Heat flux derivation", "W/m2/K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
      ENDIF !lev_histday.GE.2
c=================================================================
      IF(lev_histday.GE.3) THEN
c=================================================================
c   INITIALISATION DES CHAMPS 3D
c=================================================================
c=================================================================
c=================================================================
c Champs 3D:
c
         CALL histdef(nid_day, "temp", "Air temperature", "K",
     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "ovap", "Specific humidity", "kg/kg",
     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "geop", "Geopotential height", "m2/s2",
     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "vitu", "Zonal wind", "m/s",
     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "vitv", "Meridional wind", "m/s",
     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "vitw", "Vertical wind", "m/s",
     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "pres", "Air pressure", "Pa",
     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
     .                "ave(X)", zstophy,zout)
c
c=================================================================
c   FIN INITIALISATION DES CHAMPS 3D
c=================================================================
      ENDIF !  lev_histday.GE.3
c
      IF (lev_histday.GE.4) THEN
c=================================================================
c
c   INITIALISATION DES CHAMPS SUR LES SOUS SURFACES
c
c=================================================================
c
         CALL histdef(nid_day, "SWupTOA", "SWup at TOA","W/m2",
     .                iim,jjmp1,nhori, 1,1,1,-99,
     .                32, "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "SWupSFC", "SWup at surface","W/m2",
     .                iim,jjmp1,nhori, 1,1,1,-99,
     .                32, "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "SWdnTOA", "SWdn at TOA","W/m2",
     .                iim,jjmp1,nhori, 1,1,1,-99,
     .                32, "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "SWupTOAclr",
     .                "SWup clear sky at TOA","W/m2",
     .                iim,jjmp1,nhori, 1,1,1,-99,
     .                32, "ave(X)", zstophy,zout)

         CALL histdef(nid_day, "SWupSFCclr",
     .                "SWup clear sky at surface","W/m2",
     .                iim,jjmp1,nhori, 1,1,1,-99,
     .                32, "ave(X)", zstophy,zout)

         CALL histdef(nid_day, "SWdnTOAclr",
     .                "SWdn clear sky at TOA","W/m2",
     .                iim,jjmp1,nhori, 1,1,1,-99,
     .                32, "ave(X)", zstophy,zout)

         CALL histdef(nid_day, "SWdnSFCclr",
     .                "SWdn clear sky at surface","W/m2",
     .                iim,jjmp1,nhori, 1,1,1,-99,
     .                32, "ave(X)", zstophy,zout)
c
c=================================================================
c=================================================================
c=================================================================
c   INITIALISATION DES CHAMPS SUR LES SOUS SURFACES
c=================================================================
c
         CALL histdef(nid_day, "tter", "Surface Temperature ter", "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "tlic", "Surface Temperature lic", "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "toce", "Surface Temperature oce", "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "tsic", "Surface Temperature sic", "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "t2mter", "Temp.tere 2m", "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "t2mlic", "Temp.lic 2m", "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "t2moce", "Temp.oce 2m", "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "t2msic", "Temp.sic 2m", "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "t2mter_min", "Temp.terre 2m min.",
     .                "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                t2mincels, zstophy,zout)
c
         CALL histdef(nid_day, "t2mter_max", "Temp.terre 2m max.",
     .                "K",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                t2maxcels, zstophy,zout)
c
         CALL histdef(nid_day, "u10mter", "Vent zonal ter 10m", "m/s",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "u10mlic", "Vent zonal lic 10m", "m/s",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "u10moce", "Vent zonal oce 10m", "m/s",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "u10msic", "Vent zonal sic 10m",
     .                 "m/s",iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "v10mter", "Vent meridien ter 10m", 
     .                "m/s", iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "v10mlic", "Vent meridien lic 10m",
     .                 "m/s",iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "v10moce", "Vent meridien oce 10m",
     .                 "m/s",iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "v10msic", "Vent meridien sic 10m",
     .                 "m/s",iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         DO nsrf = 1, nbsrf
C
           call histdef(nid_day, "pourc_"//clnsurf(nsrf), 
     $         "% "//clnsurf(nsrf), "%",  
     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
     $         "ave(X)", zstophy,zout)
C
           call histdef(nid_day, "fract_"//clnsurf(nsrf), 
     $         "Fraction "//clnsurf(nsrf), "1",  
     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
     $         "ave(X)", zstophy,zout)
C
           call histdef(nid_day, "tsol_"//clnsurf(nsrf), 
     $         "Temperature "//clnsurf(nsrf), "K",  
     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
     $         "ave(X)", zstophy,zout)
C
           call histdef(nid_day, "sens_"//clnsurf(nsrf), 
     $         "Sensible heat flux "//clnsurf(nsrf), "W/m2",  
     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
     $         "ave(X)", zstophy,zout)
c
           call histdef(nid_day, "lat_"//clnsurf(nsrf), 
     $         "Latent heat flux "//clnsurf(nsrf), "W/m2",  
     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
     $         "ave(X)", zstophy,zout)
C
           call histdef(nid_day, "taux_"//clnsurf(nsrf), 
     $         "Zonal wind stress "//clnsurf(nsrf),"Pa",
     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
     $         "ave(X)", zstophy,zout)

           call histdef(nid_day, "tauy_"//clnsurf(nsrf), 
     $         "Meridional wind stress "//clnsurf(nsrf), "Pa",  
     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
     $         "ave(X)", zstophy,zout)
C
           call histdef(nid_day, "albe_"//clnsurf(nsrf), 
     $         "Albedo surf. "//clnsurf(nsrf), "-",  
     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
     $         "ave(X)", zstophy,zout)
C
           call histdef(nid_day, "rugs_"//clnsurf(nsrf), 
     $         "Rugosite "//clnsurf(nsrf), "m",  
     $         iim,jjmp1,nhori, 1,1,1, -99, 32,
     $         "ave(X)", zstophy,zout)
C
         END DO 
C           
c=================================================================
c
c   FIN INITIALISATION DES CHAMPS SUR LES SOUS SURFACES
c
c=================================================================
      ENDIF !lev_histday.GE.4
c
      IF(lev_histday.GE.5) THEN !lev_histday.GE.5
c
c rajout sorties F. Aires
         CALL histdef(nid_day, "tops0", "CS Solar rad. at TOA", 
     .                "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "topl0", "CS IR rad. at TOA", 
     .                "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "sols0", "CS Net Solar rad. at surf.", 
     .                "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32, 
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "soll0", "CS Net IR rad. at surface", 
     .                "W/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "rneb", "Cloud fraction", "-",
     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day, "rnebcon", "Convective Cloud Fraction"
     .                , "-",
     .                iim,jjmp1,nhori, klev,1,klev,nvert, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day,"lwcon","Cloud liquid water content",
     .                "kg/kg",
     .                iim,jjmp1,nhori, klev,1,klev, nvert, 32,
     .                "ave(X)", zstophy,zout)
c
        CALL histdef(nid_day,"iwcon","Cloud ice water content","kg/kg",
     .                iim,jjmp1,nhori, klev,1,klev, nvert, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day,"lwp","Cloud water path","kg/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
         CALL histdef(nid_day,"iwp","Cloud ice water path","kg/m2",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
        CALL histdef(nid_day,"meantaucld",
     .                "ISCCP mean cloud optical thickness","1",
     .                iim,jjmp1,nhori, 1,1,1, -99, 32,
     .                "ave(X)", zstophy,zout)
c
        CALL histdef(nid_day,"cldtau","Cloud optical thickness","1",
     .                iim,jjmp1,nhori, klev,1,klev, nvert, 32,
     .                "ave(X)", zstophy,zout)
c
        CALL histdef(nid_day,"cldemi","Cloud optical emissivity","1",
     .                iim,jjmp1,nhori, klev,1,klev, nvert, 32,
     .                "ave(X)", zstophy,zout)
c
      ENDIF !lev_histday.GE.5
c=================================================================
c
         CALL histend(nid_day)
c
         ndex2d = 0
         ndex3d = 0
c
c=================================================================
      ENDIF ! fin de test sur ok_journe
