!
! $Header$
!
      IF (ok_isccp) THEN
c
       ndex2d = 0
       ndex3d = 0
c
       itau_w = itau_phy + itap
c
       IF(type_run.EQ."ENSP".OR.type_run.EQ."CLIM") THEN
c
        DO k=1,kmaxm1
         zx_tmp_fi3d(1:klon, 1:lmaxm1)=fq_isccp(1:klon,k,1:lmaxm1)*100.
         CALL gr_fi_ecrit(lmaxm1,klon,iim,jjmp1,zx_tmp_fi3d,
     .                    zx_tmp_3d)
c
cIM: champ 3d : (lon,lat,pres) pour un tau fixe
c
         CALL histwrite(nid_isccp,"cldISCCP_"//taulev(k),itau_w,
     .                  zx_tmp_3d,iim*jjmp1*lmaxm1,ndex3d)
        ENDDO !k
c
        CALL gr_fi_ecrit(1, klon,iim,jjmp1,nbsunlit(1,:),zx_tmp_2d)
        CALL histwrite(nid_isccp,"nsunlit",itau_w,
     .                 zx_tmp_2d,iim*jjmp1,ndex2d)
c
        ELSE IF(type_run.EQ."AMIP".OR.type_run.EQ."CFMI") THEN
c
         DO k=1, kmaxm1
          DO l=1, lmaxm1
c
         zx_tmp_fi2d(1:klon)=fq_isccp(1:klon,k,l)*100.
         CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,
     .                    zx_tmp_2d)
c
cIM: champ 2d : (lon,lat) pour un tau et une pc fixes
c
         CALL histwrite(nid_isccp,pclev(l)//taulev(k),itau_w,
     .                  zx_tmp_2d,iim*jjmp1,ndex2d)
         ENDDO !l
        ENDDO !k
c
        CALL gr_fi_ecrit(1, klon,iim,jjmp1,nbsunlit(1,:),zx_tmp_2d)
        CALL histwrite(nid_isccp,"nsunlit",itau_w,
     .                 zx_tmp_2d,iim*jjmp1,ndex2d)
c
       ENDIF
c
       if (ok_sync) then
        call histsync(nid_isccp)
       endif

      ENDIF !ok_isccp
