Index: /LMDZ.3.3/branches/rel-LF/libf/dyn3d/limit_netcdf.F
===================================================================
--- /LMDZ.3.3/branches/rel-LF/libf/dyn3d/limit_netcdf.F	(revision 404)
+++ /LMDZ.3.3/branches/rel-LF/libf/dyn3d/limit_netcdf.F	(revision 405)
@@ -123,4 +123,9 @@
       character*30 namedim
       CHARACTER*80 :: varname
+
+cIM28/02/2002 <== PM
+      REAL tmidmonth(12)
+      SAVE tmidmonth
+      DATA tmidmonth/15,45,75,105,135,165,195,225,255,285,315,345/
 
 c initialisations:
@@ -443,11 +448,30 @@
 c
       PRINT*, 'Traitement de la glace oceanique'
-      ierr = NF_OPEN('AMIP.nc', NF_NOWRITE, ncid)
-      if (ierr.ne.0) then
-        print *, NF_STRERROR(ierr)
-        STOP
-      ENDIF
-
-      ierr = NF_INQ_VARID(ncid,'SEA_ICE',varid)
+c
+
+cccIM#define cond_climato
+
+#ifdef cond_climato
+
+cIM22/02/2002
+cIM   ierr = NF_OPEN('AMIP.nc', NF_NOWRITE, ncid)
+cIM   ierr = NF_OPEN('amip79to95.nc', NF_NOWRITE, ncid)
+      ierr = NF_OPEN('amipbc_sic_1x1_clim.nc', NF_NOWRITE, ncid)
+#else
+      ierr = NF_OPEN('amipbc_sic_1x1.nc', NF_NOWRITE, ncid)
+#endif
+
+cIM22/02/2002
+      if (ierr.ne.0) then
+        print *, NF_STRERROR(ierr)
+        STOP
+      ENDIF
+
+cIM22/02/2002
+cIM07/03/2002 AMIP.nc & amip79to95.nc
+cIM   ierr = NF_INQ_VARID(ncid,'SEA_ICE',varid)
+cIM07/03/2002 amipbc_sic_1x1_clim.nc & amipbc_sic_1x1.nc
+      ierr = NF_INQ_VARID(ncid,'sicbcs',varid)
+cIM22/02/2002
       if (ierr.ne.0) then
         print *, NF_STRERROR(ierr)
@@ -513,4 +537,12 @@
       ENDIF 
       print*,'variable ', namedim, lmdep
+cIM28/02/2002
+cPM28/02/2002 : nouvelle coord temporelle fichiers AMIP pas en jours
+c               Ici on suppose qu'on a 12 mois (de 30 jours).
+      IF (lmdep.NE.12) THEN
+          print *, 'Unknown AMIP file: not 12 months ?'
+          STOP
+       ENDIF
+cIM28/02/2002
       ierr = NF_INQ_VARID(ncid,namedim,dimid)
       if (ierr.ne.0) then
@@ -567,5 +599,13 @@
      ,'------------------------'
        ENDIF
-
+cIM07/03/2002 
+cIM22/02/2002 : Sea-ice Amip entre 0. et 1.
+cIM    PRINT*,'SUB. limit_netcdf.F IM : Sea-ice et SST Amip_new clim' 
+cIM   DO j = 1, imdep * jmdep
+cIM28/02/2002 <==PM         champ(j) = champ(j)/100.
+cIM14/03/2002      champ(j) = max(0.0,(min(1.0, (champ(j)/100.) )))
+cIM      champ(j) = amax1(0.0,(amin1(1.0, (champ(j)/100.) )))
+cIM   ENDDO
+cIM22/02/2002
          CALL inter_barxy ( imdep,jmdep -1,dlon, dlat ,
      ,     champ, iim, jjm, rlonu, rlatv, jjp1, champint )
@@ -582,5 +622,8 @@
 c
       DO l = 1, lmdep
-         timeyear(l) = timecoord(l)
+cIM28/02/2002 <== PM  timeyear(l) = timecoord(l)
+cIM      timeyear(l) = timecoord(l)
+cIM07/03/2002      
+         timeyear(l) = tmidmonth(l)
       ENDDO
       PRINT 222,  timeyear
@@ -613,4 +656,16 @@
       ENDDO
 c
+cIM14/03/2002 : Sea-ice Amip entre 0. et 1.
+      PRINT*,'SUB. limit_netcdf.F IM : Sea-ice Amipbc '
+      DO k = 1, 360
+      DO j = 1, jjp1
+      DO i = 1, iim
+        champan(i, j, k) = 
+     $ amax1(0.0,(amin1(1.0,(champan(i, j, k)/100.))))
+      ENDDO
+        champan(iip1, j, k) = champan(1, j, k)
+      ENDDO
+      ENDDO
+cIM14/03/2002
 
       DO k = 1, 360
@@ -729,11 +784,22 @@
 c
       PRINT*, 'Traitement de la sst'
-      ierr = NF_OPEN('AMIP.nc', NF_NOWRITE, ncid)
-      if (ierr.ne.0) then
-        print *, NF_STRERROR(ierr)
-        STOP
-      ENDIF
-
-      ierr = NF_INQ_VARID(ncid,'SST',varid)
+#ifdef cond_climato
+cIM22/02/2002
+cIM   ierr = NF_OPEN('AMIP.nc', NF_NOWRITE, ncid)
+cIM   ierr = NF_OPEN('amip79to95.nc', NF_NOWRITE, ncid)
+      ierr = NF_OPEN('amipbc_sst_1x1_clim.nc', NF_NOWRITE, ncid)
+#else
+      ierr = NF_OPEN('amipbc_sst_1x1.nc', NF_NOWRITE, ncid)
+#endif
+cIM22/02/2002
+      if (ierr.ne.0) then
+        print *, NF_STRERROR(ierr)
+        STOP
+      ENDIF
+
+cIM22/02/2002
+cIM   ierr = NF_INQ_VARID(ncid,'SST',varid)
+      ierr = NF_INQ_VARID(ncid,'tosbcs',varid)
+cIM22/02/2002
       if (ierr.ne.0) then
         print *, NF_STRERROR(ierr)
@@ -800,4 +866,12 @@
       ENDIF 
       print*,'variable ', namedim, 'dimension ', lmdep
+cIM28/02/2002
+cPM28/02/2002 : nouvelle coord temporelle fichiers AMIP pas en jours
+c               Ici on suppose qu'on a 12 mois (de 30 jours).
+      IF (lmdep.NE.12) THEN
+          print *, 'Unknown AMIP file: not 12 months ?'
+          STOP
+       ENDIF
+cIM28/02/2002
       ierr = NF_INQ_VARID(ncid,namedim,dimid)
       if (ierr.ne.0) then
@@ -873,5 +947,6 @@
 c
       DO l = 1, lmdep
-         timeyear(l) = timecoord(l)
+cIM28/02/2002 <==PM  timeyear(l) = timecoord(l)
+         timeyear(l) = tmidmonth(l)
       ENDDO
       print 222,  timeyear
@@ -904,4 +979,15 @@
       ENDDO
 c
+cIM14/03/2002 : SST amipbc greater then 271.38
+      PRINT*,'SUB. limit_netcdf.F IM : SST Amipbc >= 271.38 '
+      DO k = 1, 360
+      DO j = 1, jjp1
+      DO i = 1, iim
+         champan(i, j, k) = amax1(champan(i, j, k), 271.38)
+      ENDDO
+         champan(iip1, j, k) = champan(1, j, k)
+      ENDDO
+      ENDDO
+cIM14/03/2002
       DO k = 1, 360
          CALL gr_dyn_fi(1, iip1, jjp1, klon, 
