Index: /LMDZ.3.3/trunk/libf/dyn3d/grilles_gcm_netcdf.F
===================================================================
--- /LMDZ.3.3/trunk/libf/dyn3d/grilles_gcm_netcdf.F	(revision 217)
+++ /LMDZ.3.3/trunk/libf/dyn3d/grilles_gcm_netcdf.F	(revision 218)
@@ -168,8 +168,15 @@
 c rajoute l'ecriture de la grille
 
-        status=NF_PUT_VARA_REAL(ncid_out,out_lonuid,1,iim+1,rlonudeg)
-        status=NF_PUT_VARA_REAL(ncid_out,out_lonvid,1,iim+1,rlonvdeg)
-        status=NF_PUT_VARA_REAL(ncid_out,out_latuid,1,jjm+1,rlatudeg)
-        status=NF_PUT_VARA_REAL(ncid_out,out_latvid,1,jjm,rlatvdeg)
+#ifdef NC_DOUBLE
+      status=NF_PUT_VARA_DOUBLE(ncid_out,out_lonuid,1,iim+1,rlonudeg)
+      status=NF_PUT_VARA_DOUBLE(ncid_out,out_lonvid,1,iim+1,rlonvdeg)
+      status=NF_PUT_VARA_DOUBLE(ncid_out,out_latuid,1,jjm+1,rlatudeg)
+      status=NF_PUT_VARA_DOUBLE(ncid_out,out_latvid,1,jjm,rlatvdeg)
+#else
+      status=NF_PUT_VARA_REAL(ncid_out,out_lonuid,1,iim+1,rlonudeg)
+      status=NF_PUT_VARA_REAL(ncid_out,out_lonvid,1,iim+1,rlonvdeg)
+      status=NF_PUT_VARA_REAL(ncid_out,out_latuid,1,jjm+1,rlatudeg)
+      status=NF_PUT_VARA_REAL(ncid_out,out_latvid,1,jjm,rlatvdeg)
+#endif
 
         start(1)=1
@@ -189,6 +196,12 @@
         enddo
 
+#ifdef NC_DOUBLE
+        status=NF_PUT_VARA_DOUBLE(ncid_out,out_varid,start,
+     s  count,temp)
+#else
         status=NF_PUT_VARA_REAL(ncid_out,out_varid,start,
      s  count,temp)
+#endif
+
 
 c fermeture du fichier netcdf
Index: /LMDZ.3.3/trunk/libf/dyn3d/read_dstoke.F
===================================================================
--- /LMDZ.3.3/trunk/libf/dyn3d/read_dstoke.F	(revision 217)
+++ /LMDZ.3.3/trunk/libf/dyn3d/read_dstoke.F	(revision 218)
@@ -42,11 +42,23 @@
         debut(2) = 1
 
+#ifdef NC_DOUBLE
+        status=NF_GET_VARA_DOUBLE(ncidfd,variddt,debut,epais,dtv)
+#else
         status=NF_GET_VARA_REAL(ncidfd,variddt,debut,epais,dtv)
+#endif
         zdtvr=dtv(1,1,1)
 
+#ifdef NC_DOUBLE
+        status=NF_GET_VARA_DOUBLE(ncidfd,varididvt,debut,epais,adv)
+#else
         status=NF_GET_VARA_REAL(ncidfd,varididvt,debut,epais,adv)
+#endif
         ziadvtrac= adv(1,1,1)
 	
+#ifdef NC_DOUBLE
+	status=NF_GET_VARA_DOUBLE(ncidfd,varididvp,debut,epais,adv2)
+#else
 	status=NF_GET_VARA_REAL(ncidfd,varididvp,debut,epais,adv2)
+#endif
         ziadvtrac2= adv2(1,1,1)
 
Index: /LMDZ.3.3/trunk/libf/dyn3d/read_fstoke.F
===================================================================
--- /LMDZ.3.3/trunk/libf/dyn3d/read_fstoke.F	(revision 217)
+++ /LMDZ.3.3/trunk/libf/dyn3d/read_fstoke.F	(revision 218)
@@ -28,5 +28,5 @@
      . rlatu_dy(imo1,jmo1),rlatv_dy(imo1,jmo)
       integer*4 ncrec,ncim,ncjm,nclm
-      real zrec,zim,zjm,zlm
+      integer*4 zrec,zim,zjm,zlm
       integer*4 xid,yid,zid,tid
       real*4 zdtvr,ziadvtrac
@@ -126,5 +126,9 @@
 c niveaux de pression
         
+#ifdef NC_DOUBLE
+       status=NF_GET_VARA_DOUBLE(ncidf,varidpl,1,zlm,pl)
+#else
        status=NF_GET_VARA_REAL(ncidf,varidpl,1,zlm,pl)
+#endif
 
 c rlonu,rlonv,rlatu,rlatv
@@ -140,6 +144,11 @@
       count(4)=0
 	
-	status=NF_GET_VARA_REAL(ncidf,varidnlo,start,count,rlonu_dy)
-        status=NF_GET_VARA_REAL(ncidf,varidnla,start,count,rlatu_dy)
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidf,varidnlo,start,count,rlonu_dy)
+      status=NF_GET_VARA_DOUBLE(ncidf,varidnla,start,count,rlatu_dy)
+#else
+      status=NF_GET_VARA_REAL(ncidf,varidnlo,start,count,rlonu_dy)
+      status=NF_GET_VARA_REAL(ncidf,varidnla,start,count,rlatu_dy)
+#endif
 	
       start(1)=1
@@ -153,6 +162,11 @@
       count(4)=0
 
-        status=NF_GET_VARA_REAL(ncidfv,varidnlov,start,count,rlonv_dy)
-        status=NF_GET_VARA_REAL(ncidfv,varidnlav,start,count,rlatv_dy)
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidfv,varidnlov,start,count,rlonv_dy)
+      status=NF_GET_VARA_DOUBLE(ncidfv,varidnlav,start,count,rlatv_dy)
+#else
+      status=NF_GET_VARA_REAL(ncidfv,varidnlov,start,count,rlonv_dy)
+      status=NF_GET_VARA_REAL(ncidfv,varidnlav,start,count,rlatv_dy)
+#endif
 
 c Lecture de phis et aire
@@ -169,21 +183,20 @@
 
 c phis
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidf,varidps,start,count,phis)
+#else
       status=NF_GET_VARA_REAL(ncidf,varidps,start,count,phis)
-c      print*,'WARNING!!! Correction bidon pour palier a un '
-c      print*,'probleme dans la creation des fichiers nc'
-c      call correctbid(iim,jmo1*1,phis)
-       call dump2d(imo1,jmo1,phis,'PHISNC')
+#endif
 
 c aire
+#ifdef NC_DOUBLE
+       status=NF_GET_VARA_DOUBLE(ncidf,varidai,start,count,airedy)
+#else
        status=NF_GET_VARA_REAL(ncidf,varidai,start,count,airedy)
-c      call correctbid(iim,jmo1*1,airedy)
-c       call dump2d(imo1,jmo1,airedy,'AIRENC')
-
-c        status= NF_CLOSE(ncidf)
+#endif
 
        else 
 
       print*,'ok1'
-c       stop'TEST lectfluxnc'
 
 c ---------------------
@@ -205,5 +218,9 @@
 
 c masse 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidf,varidm,start,count,masse)
+#else
       status=NF_GET_VARA_REAL(ncidf,varidm,start,count,masse)
+#endif
 c      print*,'WARNING!!! Correction bidon pour palier a un '
 c      print*,'probleme dans la creation des fichiers nc'
@@ -212,5 +229,9 @@
        call dump2d(imo1,jmo1,masse,'MASSE COUCHE 1')
 c pbaru 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidf,varidpu,start,count,pbaru)
+#else
       status=NF_GET_VARA_REAL(ncidf,varidpu,start,count,pbaru)
+#endif
 c      print*,'WARNING!!! Correction bidon pour palier a un '
 c      print*,'probleme dans la creation des fichiers nc'
@@ -219,5 +240,9 @@
 
 c w 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidf,varidw,start,count,w)
+#else
       status=NF_GET_VARA_REAL(ncidf,varidw,start,count,w)
+#endif
 c      print*,'WARNING!!! Correction bidon pour palier a un '
 c      print*,'probleme dans la creation des fichiers nc'
@@ -226,5 +251,9 @@
 
 c teta 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidf,varidt,start,count,teta)
+#else
       status=NF_GET_VARA_REAL(ncidf,varidt,start,count,teta)
+#endif
 c      print*,'WARNING!!! Correction bidon pour palier a un '
 c      print*,'probleme dans la creation des fichiers nc'
@@ -233,5 +262,9 @@
 
 c phi 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidf,varidph,start,count,phi)
+#else
       status=NF_GET_VARA_REAL(ncidf,varidph,start,count,phi)
+#endif
 c      print*,'WARNING!!! Correction bidon pour palier a un '
 c      print*,'probleme dans la creation des fichiers nc'
@@ -243,5 +276,9 @@
 c  pbarv
 	print*,'Lecture de pbarv irec=',irec
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidfv,varidpv,start,count,pbarv)
+#else
       status=NF_GET_VARA_REAL(ncidfv,varidpv,start,count,pbarv)
+#endif
 c      call correctbid(iim,jjm*nlevnc,pbarv)
 	PRINT*,'*******LECTURE DE PBARV******'
Index: /LMDZ.3.3/trunk/libf/dyn3d/read_fstoke0.F
===================================================================
--- /LMDZ.3.3/trunk/libf/dyn3d/read_fstoke0.F	(revision 217)
+++ /LMDZ.3.3/trunk/libf/dyn3d/read_fstoke0.F	(revision 218)
@@ -24,5 +24,5 @@
      . rlatu_dy(iip1,jjp1),rlatv_dy(iip1,jjm)
       integer*4 ncrec,ncim,ncjm,nclm
-      real zrec,zim,zjm,zlm
+      integer*4 zrec,zim,zjm,zlm
       integer*4 xid,yid,zid,tid
       real*4 zdtvr,ziadvtrac
@@ -122,5 +122,9 @@
 c niveaux de pression
         
+#ifdef NC_DOUBLE
+       status=NF_GET_VARA_DOUBLE(ncidf,varidpl,1,zlm,pl)
+#else
        status=NF_GET_VARA_REAL(ncidf,varidpl,1,zlm,pl)
+#endif
 
 c rlonu,rlonv,rlatu,rlatv
@@ -136,7 +140,12 @@
       count(4)=0
 	
-	status=NF_GET_VARA_REAL(ncidf,varidnlo,start,count,rlonu_dy)
-        status=NF_GET_VARA_REAL(ncidf,varidnla,start,count,rlatu_dy)
-	
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidf,varidnlo,start,count,rlonu_dy)
+      status=NF_GET_VARA_DOUBLE(ncidf,varidnla,start,count,rlatu_dy)
+#else
+      status=NF_GET_VARA_REAL(ncidf,varidnlo,start,count,rlonu_dy)
+      status=NF_GET_VARA_REAL(ncidf,varidnla,start,count,rlatu_dy)
+#endif
+
       start(1)=1
       start(2)=1
@@ -149,6 +158,11 @@
       count(4)=0
 
-        status=NF_GET_VARA_REAL(ncidfv,varidnlov,start,count,rlonv_dy)
-        status=NF_GET_VARA_REAL(ncidfv,varidnlav,start,count,rlatv_dy)
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidfv,varidnlov,start,count,rlonv_dy)
+      status=NF_GET_VARA_DOUBLE(ncidfv,varidnlav,start,count,rlatv_dy)
+#else
+      status=NF_GET_VARA_REAL(ncidfv,varidnlov,start,count,rlonv_dy)
+      status=NF_GET_VARA_REAL(ncidfv,varidnlav,start,count,rlatv_dy)
+#endif
 
 c Lecture de phis et aire
@@ -165,8 +179,16 @@
 
 c phis
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidf,varidps,start,count,phis)
+#else
       status=NF_GET_VARA_REAL(ncidf,varidps,start,count,phis)
+#endif
 
 c aire
+#ifdef NC_DOUBLE
+       status=NF_GET_VARA_DOUBLE(ncidf,varidai,start,count,airedy)
+#else
        status=NF_GET_VARA_REAL(ncidf,varidai,start,count,airedy)
+#endif
 
        else 
@@ -193,22 +215,46 @@
 c masse 
 	PRINT*,'LECTURE DE masse'
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidf,varidm,start,count,masse)
+#else
       status=NF_GET_VARA_REAL(ncidf,varidm,start,count,masse)
+#endif
 
 c pbaru 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidf,varidpu,start,count,pbaru)
+#else
       status=NF_GET_VARA_REAL(ncidf,varidpu,start,count,pbaru)
+#endif
 
 c w 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidf,varidw,start,count,w)
+#else
       status=NF_GET_VARA_REAL(ncidf,varidw,start,count,w)
+#endif
 
 c teta 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidf,varidt,start,count,teta)
+#else
       status=NF_GET_VARA_REAL(ncidf,varidt,start,count,teta)
+#endif
 
 c phi 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidf,varidph,start,count,phi)
+#else
       status=NF_GET_VARA_REAL(ncidf,varidph,start,count,phi)
+#endif
 	
 	count(2) = zjm-1 
 
 c  pbarv
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidfv,varidpv,start,count,pbarv)
+#else
       status=NF_GET_VARA_REAL(ncidfv,varidpv,start,count,pbarv)
+#endif
 
       start(3)=irec
@@ -222,3 +268,2 @@
       return
       end
-
Index: /LMDZ.3.3/trunk/libf/dyn3d/read_pstoke.F
===================================================================
--- /LMDZ.3.3/trunk/libf/dyn3d/read_pstoke.F	(revision 217)
+++ /LMDZ.3.3/trunk/libf/dyn3d/read_pstoke.F	(revision 218)
@@ -196,5 +196,9 @@
 c niveaux de pression
 
+#ifdef NC_DOUBLE
+            status=NF_GET_VARA_DOUBLE(ncidp,varidpl,1,kev,pl)
+#else
             status=NF_GET_VARA_REAL(ncidp,varidpl,1,kev,pl)
+#endif
 
 c lecture de aire et phis
@@ -212,9 +216,20 @@
 c 
 c phis
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidps,start,count,phisfi2)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidps,start,count,phisfi2)
+#endif
+
+
       call gr_ecrit_fi(1,kon,iim,jjm+1,phisfi2,phisfi)
 
 c aire
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidai,start,count,airefi2)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidai,start,count,airefi2)
+#endif
+
       call gr_ecrit_fi(1,kon,iim,jjm+1,airefi2,airefi)
       else
@@ -241,43 +256,88 @@
 c frac_impa 
 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidfi,start,count,frac_impa2)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidfi,start,count,frac_impa2)
+#endif
       call gr_ecrit_fi(kev,kon,iim,jjm+1,frac_impa2,frac_impa)
 
 c frac_nucl 
 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidfn,start,count,frac_nucl2)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidfn,start,count,frac_nucl2)
+#endif
       call gr_ecrit_fi(kev,kon,iim,jjm+1,frac_nucl2,frac_nucl)
 
 c abder t
+
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidt,start,count,t2)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidt,start,count,t2)
+#endif
+
       call gr_ecrit_fi(kev,kon,iim,jjm+1,t2,t)
 
 c mfu
+
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidmfu,start,count,mfu2)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidmfu,start,count,mfu2)
+#endif
+
       call gr_ecrit_fi(kev,kon,iim,jjm+1,mfu2,mfu)
 
 c mfd
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidmfd,start,count,mfd2)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidmfd,start,count,mfd2)
+#endif
       call gr_ecrit_fi(kev,kon,iim,jjm+1,mfd2,mfd)
 
 c en_u 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidenu,start,count,en_u2)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidenu,start,count,en_u2)
+#endif
       call gr_ecrit_fi(kev,kon,iim,jjm+1,en_u2,en_u)
 
 c de_u 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,variddeu,start,count,de_u2)
+#else
       status=NF_GET_VARA_REAL(ncidp,variddeu,start,count,de_u2)
+#endif
       call gr_ecrit_fi(kev,kon,iim,jjm+1,de_u2,de_u)
 
 c en_d 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidend,start,count,en_d2)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidend,start,count,en_d2)
+#endif
       call gr_ecrit_fi(kev,kon,iim,jjm+1,en_d2,en_d)
 
 c de_d 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidded,start,count,de_d2)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidded,start,count,de_d2)
+#endif
       call gr_ecrit_fi(kev,kon,iim,jjm+1,de_d2,de_d)
 
 c coefh 
 	print*,'LECTURE de coefh a irec =',irec
+#ifdef NC_DOUBLE
+       status=NF_GET_VARA_DOUBLE(ncidp,varidch,start,count,coefh2)
+#else
        status=NF_GET_VARA_REAL(ncidp,varidch,start,count,coefh2)
+#endif
+
        call gr_ecrit_fi(kev,kon,iim,jjm+1,coefh2,coefh)
 
@@ -289,47 +349,88 @@
 c pyu1
 	print*,'LECTURE de yu1 a irec =',irec
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidyu1,start,count,pyu12)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidyu1,start,count,pyu12)
+#endif
+
       call gr_ecrit_fi(1,kon,iim,jjm+1,pyu12,pyu1)
 
 c pyv1
         print*,'LECTURE de yv1 a irec =',irec
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidyv1,start,count,pyv12)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidyv1,start,count,pyv12)
+#endif
       call gr_ecrit_fi(1,kon,iim,jjm+1,pyv12,pyv1)
 
 c ftsol1
         print*,'LECTURE de ftsol1 a irec =',irec
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidfts1,start,count,ftsol12)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidfts1,start,count,ftsol12)
+#endif
        call gr_ecrit_fi(1,kon,iim,jjm+1,ftsol12,ftsol1)
 
 c ftsol2
         print*,'LECTURE de ftsol2 a irec =',irec
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidfts2,start,count,ftsol22)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidfts2,start,count,ftsol22)
+#endif
       call gr_ecrit_fi(1,kon,iim,jjm+1,ftsol22,ftsol2)
 
 c ftsol3
 	 print*,'LECTURE de ftsol3 a irec =',irec
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidfts3,start,count,ftsol32)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidfts3,start,count,ftsol32)
+#endif
       call gr_ecrit_fi(1,kon,iim,jjm+1,ftsol32,ftsol3)
 
 c ftsol4
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidfts4,start,count,ftsol42)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidfts4,start,count,ftsol42)
+#endif
       call gr_ecrit_fi(1,kon,iim,jjm+1,ftsol42,ftsol4)
 
 c psrf1 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidpsr1,start,count,psrf12)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidpsr1,start,count,psrf12)
+#endif
 c      call dump2d(iip1-1,jjm+1,psrf12,'PSRF1NC')
       call gr_ecrit_fi(1,kon,iim,jjm+1,psrf12,psrf1)
 
 c psrf2 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidpsr2,start,count,psrf22)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidpsr2,start,count,psrf22)
+#endif
 c      call dump2d(iip1-1,jjm+1,psrf22,'PSRF2NC')
       call gr_ecrit_fi(1,kon,iim,jjm+1,psrf22,psrf2)
 
 c psrf3 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidpsr3,start,count,psrf32)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidpsr3,start,count,psrf32)
+#endif
       call gr_ecrit_fi(1,kon,iim,jjm+1,psrf32,psrf3)
 
 c psrf4 
+#ifdef NC_DOUBLE
+      status=NF_GET_VARA_DOUBLE(ncidp,varidpsr4,start,count,psrf42)
+#else
       status=NF_GET_VARA_REAL(ncidp,varidpsr4,start,count,psrf42)
+#endif
       call gr_ecrit_fi(1,kon,iim,jjm+1,psrf42,psrf4)
 	
