Index: /trunk/LMDZ.MARS/README
===================================================================
--- /trunk/LMDZ.MARS/README	(revision 787)
+++ /trunk/LMDZ.MARS/README	(revision 788)
@@ -1794,2 +1794,7 @@
 >> bug correction in the varying EUV case; now correctly account for things
    as the year cycles.
+
+== 20/09/2012 == EM
+>> update of zrecast utility: add possibility to have automatic "MCD/GCM"
+   altitude above surface levels as well as the possibility to specify min,
+   max and number of levels.
Index: /trunk/LMDZ.MARS/util/zrecast.F90
===================================================================
--- /trunk/LMDZ.MARS/util/zrecast.F90	(revision 787)
+++ /trunk/LMDZ.MARS/util/zrecast.F90	(revision 788)
@@ -128,4 +128,6 @@
                             ! has to be computed; false if these are given
                             ! by the user
+logical :: auto_mcd_levels ! Flag: specific case for MCD automatic above
+                           ! local surface levels
 !===============================================================================
 ! 1. Input parameters
@@ -549,14 +551,19 @@
 text="dummy" ! dummy initialization
 auto_vert_levels=.true. ! dummy initialization to get rid of compiler warning
-do while ((trim(text).ne."yes").and.(trim(text).ne."no"))
+do while ((trim(text).ne."yes").and.(trim(text).ne."no").and.(trim(text).ne."mcd"))
   write(*,*) ""
   write(*,*) "Automatic generation of vertical levels distribution? (yes/no)"
   write(*,*) "(yes: you only provide min, max and number of levels)"
   write(*,*) "(no: you provide values for each level)"
+  write(*,*) "(mcd: special case for above local surface levels for MCD)"
   read(*,'(a64)') text
   if (trim(text).eq."yes") then
     auto_vert_levels=.true.
-  else
+    auto_mcd_levels=.false.
+  elseif(trim(text).eq."no") then
     auto_vert_levels=.false.
+  elseif(trim(text).eq."mcd") then
+    auto_vert_levels=.true.
+    auto_mcd_levels=.true.
   endif
 enddo
@@ -565,13 +572,11 @@
   ! ask for # of points and end values for pressure or above areoid cases
   write(*,*) ""
-  if ((ztype.le.2).or.(ztype.ge.4)) then
-    write(*,*) "Enter min and max of vertical coordinate (Pa or m)"
-    write(*,*) " (in that order and on the same line)"
-    if (ztype.eq.1) then ! pressure coordinate
-      read(*,*) pmin,pmax
-    else ! altitude coordinate
-      read(*,*) zamin,zamax
-    endif
-  endif ! of if ((ztype.le.2).or.(ztype.ge.4))
+  write(*,*) "Enter min and max of vertical coordinate (Pa or m)"
+  write(*,*) " (in that order and on the same line)"
+  if (ztype.eq.1) then ! pressure coordinate
+    read(*,*) pmin,pmax
+  else ! altitude coordinate
+     read(*,*) zamin,zamax
+  endif
 
   ! Build corresponding vertical coordinates
@@ -611,14 +616,32 @@
     endif
   else if (ztype.eq.3) then ! above local surface
-    ! set nblev to # of levels from input data files
-    nblev=altlength
-    allocate(zsurface(nblev),stat=ierr)
-    if (ierr.ne.0) then
-      write(*,*) "Error: Failed to allocate zsurface(nblev)"
-      write(*,*) "     nblev=",nblev
-      stop
-    endif
-    ! build specific above local surface altitudes
-    call build_zs(nblev,have_sigma,sigma,aps,bps,zsurface)
+    if (auto_mcd_levels) then
+      ! set nblev to # of levels from input data files
+      nblev=altlength
+      allocate(zsurface(nblev),stat=ierr)
+      if (ierr.ne.0) then
+        write(*,*) "Error: Failed to allocate zsurface(nblev)"
+        write(*,*) "     nblev=",nblev
+        stop
+      endif
+      ! build specific above local surface altitudes
+      call build_zs(nblev,have_sigma,sigma,aps,bps,zsurface)
+    else
+      write(*,*) "Number of levels along vertical coordinate?"
+      read(*,*) nblev
+      allocate(zsurface(nblev),stat=ierr)
+      if (ierr.ne.0) then
+        write(*,*) "Error: Failed to allocate zsurface(nblev)"
+        write(*,*) "     nblev=",nblev
+        stop
+      endif
+      if (nblev.eq.1) then ! in case only one level is asked for
+        zsurface(nblev)=zamin
+      else 
+        do i=1,nblev
+          zsurface(i)=zamin+(real(i)-1.0)*((zamax-zamin)/(real(nblev)-1.0))
+        enddo
+      endif
+    endif ! of if (auto_mcd_levels)
   else ! distance to center of planet
    write(*,*) "Number of levels along vertical coordinate?"
