Index: /LMDZ4/trunk/libf/dyn3d/etat0_netcdf.F90
===================================================================
--- /LMDZ4/trunk/libf/dyn3d/etat0_netcdf.F90	(revision 1327)
+++ /LMDZ4/trunk/libf/dyn3d/etat0_netcdf.F90	(revision 1328)
@@ -214,5 +214,5 @@
     WRITE(lunout,fmt)int(ocemask)
     ocemask_fi(1)=ocemask(1,1)
-    DO j=2,jjm; ocemask_fi((j-2)*iim+1:iim+1)=ocemask(1:iim,j); END DO
+    DO j=2,jjm; ocemask_fi((j-2)*iim+2:(j-1)*iim+1)=ocemask(1:iim,j); END DO
     ocemask_fi(klon)=ocemask(1,jjp1)
     zmasq=1.-ocemask_fi
Index: /LMDZ4/trunk/libf/dyn3d/limit_netcdf.F90
===================================================================
--- /LMDZ4/trunk/libf/dyn3d/limit_netcdf.F90	(revision 1327)
+++ /LMDZ4/trunk/libf/dyn3d/limit_netcdf.F90	(revision 1328)
@@ -81,10 +81,6 @@
   INTEGER :: NF90_FORMAT
   LOGICAL :: lCPL                    !--- T: IPCC-IPSL cpl model output files
-
-!--- MICS (PHYSICAL KEYS, TIME) ------------------------------------------------
-!  INTEGER, PARAMETER        :: longcles=20
-!  REAL, DIMENSION(longcles) :: clesphy0
-  INTEGER                   :: ndays
-  
+  INTEGER :: ndays                   !--- Depending on the output calendar
+
 !--- INITIALIZATIONS -----------------------------------------------------------
 #ifdef NC_DOUBLE
@@ -94,5 +90,4 @@
 #endif
 
-!  CALL conf_gcm(99, .TRUE., clesphy0)
   pi    = 4.*ATAN(1.)
   rad   = 6371229.
@@ -129,5 +124,5 @@
   WRITE(lunout,*)'Pour la glace de mer a ete choisi un fichier '//TRIM(dumstr)
 
-  CALL get_2Dfield(icefile,'SIC',interbar,ndays,phy_ice,flag=oldice)
+  CALL get_2Dfield(icefile,'SIC',interbar,ndays,phy_ice,flag=oldice,lCPL=lCPL)
 
   ALLOCATE(pctsrf_t(klon,nbsrf,ndays))
@@ -139,5 +134,5 @@
       pctsrf_t(:,is_ter,k)=pctsrf(:,is_ter)       ! land soil
       pctsrf_t(:,is_lic,k)=pctsrf(:,is_lic)       ! land ice
-      IF(lCPL) THEN                              ! SIC=pICE*(1-LIC-TER)
+      IF(lCPL) THEN                               ! SIC=pICE*(1-LIC-TER)
         pctsrf_t(:,is_sic,k)=fi_ice*(1-pctsrf(:,is_lic)-pctsrf(:,is_ter))
       ELSE                                        ! SIC=pICE-LIC
@@ -233,5 +228,5 @@
 
   !--- Variables creation
-  ierr=NF90_DEF_VAR(nid,"TEMPS",NF90_FORMAT,dims,id_tim)
+  ierr=NF90_DEF_VAR(nid,"TEMPS",NF90_FORMAT,(/ntim/),id_tim)
   ierr=NF90_DEF_VAR(nid,"FOCE", NF90_FORMAT,dims,id_FOCE)
   ierr=NF90_DEF_VAR(nid,"FSIC", NF90_FORMAT,dims,id_FSIC)
@@ -257,5 +252,5 @@
 
   !--- Variables saving
-  ierr=NF90_PUT_VAR(nid,id_tim,(/(DBLE(k),k=1,ndays)/))
+  ierr=NF90_PUT_VAR(nid,id_tim,(/(REAL(k),k=1,ndays)/))
   ierr=NF90_PUT_VAR(nid,id_FOCE,pctsrf_t(:,is_oce,:),(/1,1/),(/klon,ndays/))
   ierr=NF90_PUT_VAR(nid,id_FSIC,pctsrf_t(:,is_sic,:),(/1,1/),(/klon,ndays/))
@@ -284,5 +279,5 @@
 !-------------------------------------------------------------------------------
 !
-SUBROUTINE get_2Dfield(fnam, mode, ibar, ndays, champo, flag, mask)
+SUBROUTINE get_2Dfield(fnam, mode, ibar, ndays, champo, flag, mask, lCPL)
 !
 !-------------------------------------------------------------------------------
@@ -312,7 +307,7 @@
   INTEGER,           INTENT(IN)     :: ndays    ! current year number of days
   REAL,    POINTER,  DIMENSION(:,:) :: champo   ! output field = f(t)
-  LOGICAL, OPTIONAL,                      INTENT(IN) :: flag
-! flag=T means:   extrapolation (SST case)  or  old ice (SIC case)
+  LOGICAL, OPTIONAL, INTENT(IN)     :: flag     ! extrapol. (SST)  old ice (SIC)
   REAL,    OPTIONAL, DIMENSION(iim,jjp1), INTENT(IN) :: mask
+  LOGICAL, OPTIONAL, INTENT(IN)     :: lCPL     ! Coupled model flag (for ICE)
 !-------------------------------------------------------------------------------
 ! Local variables:
@@ -397,5 +392,5 @@
   timeyear=mid_months(anneeref,cal_in,lmdep)
   IF(lmdep/=12) WRITE(lunout,'(a,i3,a)')'Note: les fichiers de '//TRIM(mode)   &
-    //' ne comportent pas 12, mais ',lmdep,' renregistrements.'
+    //' ne comportent pas 12, mais ',lmdep,' enregistrements.'
 
 !--- GETTING THE FIELD AND INTERPOLATING IT ------------------------------------
@@ -480,5 +475,5 @@
   IF(mode=='SIC') THEN
     WRITE(lunout,*) 'Filtrage de la SIC: 0.0 < Sea-ice < 1.0'
-    champan(:,:,:)=champan(:,:,:)/100.
+    IF(.NOT.lCPL) champan(:,:,:)=champan(:,:,:)/100.
     champan(iip1,:,:)=champan(1,:,:)
     WHERE(champan>1.0) champan=1.0
@@ -486,5 +481,4 @@
   END IF
 
-write(*,*)'coin1'
 !--- DYNAMICAL TO PHYSICAL GRID ------------------------------------------------
   ALLOCATE(champo(klon,ndays))
@@ -492,7 +486,6 @@
     CALL gr_dyn_fi(1,iip1,jjp1,klon,champan(1,1,k),champo(1,k))
   END DO
-write(*,*)'coin2'
   DEALLOCATE(champan)
-write(*,*)'coin3'
+
 END SUBROUTINE get_2Dfield
 !
Index: /LMDZ4/trunk/libf/dyn3dpar/etat0_netcdf.F90
===================================================================
--- /LMDZ4/trunk/libf/dyn3dpar/etat0_netcdf.F90	(revision 1327)
+++ /LMDZ4/trunk/libf/dyn3dpar/etat0_netcdf.F90	(revision 1328)
@@ -214,5 +214,5 @@
     WRITE(lunout,fmt)int(ocemask)
     ocemask_fi(1)=ocemask(1,1)
-    DO j=2,jjm; ocemask_fi((j-2)*iim+1:iim+1)=ocemask(1:iim,j); END DO
+    DO j=2,jjm; ocemask_fi((j-2)*iim+2:(j-1)*iim+1)=ocemask(1:iim,j); END DO
     ocemask_fi(klon)=ocemask(1,jjp1)
     zmasq=1.-ocemask_fi
Index: /LMDZ4/trunk/libf/dyn3dpar/limit_netcdf.F90
===================================================================
--- /LMDZ4/trunk/libf/dyn3dpar/limit_netcdf.F90	(revision 1327)
+++ /LMDZ4/trunk/libf/dyn3dpar/limit_netcdf.F90	(revision 1328)
@@ -81,10 +81,6 @@
   INTEGER :: NF90_FORMAT
   LOGICAL :: lCPL                    !--- T: IPCC-IPSL cpl model output files
-
-!--- MICS (PHYSICAL KEYS, TIME) ------------------------------------------------
-!  INTEGER, PARAMETER        :: longcles=20
-!  REAL, DIMENSION(longcles) :: clesphy0
-  INTEGER                   :: ndays
-  
+  INTEGER :: ndays                   !--- Depending on the output calendar
+
 !--- INITIALIZATIONS -----------------------------------------------------------
 #ifdef NC_DOUBLE
@@ -94,5 +90,4 @@
 #endif
 
-!  CALL conf_gcm(99, .TRUE., clesphy0)
   pi    = 4.*ATAN(1.)
   rad   = 6371229.
@@ -129,5 +124,5 @@
   WRITE(lunout,*)'Pour la glace de mer a ete choisi un fichier '//TRIM(dumstr)
 
-  CALL get_2Dfield(icefile,'SIC',interbar,ndays,phy_ice,flag=oldice)
+  CALL get_2Dfield(icefile,'SIC',interbar,ndays,phy_ice,flag=oldice,lCPL=lCPL)
 
   ALLOCATE(pctsrf_t(klon,nbsrf,ndays))
@@ -139,5 +134,5 @@
       pctsrf_t(:,is_ter,k)=pctsrf(:,is_ter)       ! land soil
       pctsrf_t(:,is_lic,k)=pctsrf(:,is_lic)       ! land ice
-      IF(lCPL) THEN                              ! SIC=pICE*(1-LIC-TER)
+      IF(lCPL) THEN                               ! SIC=pICE*(1-LIC-TER)
         pctsrf_t(:,is_sic,k)=fi_ice*(1-pctsrf(:,is_lic)-pctsrf(:,is_ter))
       ELSE                                        ! SIC=pICE-LIC
@@ -233,5 +228,5 @@
 
   !--- Variables creation
-  ierr=NF90_DEF_VAR(nid,"TEMPS",NF90_FORMAT,dims,id_tim)
+  ierr=NF90_DEF_VAR(nid,"TEMPS",NF90_FORMAT,(/ntim/),id_tim)
   ierr=NF90_DEF_VAR(nid,"FOCE", NF90_FORMAT,dims,id_FOCE)
   ierr=NF90_DEF_VAR(nid,"FSIC", NF90_FORMAT,dims,id_FSIC)
@@ -257,5 +252,5 @@
 
   !--- Variables saving
-  ierr=NF90_PUT_VAR(nid,id_tim,(/(DBLE(k),k=1,ndays)/))
+  ierr=NF90_PUT_VAR(nid,id_tim,(/(REAL(k),k=1,ndays)/))
   ierr=NF90_PUT_VAR(nid,id_FOCE,pctsrf_t(:,is_oce,:),(/1,1/),(/klon,ndays/))
   ierr=NF90_PUT_VAR(nid,id_FSIC,pctsrf_t(:,is_sic,:),(/1,1/),(/klon,ndays/))
@@ -284,5 +279,5 @@
 !-------------------------------------------------------------------------------
 !
-SUBROUTINE get_2Dfield(fnam, mode, ibar, ndays, champo, flag, mask)
+SUBROUTINE get_2Dfield(fnam, mode, ibar, ndays, champo, flag, mask, lCPL)
 !
 !-------------------------------------------------------------------------------
@@ -312,7 +307,7 @@
   INTEGER,           INTENT(IN)     :: ndays    ! current year number of days
   REAL,    POINTER,  DIMENSION(:,:) :: champo   ! output field = f(t)
-  LOGICAL, OPTIONAL,                      INTENT(IN) :: flag
-! flag=T means:   extrapolation (SST case)  or  old ice (SIC case)
+  LOGICAL, OPTIONAL, INTENT(IN)     :: flag     ! extrapol. (SST)  old ice (SIC)
   REAL,    OPTIONAL, DIMENSION(iim,jjp1), INTENT(IN) :: mask
+  LOGICAL, OPTIONAL, INTENT(IN)     :: lCPL     ! Coupled model flag (for ICE)
 !-------------------------------------------------------------------------------
 ! Local variables:
@@ -397,5 +392,5 @@
   timeyear=mid_months(anneeref,cal_in,lmdep)
   IF(lmdep/=12) WRITE(lunout,'(a,i3,a)')'Note: les fichiers de '//TRIM(mode)   &
-    //' ne comportent pas 12, mais ',lmdep,' renregistrements.'
+    //' ne comportent pas 12, mais ',lmdep,' enregistrements.'
 
 !--- GETTING THE FIELD AND INTERPOLATING IT ------------------------------------
@@ -480,5 +475,5 @@
   IF(mode=='SIC') THEN
     WRITE(lunout,*) 'Filtrage de la SIC: 0.0 < Sea-ice < 1.0'
-    champan(:,:,:)=champan(:,:,:)/100.
+    IF(.NOT.lCPL) champan(:,:,:)=champan(:,:,:)/100.
     champan(iip1,:,:)=champan(1,:,:)
     WHERE(champan>1.0) champan=1.0
@@ -486,5 +481,4 @@
   END IF
 
-write(*,*)'coin1'
 !--- DYNAMICAL TO PHYSICAL GRID ------------------------------------------------
   ALLOCATE(champo(klon,ndays))
@@ -492,7 +486,6 @@
     CALL gr_dyn_fi(1,iip1,jjp1,klon,champan(1,1,k),champo(1,k))
   END DO
-write(*,*)'coin2'
   DEALLOCATE(champan)
-write(*,*)'coin3'
+
 END SUBROUTINE get_2Dfield
 !
