Index: LMDZ.3.3/branches/rel-LF/libf/phylmd/phyredem.F
===================================================================
--- LMDZ.3.3/branches/rel-LF/libf/phylmd/phyredem.F	(revision 258)
+++ LMDZ.3.3/branches/rel-LF/libf/phylmd/phyredem.F	(revision 352)
@@ -99,8 +99,13 @@
       tab_cntrl(14) = anneeref
       tab_cntrl(13) = day_end
-      tab_cntrl(14) = anne_ini
-c
-      ierr = NF_REDEF (nid)
+      tab_cntrl(14) = annee_ref
+      tab_cntrl(15) = itau_phy
+c
+      ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1, idim1,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1, idim1,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 22,
      .                        "Parametres de controle")
@@ -113,5 +118,9 @@
 c
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "longitude", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "longitude", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 32,
      .                        "Longitudes de la grille physique")
@@ -124,5 +133,9 @@
 c
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "latitude", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 31,
      .                        "Latitudes de la grille physique")
@@ -137,5 +150,9 @@
 C
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "masque", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "masque", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 16,
      .                        "masque terre mer")
@@ -151,5 +168,9 @@
 C
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "FTER", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "FTER", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21,
      .                        "fraction de continent")
@@ -164,5 +185,9 @@
 C 
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "FLIC", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "FLIC", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 24,
      .                        "fraction glace de terre")
@@ -177,5 +202,9 @@
 C
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "FOCE", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "FOCE", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 14,
      .                        "fraction ocean")
@@ -190,5 +219,9 @@
 C
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "FSIC", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "FSIC", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 18,
      .                        "fraction glace mer")
@@ -206,5 +239,9 @@
         WRITE(str2,'(i2.2)') nsrf
         ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+        ierr = NF_DEF_VAR (nid, "TS"//str2, NF_DOUBLE, 1, idim2,nvarid)
+#else
         ierr = NF_DEF_VAR (nid, "TS"//str2, NF_FLOAT, 1, idim2,nvarid)
+#endif
         ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28,
      .                        "Temperature de surface No."//str2)
@@ -226,5 +263,9 @@
         WRITE(str7,'(i2.2,"srf",i2.2)') isoil,nsrf
         ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+        ierr = NF_DEF_VAR (nid, "Tsoil"//str7,NF_DOUBLE,1,idim2,nvarid)
+#else
         ierr = NF_DEF_VAR (nid, "Tsoil"//str7,NF_FLOAT,1,idim2,nvarid)
+#endif
         ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 29,
      .                        "Temperature du sol No."//str7)
@@ -244,5 +285,9 @@
 c
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "DELTAT", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "DELTAT", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 33,
      .                        "Ecart de la SST (pour slab-ocean)")
@@ -258,5 +303,9 @@
         WRITE(str2,'(i2.2)') nsrf
         ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+        ierr = NF_DEF_VAR (nid,"QS"//str2,NF_DOUBLE,1,idim2,nvarid)
+#else
         ierr = NF_DEF_VAR (nid,"QS"//str2,NF_FLOAT,1,idim2,nvarid)
+#endif
         ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 25,
      .                        "Humidite de surface No."//str2)
@@ -277,5 +326,9 @@
         WRITE(str2,'(i2.2)') nsrf
         ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+        ierr = NF_DEF_VAR (nid,"ALBE"//str2,NF_DOUBLE,1,idim2,nvarid)
+#else
         ierr = NF_DEF_VAR (nid,"ALBE"//str2,NF_FLOAT,1,idim2,nvarid)
+#endif
         ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 23,
      .                        "albedo de surface No."//str2)
@@ -296,5 +349,9 @@
         WRITE(str2,'(i2.2)') nsrf
         ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+        ierr = NF_DEF_VAR (nid,"EVAP"//str2,NF_DOUBLE,1,idim2,nvarid)
+#else
         ierr = NF_DEF_VAR (nid,"EVAP"//str2,NF_FLOAT,1,idim2,nvarid)
+#endif
         ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28,
      .                        "Evaporation de surface No."//str2)
@@ -316,5 +373,9 @@
         WRITE(str2,'(i2.2)') nsrf
         ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+        ierr = NF_DEF_VAR (nid,"SNOW"//str2,NF_DOUBLE,1,idim2,nvarid)
+#else
         ierr = NF_DEF_VAR (nid,"SNOW"//str2,NF_FLOAT,1,idim2,nvarid)
+#endif
         ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 22,
      .                        "Neige de surface No."//str2)
@@ -333,5 +394,9 @@
 c
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "RADS", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "RADS", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28,
      .                        "Rayonnement net a la surface")
@@ -344,5 +409,9 @@
 c
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "solsw", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "solsw", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 32,
      .                        "Rayonnement solaire a la surface")
@@ -355,5 +424,9 @@
 c
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "sollw", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "sollw", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 27,
      .                        "Rayonnement IF a la surface")
@@ -366,5 +439,9 @@
 c
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "fder", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "fder", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 14,
      .                        "Derive de flux")
@@ -377,5 +454,9 @@
 c
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "rain_f", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "rain_f", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21,
      .                        "precipitation liquide")
@@ -388,5 +469,9 @@
 c
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "snow_f", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "snow_f", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20,
      .                        "precipitation solide")
@@ -402,5 +487,9 @@
         WRITE(str2,'(i2.2)') nsrf
         ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+        ierr = NF_DEF_VAR (nid,"RUG"//str2,NF_DOUBLE,1,idim2,nvarid)
+#else
         ierr = NF_DEF_VAR (nid,"RUG"//str2,NF_FLOAT,1,idim2,nvarid)
+#endif
         ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 23,
      .                        "rugosite de surface No."//str2)
@@ -421,6 +510,11 @@
             WRITE(str2,'(i2.2)') nsrf
             ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+            ierr = NF_DEF_VAR (nid,"AGESNO"//str2,NF_DOUBLE,1,idim2
+     $          ,nvarid)
+#else
             ierr = NF_DEF_VAR (nid,"AGESNO"//str2,NF_FLOAT,1,idim2
      $          ,nvarid)
+#endif
             ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 15,
      .                        "Age de la neige surface No."//str2)
@@ -438,5 +532,9 @@
 c
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "ZMEA", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "ZMEA", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -447,5 +545,9 @@
 c
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "ZSTD", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "ZSTD", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -454,7 +556,10 @@
       ierr = NF_PUT_VAR_REAL (nid,nvarid,zstd)
 #endif
-c
-      ierr = NF_REDEF (nid)
+      ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "ZSIG", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "ZSIG", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -463,7 +568,10 @@
       ierr = NF_PUT_VAR_REAL (nid,nvarid,zsig)
 #endif
-c
-      ierr = NF_REDEF (nid)
+      ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "ZGAM", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "ZGAM", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -472,7 +580,10 @@
       ierr = NF_PUT_VAR_REAL (nid,nvarid,zgam)
 #endif
-c
-      ierr = NF_REDEF (nid)
+      ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "ZTHE", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "ZTHE", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -481,7 +592,10 @@
       ierr = NF_PUT_VAR_REAL (nid,nvarid,zthe)
 #endif
-c
-      ierr = NF_REDEF (nid)
+      ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "ZPIC", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "ZPIC", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -490,7 +604,10 @@
       ierr = NF_PUT_VAR_REAL (nid,nvarid,zpic)
 #endif
-c
-      ierr = NF_REDEF (nid)
+      ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "ZVAL", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "ZVAL", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -499,7 +616,10 @@
       ierr = NF_PUT_VAR_REAL (nid,nvarid,zval)
 #endif
-c
-      ierr = NF_REDEF (nid)
+      ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "RUGSREL", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "RUGSREL", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -510,5 +630,9 @@
 c
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "TANCIEN", NF_DOUBLE, 1, idim3,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "TANCIEN", NF_FLOAT, 1, idim3,nvarid)
+#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -519,5 +643,9 @@
 c
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "QANCIEN", NF_DOUBLE, 1, idim3,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "QANCIEN", NF_FLOAT, 1, idim3,nvarid)
+#endif
       ierr = NF_ENDDEF(nid)
 #ifdef NC_DOUBLE
@@ -528,5 +656,9 @@
 c
       ierr = NF_REDEF (nid)
+#ifdef NC_DOUBLE
+      ierr = NF_DEF_VAR (nid, "RUGMER", NF_DOUBLE, 1, idim2,nvarid)
+#else
       ierr = NF_DEF_VAR (nid, "RUGMER", NF_FLOAT, 1, idim2,nvarid)
+#endif
       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 28,
      .                        "Longueur de rugosite sur mer")
