Index: palm/trunk/SCRIPTS/NCL/cross_sections.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/cross_sections.ncl	(revision 357)
+++ palm/trunk/SCRIPTS/NCL/cross_sections.ncl	(revision 358)
@@ -702,4 +702,5 @@
          print("You cannot choose a start value for z, there are preseted layers for z")
          print(" ")
+         zs = 0
       else
          if (zs .LT. 0) then
@@ -1264,9 +1265,9 @@
       lis = start_time_step
       lie = end_time_step
-      los = 0
-      loe = laye-lays
+      los = lays
+      loe = laye
    else
-      lis = 0
-      lie = laye-lays
+      lis = lays
+      lie = laye
       los = start_time_step 
       loe = end_time_step
@@ -1456,21 +1457,45 @@
 	    if (xyc .EQ. 1)then
 	       if (sort .EQ. "time")then
-                  level = "z=" + z_d(lo) + "m"
+                  if(z_d(lo) .eq. -1.d) then
+                    level = "z-average"
+                  else
+                    level = "z=" + z_d(lo) + "m"
+                  end if
 	       else
-	          level = "z=" + z_d(li) + "m"
+                  if(z_d(li) .eq. -1.d) then
+                    level = "z-average"
+                  else
+	            level = "z=" + z_d(li) + "m"
+                  end if
 	       end if
 	    end if
 	    if (xzc .EQ. 1)then
 	       if (sort .EQ. "time")then
-                  level = "y=" + y_d(lo) + "m" 
+                 if(y_d(lo) .eq. -1.d) then
+                   level = "y-average"
+                 else
+                   level = "y=" + y_d(lo) + "m" 
+                 end if
 	       else
-	          level = "y=" + y_d(li) + "m"
+                  if(y_d(li) .eq. -1.d) then
+                    level = "y-average"
+                  else
+	            level = "y=" + y_d(li) + "m"
+                  end if
 	       end if
 	    end if
 	    if (yzc .EQ. 1)then
 	       if (sort .EQ. "time")then
-                  level = "x=" + x_d(lo) + "m" 
+                 if(x_d(lo) .eq. -1.d) then
+                    level = "x-average"
+                 else
+                    level = "x=" + x_d(lo) + "m" 
+                 end if
 	       else
-	          level = "x=" + x_d(li) + "m" 
+                 if(x_d(li) .eq. -1.d) then
+                    level = "x-average"
+                 else
+	            level = "x=" + x_d(li) + "m" 
+                 end if
 	       end if
 	    end if	    	  
@@ -1494,21 +1519,21 @@
 	    if (xyc .EQ. 1)then  
 	       if (sort .EQ. "time")then                                          
-                  plot(n) = gsn_csm_vector(wks_ps,vect1(li,lo,:,:),vect2(li,lo,:,:),vecres)
+                  plot(n) = gsn_csm_vector(wks_ps,vect1(li,lo-los,:,:),vect2(li,lo-los,:,:),vecres)
 	       else
-	          plot(n) = gsn_csm_vector(wks_ps,vect1(lo,li,:,:),vect2(lo,li,:,:),vecres)
+	          plot(n) = gsn_csm_vector(wks_ps,vect1(lo,li-lis,:,:),vect2(lo,li-lis,:,:),vecres)
 	       end if
 	    end if
 	    if (xzc .EQ. 1) then
 	       if (sort .EQ. "time")then 
-	          plot(n) = gsn_csm_vector(wks_ps,vect1(li,:,lo,:),vect2(li,:,lo,:),vecres)
+	          plot(n) = gsn_csm_vector(wks_ps,vect1(li,:,lo-los,:),vect2(li,:,lo-los,:),vecres)
 	       else
-	          plot(n) = gsn_csm_vector(wks_ps,vect1(lo,:,li,:),vect2(lo,:,li,:),vecres)
+	          plot(n) = gsn_csm_vector(wks_ps,vect1(lo,:,li-lis,:),vect2(lo,:,li-lis,:),vecres)
 	       end if
 	    end if
 	    if (yzc .EQ. 1) then
 	       if (sort .EQ. "time")then 
-	          plot(n) = gsn_csm_vector(wks_ps,vect1(li,:,:,lo),vect2(li,:,:,lo),vecres)
+	          plot(n) = gsn_csm_vector(wks_ps,vect1(li,:,:,lo-los),vect2(li,:,:,lo-los),vecres)
 	       else
-	          plot(n) = gsn_csm_vector(wks_ps,vect1(lo,:,:,li),vect2(lo,:,:,li),vecres)
+	          plot(n) = gsn_csm_vector(wks_ps,vect1(lo,:,:,li-lis),vect2(lo,:,:,li-lis),vecres)
 	       end if
 	    end if
@@ -1523,5 +1548,5 @@
          check_vecp = isStrSubset( plotvec,","+vNam(varn)+",") 
       end if 
-
+     
       if ( vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "xu" .or. vNam(varn) .eq. "zu" .or. vNam(varn) .eq. "zwwi" .or. vNam(varn) .eq. "zusi" .or. vNam(varn) .eq. "time" .or. vNam(varn) .eq. "zu_3d" .or. vNam(varn) .eq. "zw_3d" .or. vNam(varn) .eq. "x".or. vNam(varn) .eq. "y" .or. vNam(varn) .eq. "zu_xy" .or. vNam(varn) .eq. "zw_xy" .or. vNam(varn) .eq. "zu1_xy" .or. vNam(varn) .eq. "ind_z_xy" .or. vNam(varn) .eq. "y_xz" .or. vNam(varn) .eq. "yv_xz" .or. vNam(varn) .eq. "ind_y_xz" .or. vNam(varn) .eq. "x_yz" .or. vNam(varn) .eq. "xu_yz" .or. vNam(varn) .eq. "ind_x_yz") then
          check = False 
@@ -1561,12 +1586,12 @@
                   
                   if ( sort .eq. "time" ) then
-                     if ( z_d(zs+lo) .eq. -1)then
+                     if ( z_d(lo) .eq. -1)then
 		        if (delta_z .EQ. -1) then
                            level = "-average"
 			else
-			   level = "=" + z_d(zs+lo) + "m"
+			   level = "=" + z_d(lo) + "m"
 			end if
                      else 
-                        level = "=" + z_d(zs+lo) + "m"
+                        level = "=" + z_d(lo) + "m"
                      end if
 
@@ -1577,5 +1602,5 @@
                     
                      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) 
+                     plot(n) = gsn_csm_contour(wks_ps,data(varn,li,lo-los,:,:),cs_res) 
                      if (vector .EQ. 1 .AND. check_vecp) then
                         vecres                  = True            ; vector only resources
@@ -1588,5 +1613,5 @@
                         vecres@gsnLeftString    = " " 
   			vecres@tiXAxisString    = " "   
-                        plot_vec=gsn_csm_vector(wks_ps,vect1(li,lo,:,:),vect2(li,lo,:,:),vecres)
+                        plot_vec=gsn_csm_vector(wks_ps,vect1(li,lo-los,:,:),vect2(li,lo-los,:,:),vecres)
                         overlay(plot(n), plot_vec)
                      end if                         
@@ -1598,8 +1623,8 @@
                            level = "-average"
 			else
-			   level = "=" + z_d(zs+li) + "m"
+			   level = "=" + z_d(li) + "m"
 			end if
                      else 
-                        level = "=" + z_d(zs+li) + "m"
+                        level = "=" + z_d(li) + "m"
                      end if 
        
@@ -1611,5 +1636,5 @@
                      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)
+                     plot(n) = gsn_csm_contour(wks_ps,data(varn,lo,li-lis,:,:),cs_res)
                      if (vector .EQ. 1 .AND. check_vecp) then
                         vecres                  = True            ; vector only resources
@@ -1637,11 +1662,11 @@
                
                   if ( sort .eq. "time" ) then
-                     if ( y_d(ys+lo) .eq. -1 ) then
+                     if ( y_d(lo) .eq. -1 ) then
                         level = "-average"
                      else 
-                        level = "=" + y_d(ys+lo) + "m"
+                        level = "=" + y_d(lo) + "m"
                      end if
                      cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(li)/3600,2,True) + "h  y"+ level
-                     plot(n) = gsn_csm_contour(wks_ps,data(varn,li,:,lo,:),cs_res)
+                     plot(n) = gsn_csm_contour(wks_ps,data(varn,li,:,lo-los,:),cs_res)
                      if (vector .EQ. 1 .AND. check_vecp) then
                         vecres                  = True            ; vector only resources
@@ -1654,5 +1679,5 @@
   			vecres@gsnLeftString    = " "             ; turn off left string
   			vecres@tiXAxisString    = " "   
-                        plot_vec=gsn_csm_vector(wks_ps,vect1(li,:,lo,:),vect2(li,:,lo,:),vecres)
+                        plot_vec=gsn_csm_vector(wks_ps,vect1(li,:,lo-los,:),vect2(li,:,lo-los,:),vecres)
                         overlay(plot(n), plot_vec)
                      end if
@@ -1660,11 +1685,11 @@
 
                   if ( sort .eq. "layer" ) then
-                     if ( y_d(ys+li) .eq. -1 ) then
+                     if ( y_d(li) .eq. -1 ) then
                         level = "-average"
                      else 
-                        level = "=" + y_d(ys+li) + "m"
+                        level = "=" + y_d(li) + "m"
                      end if
                      cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(lo)/3600,2,True) + "h  y"+ level
-                     plot(n) = gsn_csm_contour(wks_ps,data(varn,lo,:,li,:),cs_res)
+                     plot(n) = gsn_csm_contour(wks_ps,data(varn,lo,:,li-lis,:),cs_res)
                      if (vector .EQ. 1 .AND. check_vecp) then
                         vecres                  = True            ; vector only resources
@@ -1677,5 +1702,5 @@
   			vecres@gsnLeftString    = " "             ; turn off left string
   			vecres@tiXAxisString    = " "   
-                        plot_vec=gsn_csm_vector(wks_ps,vect1(lo,:,li,:),vect2(lo,:,li,:),vecres)
+                        plot_vec=gsn_csm_vector(wks_ps,vect1(lo,:,li-lis,:),vect2(lo,:,li-lis,:),vecres)
                         overlay(plot(n), plot_vec)
                      end if
@@ -1695,8 +1720,8 @@
                         level = "-average"
                      else 
-                        level = "=" + x_d(xs+lo) + "m"
+                        level = "=" + x_d(lo) + "m"
                      end if
                      cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(li)/3600,2,True) + "h  x"+ level
-                     plot(n) = gsn_csm_contour(wks_ps,data(varn,li,:,:,lo),cs_res)
+                     plot(n) = gsn_csm_contour(wks_ps,data(varn,li,:,:,lo-los),cs_res)
     	             if (vector .EQ. 1 .AND. check_vecp) then
                         vecres                  = True            ; vector only resources
@@ -1709,5 +1734,5 @@
   			vecres@gsnLeftString    = " "             ; turn off left string
   			vecres@tiXAxisString    = " "   
-                        plot_vec=gsn_csm_vector(wks_ps,vect1(li,:,:,lo),vect2(li,:,:,lo),vecres)
+                        plot_vec=gsn_csm_vector(wks_ps,vect1(li,:,:,lo-los),vect2(li,:,:,lo-los),vecres)
                         overlay(plot(n), plot_vec)
                      end if
@@ -1718,8 +1743,8 @@
                         level = "-average"
                      else 
-                        level = "=" + x_d(xs+li) + "m"
+                        level = "=" + x_d(li) + "m"
                      end if
                      cs_res@gsnCenterString = "t=" + decimalPlaces(t_all(lo)/3600,2,True) + "h  x"+ level
-                     plot(n) = gsn_csm_contour(wks_ps,data(varn,lo,:,:,li),cs_res)
+                     plot(n) = gsn_csm_contour(wks_ps,data(varn,lo,:,:,li-lis),cs_res)
                      if (vector .EQ. 1 .AND. check_vecp)then
                         vecres                  = True            ; vector only resources
@@ -1732,5 +1757,5 @@
   			vecres@gsnLeftString    = " "             ; turn off left string
   			vecres@tiXAxisString    = " "   
-                        plot_vec=gsn_csm_vector(wks_ps,vect1(lo,:,:,li),vect2(lo,:,:,li),vecres)
+                        plot_vec=gsn_csm_vector(wks_ps,vect1(lo,:,:,li-lis),vect2(lo,:,:,li-lis),vecres)
                         overlay(plot(n), plot_vec)
                      end if 
