Index: palm/trunk/SCRIPTS/NCL/cross_sections.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/cross_sections.ncl	(revision 355)
+++ palm/trunk/SCRIPTS/NCL/cross_sections.ncl	(revision 357)
@@ -529,4 +529,7 @@
                delta_z = -1.d
             end if
+         end if
+         if (vNam(varn) .eq. "zu1_xy") then
+            zu1    = f_att->$vNam(varn)$
          end if
       end do
@@ -1275,4 +1278,5 @@
    no_var=0
    n=0
+   no_zu1=0
 
    do varn=dim-1,0,1        
@@ -1289,4 +1293,8 @@
       end if  
 
+      if (var .NE. "all") then
+         check = isStrSubset( var,","+vNam(varn)+"," ) 
+      end if
+
       if(check) then
       
@@ -1306,6 +1314,7 @@
 	    data_att = f_att->$vNam(varn)$
             if(vNam(varn) .eq. "ts_xy" .or. vNam(varn) .eq. "us_xy" .or. vNam(varn) .eq. "z0s_xy")
-              ;these variables depend von zu1_xy and that's why they have only one z-layer
+              ;these variables depend zu1_xy and that's why they have only one z-layer
               data(varn,:,0,:,:)=temp(:,0,ys:ye,xs:xe) 
+              no_zu1=no_zu1+1
             else
               data(varn,:,:,:,:)=temp(:,zs:ze,ys:ye,xs:xe) 
@@ -1317,4 +1326,5 @@
 	    data_att = f_att->$vNam(varn)$
             data(varn,:,:,:,:)=temp(:,zs:ze,ys:ye,xs:xe) 
+            delete(temp)
          end if
          if ( yzc .eq. 1) then
@@ -1322,4 +1332,5 @@
 	    data_att = f_att->$vNam(varn)$
             data(varn,:,:,:,:)=temp(:,zs:ze,ys:ye,xs:xe) 
+            delete(temp)
          end if
          if (check_vec1) then
@@ -1345,4 +1356,12 @@
 
    end do
+
+   if (no_var .EQ. 0) then
+      print(" ")
+      print("The variables var='"+var+"' do not exist on your input file;")
+      print("be sure to have one comma before and after each variable")
+      print(" ")
+      exit
+   end if
 
    var_input=new(no_var,string)
@@ -1363,12 +1382,12 @@
       end if  
 
+      if (var .NE. "all") then
+         check = isStrSubset( var,","+vNam(varn)+"," ) 
+      end if
+
       if(check) then     
          var_input(numb)=vNam(varn) 
 	 numb=numb+1     
       end if
-                  
-      if (var .NE. "all") then
-         check = isStrSubset( var,","+vNam(varn)+"," ) 
-      end if
       
       if (check) then
@@ -1381,5 +1400,5 @@
       print(" ")
       print("The variables var='"+var+"' do not exist on your input file;")
-      print("be sure to have one comma berfore and after each variable")
+      print("be sure to have one comma before and after each variable")
       print(" ")
       exit
@@ -1391,5 +1410,5 @@
          print("Component 1 for the vector-plot ('vec1') must be one of the varibles on the input file:")
 	 print("- "+var_input)
-	 print("be sure to have one comma berfore and after the variable")
+	 print("be sure to have one comma before and after the variable")
          print(" ")
          exit
@@ -1400,5 +1419,5 @@
          print("Component 2 for the vector-plot ('vec2') must be one of the varibles on the input file:")
 	 print("- "+var_input)
-	 print("be sure to have one comma berfore and after the variable")
+	 print("be sure to have one comma before and after the variable")
          print(" ")
          exit
@@ -1414,8 +1433,10 @@
 
    if (vector .EQ. 1 .AND. plotvec .EQ. "plotvec") then
-      plot=new((/no_time*no_layer*no_var+no_time*no_layer/),graphic)
+      plot=new((/no_time*no_layer*no_var - no_time*(no_layer-1)*no_zu1 \
+                                         + no_time*no_layer/),graphic)
    else
-      plot=new((/no_time*no_layer*no_var/),graphic)
-   end if
+      plot=new((/no_time*no_layer*no_var - no_time*(no_layer-1)*no_zu1/),graphic)
+   end if
+   dim_plot=dimsizes(plot)
 
    page = 0
@@ -1428,4 +1449,5 @@
    ; create plots 
    ; ***************************************************
+
 
    if (vector .EQ. 1 .AND. plotvec .EQ. "plotvec") then
@@ -1548,5 +1570,11 @@
                         level = "=" + z_d(zs+lo) + "m"
                      end if
-                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(li)/3600,2,True) +"h  z"+level		     
+
+                     if(vNam(varn) .eq. "ts_xy" .or. vNam(varn) .eq. "us_xy" .or. vNam(varn) .eq. "z0s_xy")then
+                         loe = 0
+                         level = "=" + zu1(0) + "m"
+                     end if
+                    
+                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(li)/3600,2,True) +"h  z"+level		                       
                      plot(n) = gsn_csm_contour(wks_ps,data(varn,li,lo,:,:),cs_res) 
                      if (vector .EQ. 1 .AND. check_vecp) then
@@ -1575,5 +1603,12 @@
                         level = "=" + z_d(zs+li) + "m"
                      end if 
-                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(lo)/3600,2,True) + "h  z"+ level		
+       
+                     if(vNam(varn) .eq. "ts_xy" .or. vNam(varn) .eq. "us_xy" .or. vNam(varn) .eq. "z0s_xy")then
+                         lie = 0
+                         level = "=" + zu1(0) + "m"
+                     end if
+                
+                     cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(lo)/3600,2,True) + "h  z"+ level
+                     
                      plot(n) = gsn_csm_contour(wks_ps,data(varn,lo,li,:,:),cs_res)
                      if (vector .EQ. 1 .AND. check_vecp) then
@@ -1710,6 +1745,5 @@
    ; ***************************************************
    ; merge plots onto one page 
-   ; ***************************************************
-   
+   ; ***************************************************   
    if (vector .EQ. 1 .AND. plotvec .EQ. "plotvec")then 
       if (format_out .EQ. "eps" .OR. format_out .EQ. "epsi") then
@@ -1719,7 +1753,7 @@
          print(" ")
       else
-         do np = 0,no_layer*no_time*(no_var+1)-1,no_rows*no_columns   
-            if ( np + no_rows*no_columns .gt. (no_layer*no_time*(no_var+1))-1) then 
-               gsn_panel(wks_ps, plot(np:(no_layer*no_time*(no_var+1))-1),(/no_rows,no_columns/),cs_resP)
+         do np = 0,dim_plot-1,no_rows*no_columns   
+            if ( np + no_rows*no_columns .gt. dim_plot-1) then 
+               gsn_panel(wks_ps, plot(np:dim_plot-1),(/no_rows,no_columns/),cs_resP)
             else
                gsn_panel(wks_ps, plot(np:np+no_rows*no_columns-1),(/no_rows,no_columns/),cs_resP)
@@ -1729,12 +1763,12 @@
    else       
       if (format_out .EQ. "eps" .OR. format_out .EQ. "epsi") then
-         gsn_panel(wks_ps,plot(0:(no_time*no_layer*no_var)-1),(/no_var,no_layer*no_time/),cs_resP)
+         gsn_panel(wks_ps,plot(0:dim_plot-1),(/dim_plot,1/),cs_resP)
          print(" ")
          print("Outputs to .eps or .epsi have only one frame")
          print(" ")
       else
-         do np = 0,no_layer*no_time*no_var-1,no_rows*no_columns  
-            if ( np + no_rows*no_columns .gt. (no_layer*no_time*no_var)-1) then
-               gsn_panel(wks_ps, plot(np:(no_layer*no_time*no_var)-1),(/no_rows,no_columns/),cs_resP)
+         do np = 0,dim_plot-1,no_rows*no_columns  
+            if ( np + no_rows*no_columns .gt. dim_plot-1) then
+               gsn_panel(wks_ps, plot(np:dim_plot-1),(/no_rows,no_columns/),cs_resP)
             else
                gsn_panel(wks_ps, plot(np:np+no_rows*no_columns-1),(/no_rows,no_columns/),cs_resP)
