Index: LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read_std.F90
===================================================================
--- LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read_std.F90	(revision 3614)
+++ LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read_std.F90	(revision 3619)
@@ -123,5 +123,5 @@
       ierr=NF_INQ_DIMLEN(nid,rid,nlev_cas)
       print*,'OK3 read2: nid,rid,nlev_cas',nid,rid,nlev_cas
-      IF ( .NOT. ( nlev_cas > 10 .AND. nlev_cas < 1000 )) THEN
+      IF ( .NOT. ( nlev_cas > 10 .AND. nlev_cas < 200000 )) THEN
               print*,'Valeur de nlev_cas peu probable'
               STOP
@@ -315,5 +315,5 @@
      &     temp_nudg,qv_nudg,u_nudg,v_nudg,                                        &
      &     du,hu,vu,dv,hv,vv,dt,ht,vt,dq,hq,vq,                                    &
-     &     dth,hth,vth,dr,hr,vr,dtrad,sens,flat,ts,ps,ustar,tke,uw,vw,q1,q2,       &
+     &     dth,hth,vth,dr,hr,vr,dtrad,sens,flat,ts,ps,ustar,tket,uw,vw,q1,q2,       &
      &     orog_cas,albedo_cas,emiss_cas,t_skin_cas,q_skin_cas,mom_rough,          &
      &     heat_rough,o3_cas,rugos_cas,clay_cas,sand_cas)
@@ -334,5 +334,5 @@
       real temp(nlevel,ntime),qv(nlevel,ntime),ql(nlevel,ntime),qi(nlevel,ntime),rh(nlevel,ntime)
       real theta(nlevel,ntime),thv(nlevel,ntime),thl(nlevel,ntime),rv(nlevel,ntime)
-      real u(nlevel,ntime),v(nlevel,ntime),tke(nlevel,ntime)
+      real u(nlevel,ntime),v(nlevel,ntime),tket(ntime)
       real temp_nudg(nlevel,ntime),qv_nudg(nlevel,ntime),u_nudg(nlevel,ntime),v_nudg(nlevel,ntime)
       real ug(nlevel,ntime),vg(nlevel,ntime)
@@ -366,21 +366,21 @@
      ! coordonnees pression + temps #42
      &'w','omega','ug','vg','uadv','uadvh','uadvv','vadv','vadvh','vadvv','tadv','tadvh','tadvv',& !  #13 - #25
-     &'qvadv','qvadvh','qvadvv','thadv','thadvh','thadvv','thladvh',                             & ! #26 - #33
-     & 'radv','radvh','radvv','radcool','q1','q2','ustress','vstress',                           & ! #34 - #41
-     & 'rh','temp_nudg','qv_nudg','u_nudg','v_nudg',&
-     &'height_f','pressure_forc','tempt','theta','thv','thl','qvt','qlt','qit','rv','ut','vt','tket',&
+     &'qvadv','qvadvh','qvadvv','thadv','thadvh','thadvv','thladvh',                             & ! #26 - #32
+     & 'radv','radvh','radvv','radcool','q1','q2','ustress','vstress',                           & ! #33 - #40
+     & 'rh','temp_nudg','qv_nudg','u_nudg','v_nudg',                                             & ! #41-45
+     &'height_f','pressure_forc','tempt','theta','thv','thl','qvt','qlt','qit','rv','ut','vt',   & ! #46-58
      ! coordonnees temps #12
-     &'sfc_sens_flx','sfc_lat_flx','ts','ps','ustar',&
+     &'tket','sfc_sens_flx','sfc_lat_flx','ts','ps','ustar',&
      &'orog','albedo','emiss','t_skin','q_skin','mom_rough','heat_rough',&
      ! scalaires #4
      &'o3','rugos','clay','sand'/
 
-      do i=1,nbvar3d
-        missing_var(i)=0.
-      enddo
-
+!-----------------------------------------------------------------------
+! Checking availability of variable #i in the cas.nc file
+!     missing_var=1 if the variable is missing
 !-----------------------------------------------------------------------
 
        do i=1,nbvar3d
+         missing_var(i)=0.
          ierr=NF_INQ_VARID(nid,name_var(i),var3didin(i)) 
          if(ierr/=NF_NOERR) then
@@ -391,5 +391,5 @@
 
 !-----------------------------------------------------------------------
-! Activation de quelques cles en fonction des variables disponibles
+! Activating keys depending on the presence of specific variables in cas.nc
 !-----------------------------------------------------------------------
 if ( 1 == 1 ) THEN
@@ -403,5 +403,7 @@
 
 !-----------------------------------------------------------------------
-           if(i.LE.4) then     ! Lecture des coord pression en (nlevelp1,lat,lon)
+! Reading variables 1D (N+1) vertical variables (nlevelp1,lat,lon)
+!-----------------------------------------------------------------------
+           if(i.LE.4) then
 #ifdef NC_DOUBLE
            ierr = NF_GET_VAR_DOUBLE(nid,var3didin(i),apbp)
@@ -414,6 +416,9 @@
               stop "getvarup"
            endif
-!-----------------------------------------------------------------------
-           else if(i.gt.4.and.i.LE.12) then   ! Lecture des variables en (time,nlevel,lat,lon)
+
+!-----------------------------------------------------------------------
+!  Reading 1D (N) vertical varialbes    (nlevel,lat,lon)   
+!-----------------------------------------------------------------------
+           else if(i.gt.4.and.i.LE.12) then  
 #ifdef NC_DOUBLE
            ierr = NF_GET_VAR_DOUBLE(nid,var3didin(i),resul1)
@@ -427,6 +432,10 @@
            endif
          print*,'Lecture de la variable #i ',i,name_var(i),minval(resul1),maxval(resul1)
-!-----------------------------------------------------------------------
-           else if(i.gt.12.and.i.LE.54) then   ! Lecture des variables en (time,nlevel,lat,lon)
+
+!-----------------------------------------------------------------------
+!  Reading 2D tim-vertical variables  (time,nlevel,lat,lon)
+!  TBD : seems to be the same as above.
+!-----------------------------------------------------------------------
+           else if(i.gt.12.and.i.LE.57) then
 #ifdef NC_DOUBLE
            ierr = NF_GET_VAR_DOUBLE(nid,var3didin(i),resul)
@@ -439,8 +448,10 @@
               stop "getvarup"
            endif
-
          print*,'Lecture de la variable #i ',i,name_var(i),minval(resul),maxval(resul)
-!-----------------------------------------------------------------------
-           else if (i.gt.54.and.i.LE.65) then   ! Lecture des variables en (time,lat,lon)
+
+!-----------------------------------------------------------------------
+!  Reading 1D time variables (time,lat,lon)
+!-----------------------------------------------------------------------
+           else if (i.gt.57.and.i.LE.63) then
 #ifdef NC_DOUBLE
            ierr = NF_GET_VAR_DOUBLE(nid,var3didin(i),resul2)
@@ -454,6 +465,9 @@
            endif
          print*,'Lecture de la variable #i  ',i,name_var(i),minval(resul2),maxval(resul2)
-!-----------------------------------------------------------------------
-           else     ! Lecture des constantes (lat,lon)
+
+!-----------------------------------------------------------------------
+! Reading scalar variables (lat,lon)
+!-----------------------------------------------------------------------
+           else
 #ifdef NC_DOUBLE
            ierr = NF_GET_VAR_DOUBLE(nid,var3didin(i),resul3)
@@ -469,4 +483,7 @@
            endif
          endif
+
+!-----------------------------------------------------------------------
+! Attributing variables
 !-----------------------------------------------------------------------
          select case(i)
@@ -528,6 +545,6 @@
            case(56) ; u=resul
            case(57) ; v=resul
-           case(58) ; tke=resul
-           case(59) ; sens=resul2   ! donnees indexees en time
+           case(58) ; tket=resul2   ! donnees indexees en time
+           case(59) ; sens=resul2
            case(60) ; flat=resul2
            case(61) ; ts=resul2
@@ -563,5 +580,5 @@
              u(k,t)=u0(k)
              v(k,t)=v0(k)
-             tke(k,t)=tke0(k)
+             !tke(k,t)=tke0(k)
           enddo
        enddo
