Index: palm/trunk/SCRIPTS/NCL/profiles.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/profiles.ncl	(revision 352)
+++ palm/trunk/SCRIPTS/NCL/profiles.ncl	(revision 353)
@@ -1524,5 +1524,8 @@
    res@xyDashPattern = 1*nof
 
-   
+   over_remind = False
+   if ( over .eq. 1)then
+     over_remind = True
+   end if 
    
    do varn = 0,dim-1 
@@ -1691,4 +1694,8 @@
             end do            
          end if
+
+         if (isStrSubset(data@long_name," SR " ) ) then
+           over = 0
+         end if 
 	 
          if (nof .EQ. 0) then
@@ -1698,23 +1705,56 @@
             z=z/norm_z
          end if
+
+         delta_z = z(1) - z(0)
+
+         max_z_int=doubletoint(max_z/delta_z)
+         min_z_int=doubletoint(min_z/delta_z)
+
+         if(max_z_int .eq. min_z_int)
+             print(" ")
+             print("Please increase 'max_z' or decrease 'min_z' so that there are")
+             print("at least two layers for the z-axis to plot")
+             print(" ")
+             exit
+         end if
+
+         if(min_z_int .gt. max_z_int)
+            print(" ")
+            print("'min_z' is greater than 'max_z',")
+            print("please change this")
+            print(" ")
+            exit
+         end if
+
+         if(max_z_int .gt. dimz-1)
+            max_z_int = dimz-1
+         end if
+
+         if(min_z_int .lt. 0)
+            min_z_int = 0
+         end if         
+         
 	 
-	 if (abs(min(data(varn,:,:))) .GT. 10)then
-	    min_value = abs(0.01*min(data(varn,:,:)))
-	    max_value = abs(0.01*max(data(varn,:,:)))
+	 if (abs(min(data(varn,:,min_z_int:max_z_int))) .GT. 10)then
+	    min_value = abs(0.001*min(data(varn,:,min_z_int:max_z_int)))
+	    max_value = abs(0.001*max(data(varn,:,min_z_int:max_z_int)))
 	 else
-	    if (abs(min(data(varn,:,:))) .LT. 0.01 .AND. abs(max(data(varn,:,:))) .GT. 0.01)then
-	       min_value = abs(0.1*max(data(varn,:,:)))
-	       max_value = abs(0.1*max(data(varn,:,:)))
+	    if (abs(min(data(varn,:,min_z_int:max_z_int))) .LT. 0.01 .AND. \
+                abs(max(data(varn,:,min_z_int:max_z_int))) .GT. 0.01)then
+	       min_value = abs(0.1*max(data(varn,:,min_z_int:max_z_int)))
+	       max_value = abs(0.1*max(data(varn,:,min_z_int:max_z_int)))
 	    else
-	       if (abs(max(data(varn,:,:))) .LT. 0.01 .AND. abs(min(data(varn,:,:))) .GT. 0.01)then
-	          min_value = abs(0.1*min(data(varn,:,:)))
-	          max_value = abs(0.1*min(data(varn,:,:)))
+	       if (abs(max(data(varn,:,min_z_int:max_z_int))) .LT. 0.01 .AND.\
+                   abs(min(data(varn,:,min_z_int:max_z_int))) .GT. 0.01)then
+	          min_value = abs(0.1*min(data(varn,:,min_z_int:max_z_int)))
+	          max_value = abs(0.1*min(data(varn,:,min_z_int:max_z_int)))
 	       else
-	          min_value = abs(0.1*min(data(varn,:,:)))
-	          max_value = abs(0.1*max(data(varn,:,:)))
+	          min_value = abs(0.1*min(data(varn,:,min_z_int:max_z_int)))
+	          max_value = abs(0.1*max(data(varn,:,min_z_int:max_z_int)))
 	       end if
 	    end if
 	 end if 
-	 if (min(data(varn,:,:)) .EQ. 0 .AND. max(data(varn,:,:)) .EQ. 0)then
+	 if (min(data(varn,:,min_z_int:max_z_int)) .EQ. 0 .AND. \
+             max(data(varn,:,min_z_int:max_z_int)) .EQ. 0)then
 	    min_value = 0.1
 	    max_value = 0.1
@@ -1728,19 +1768,20 @@
             res@trYMaxF            = max_z 
             if (xs .EQ. -1) then 
-               res@trXMinF            = min(data(varn,:,:))-min_value
+               res@trXMinF            = min(data(varn,:,min_z_int:max_z_int))-min_value
             else 
                res@trXMinF            = xs
             end if
             if (xe .EQ. -1) then 
-               res@trXMaxF            = max(data(varn,:,:))+max_value 
+               res@trXMaxF            = max(data(varn,:,min_z_int:max_z_int))+max_value 
             else 
                res@trXMaxF            = xe  
             end if         
             plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)  
-         end if  
-
-            if (vNam(varn) .EQ. "u") then 
-               miniu=min(data(varn,:,:))-min_value
-               maxiu=max(data(varn,:,:))+max_value
+         end if
+  
+     
+         if (vNam(varn) .EQ. "u" ) then
+               miniu=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiu=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -1763,7 +1804,7 @@
                end if
             end if
-            if (vNam(varn) .EQ. "v") then
-               miniv=min(data(varn,:,:))-min_value
-               maxiv=max(data(varn,:,:))+max_value
+            if (vNam(varn) .EQ. "v") then 
+               miniv=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiv=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyMonoDashPattern = True
@@ -1788,6 +1829,6 @@
             end if
             if (vNam(varn) .EQ. "w") then
-               miniw=min(data(varn,:,:))-min_value
-               maxiw=max(data(varn,:,:))+max_value
+               miniw=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiw=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern = 2
@@ -1812,6 +1853,6 @@
 
             if (vNam(varn) .EQ. "pt") then
-               minipt=min(data(varn,:,:))-min_value
-               maxipt=max(data(varn,:,:))+max_value
+               minipt=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxipt=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -1835,6 +1876,6 @@
             end if
             if (vNam(varn) .EQ. "vpt") then
-               minivpt=min(data(varn,:,:))-min_value
-               maxivpt=max(data(varn,:,:))+max_value
+               minivpt=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxivpt=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 1
@@ -1858,6 +1899,6 @@
             end if
             if (vNam(varn) .EQ. "lpt") then
-               minilpt=min(data(varn,:,:))-min_value
-               maxilpt=max(data(varn,:,:))+max_value
+               minilpt=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxilpt=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 2
@@ -1882,6 +1923,6 @@
 
             if (vNam(varn) .EQ. "q") then
-               miniq=min(data(varn,:,:))-min_value
-               maxiq=max(data(varn,:,:))+max_value
+               miniq=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiq=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -1905,6 +1946,6 @@
             end if
             if (vNam(varn) .EQ. "qv") then
-               miniqv=min(data(varn,:,:))-min_value
-               maxiqv=max(data(varn,:,:))+max_value
+               miniqv=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiqv=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then 
                   res@xyDashPattern  = 1
@@ -1928,6 +1969,6 @@
             end if
             if (vNam(varn) .EQ. "ql") then
-               miniql=min(data(varn,:,:))-min_value
-               maxiql=max(data(varn,:,:))+max_value
+               miniql=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiql=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 2
@@ -1952,6 +1993,6 @@
 
             if (vNam(varn) .EQ. "e") then
-               minie=min(data(varn,:,:))-min_value
-               maxie=max(data(varn,:,:))+max_value
+               minie=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxie=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -1975,6 +2016,6 @@
             end if
             if (vNam(varn) .EQ. "es") then
-               minies=min(data(varn,:,:))-min_value
-               maxies=max(data(varn,:,:))+max_value
+               minies=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxies=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 1
@@ -1999,6 +2040,6 @@
 
             if (vNam(varn) .EQ. "km") then
-               minikm=min(data(varn,:,:))-min_value
-               maxikm=max(data(varn,:,:))+max_value
+               minikm=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxikm=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -2022,6 +2063,6 @@
             end if
             if (vNam(varn) .EQ. "kh") then
-               minikh=min(data(varn,:,:))-min_value
-               maxikh=max(data(varn,:,:))+max_value
+               minikh=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxikh=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 1
@@ -2046,6 +2087,6 @@
 
             if (vNam(varn) .EQ. "wpup") then
-               miniwpup=min(data(varn,:,:))-min_value
-               maxiwpup=max(data(varn,:,:))+max_value
+               miniwpup=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwpup=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -2069,6 +2110,6 @@
             end if
             if (vNam(varn) .EQ. "wsus") then
-               miniwsus=min(data(varn,:,:))-min_value
-               maxiwsus=max(data(varn,:,:))+max_value
+               miniwsus=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwsus=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 1
@@ -2092,6 +2133,6 @@
             end if
             if (vNam(varn) .EQ. "wu") then
-               miniwu=min(data(varn,:,:))-min_value
-               maxiwu=max(data(varn,:,:))+max_value
+               miniwu=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwu=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 2 
@@ -2116,6 +2157,6 @@
 
             if (vNam(varn) .EQ. "wpvp") then
-               miniwpvp=min(data(varn,:,:))-min_value
-               maxiwpvp=max(data(varn,:,:))+max_value
+               miniwpvp=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwpvp=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -2139,6 +2180,6 @@
             end if
             if (vNam(varn) .EQ. "wsvs") then
-               miniwsvs=min(data(varn,:,:))-min_value
-               maxiwsvs=max(data(varn,:,:))+max_value
+               miniwsvs=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwsvs=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 1
@@ -2162,6 +2203,6 @@
             end if
             if (vNam(varn) .EQ. "wv") then
-               miniwv=min(data(varn,:,:))-min_value
-               maxiwv=max(data(varn,:,:))+max_value
+               miniwv=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwv=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 2 
@@ -2186,6 +2227,6 @@
 
             if (vNam(varn) .EQ. "wpptp") then
-               miniwpptp=min(data(varn,:,:))-min_value
-               maxiwpptp=max(data(varn,:,:))+max_value
+               miniwpptp=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwpptp=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -2209,6 +2250,6 @@
             end if
             if (vNam(varn) .EQ. "wspts") then
-               miniwspts=min(data(varn,:,:))-min_value
-               maxiwspts=max(data(varn,:,:))+max_value
+               miniwspts=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwspts=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 1
@@ -2232,6 +2273,6 @@
             end if
             if (vNam(varn) .EQ. "wpt") then       
-               miniwpt=min(data(varn,:,:))-min_value
-               maxiwpt=max(data(varn,:,:))+max_value
+               miniwpt=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwpt=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 2 
@@ -2256,6 +2297,6 @@
 
             if (vNam(varn) .EQ. "wsptsBC") then
-               miniwsptsBC=min(data(varn,:,:))-min_value
-               maxiwsptsBC=max(data(varn,:,:))+max_value
+               miniwsptsBC=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwsptsBC=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -2279,6 +2320,6 @@
             end if             
             if (vNam(varn) .EQ. "wptBC") then
-               miniwptBC=min(data(varn,:,:))-min_value
-               maxiwptBC=max(data(varn,:,:))+max_value
+               miniwptBC=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwptBC=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 1
@@ -2303,6 +2344,6 @@
 
             if (vNam(varn) .EQ. "wpvptp") then
-               miniwpvptp=min(data(varn,:,:))-min_value
-               maxiwpvptp=max(data(varn,:,:))+max_value
+               miniwpvptp=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwpvptp=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -2326,6 +2367,6 @@
             end if
             if (vNam(varn) .EQ. "wsvpts") then
-               miniwsvpts=min(data(varn,:,:))-min_value
-               maxiwsvpts=max(data(varn,:,:))+max_value
+               miniwsvpts=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwsvpts=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 1
@@ -2349,6 +2390,6 @@
             end if
             if (vNam(varn) .EQ. "wvpt") then
-               miniwvpt=min(data(varn,:,:))-min_value
-               maxiwvpt=max(data(varn,:,:))+max_value
+               miniwvpt=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwvpt=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 2 
@@ -2373,6 +2414,6 @@
 
             if (vNam(varn) .EQ. "wpqp") then
-               miniwpqp=min(data(varn,:,:))-min_value
-               maxiwpqp=max(data(varn,:,:))+max_value
+               miniwpqp=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwpqp=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -2396,6 +2437,6 @@
             end if
             if (vNam(varn) .EQ. "wsqs") then
-               miniwsqs=min(data(varn,:,:))-min_value
-               maxiwsqs=max(data(varn,:,:))+max_value
+               miniwsqs=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwsqs=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 1
@@ -2419,6 +2460,6 @@
             end if
             if (vNam(varn) .EQ. "wq") then
-               miniwq=min(data(varn,:,:))-min_value
-               maxiwq=max(data(varn,:,:))+max_value
+               miniwq=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwq=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 2
@@ -2443,6 +2484,6 @@
 
             if (vNam(varn) .EQ. "wpqvp") then
-               miniwpqvp=min(data(varn,:,:))-min_value
-               maxiwpqvp=max(data(varn,:,:))+max_value
+               miniwpqvp=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwpqvp=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0 
@@ -2466,6 +2507,6 @@
             end if
             if (vNam(varn) .EQ. "wsqvs") then
-               miniwsqvs=min(data(varn,:,:))-min_value
-               maxiwsqvs=max(data(varn,:,:))+max_value
+               miniwsqvs=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwsqvs=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 1
@@ -2489,6 +2530,6 @@
             end if
             if (vNam(varn) .EQ. "wqv") then
-               miniwqv=min(data(varn,:,:))-min_value
-               maxiwqv=max(data(varn,:,:))+max_value
+               miniwqv=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwqv=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 2
@@ -2513,6 +2554,6 @@
 
             if (vNam(varn) .EQ. "wpsp") then
-               miniwpsp=min(data(varn,:,:))-min_value
-               maxiwpsp=max(data(varn,:,:))+max_value
+               miniwpsp=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwpsp=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -2536,6 +2577,6 @@
             end if 
             if (vNam(varn) .EQ. "wsss") then
-               miniwsss=min(data(varn,:,:))-min_value
-               maxiwsss=max(data(varn,:,:))+max_value
+               miniwsss=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwsss=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 1 
@@ -2559,6 +2600,6 @@
             end if
             if (vNam(varn) .EQ. "ws") then
-               miniws=min(data(varn,:,:))-min_value
-               maxiws=max(data(varn,:,:))+max_value
+               miniws=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiws=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 2
@@ -2583,6 +2624,6 @@
 
             if (vNam(varn) .EQ. "wpsap") then
-               miniwpsap=min(data(varn,:,:))-min_value
-               maxiwpsap=max(data(varn,:,:))+max_value
+               miniwpsap=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwpsap=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -2606,6 +2647,6 @@
             end if
             if (vNam(varn) .EQ. "wssas") then
-               miniwssas=min(data(varn,:,:))-min_value
-               maxiwssas=max(data(varn,:,:))+max_value
+               miniwssas=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwssas=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 1
@@ -2629,6 +2670,6 @@
             end if
             if (vNam(varn) .EQ. "wsa") then
-               miniwsa=min(data(varn,:,:))-min_value
-               maxiwsa=max(data(varn,:,:))+max_value
+               miniwsa=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwsa=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 2
@@ -2653,6 +2694,6 @@
 
             if (vNam(varn) .EQ. "us2") then
-               minius2=min(data(varn,:,:))-min_value
-               maxius2=max(data(varn,:,:))+max_value
+               minius2=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxius2=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -2676,6 +2717,6 @@
             end if
             if (vNam(varn) .EQ. "vs2") then
-               minivs2=min(data(varn,:,:))-min_value
-               maxivs2=max(data(varn,:,:))+max_value
+               minivs2=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxivs2=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 1
@@ -2699,6 +2740,6 @@
             end if
             if (vNam(varn) .EQ. "ws2") then
-               miniws2=min(data(varn,:,:))-min_value
-               maxiws2=max(data(varn,:,:))+max_value
+               miniws2=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiws2=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 2 
@@ -2723,6 +2764,6 @@
 
             if (vNam(varn) .EQ. "wsususodz") then
-               miniwsususodz=min(data(varn,:,:))-min_value
-               maxiwsususodz=max(data(varn,:,:))+max_value
+               miniwsususodz=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwsususodz=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 0
@@ -2746,6 +2787,6 @@
             end if
             if (vNam(varn) .EQ. "wspsodz") then
-               miniwspsodz=min(data(varn,:,:))-min_value
-               maxiwspsodz=max(data(varn,:,:))+max_value
+               miniwspsodz=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwspsodz=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 1
@@ -2769,6 +2810,6 @@
             end if
             if (vNam(varn) .EQ. "wpeodz") then
-               miniwpeodz=min(data(varn,:,:))-min_value
-               maxiwpeodz=max(data(varn,:,:))+max_value
+               miniwpeodz=min(data(varn,:,min_z_int:max_z_int))-min_value
+               maxiwpeodz=max(data(varn,:,min_z_int:max_z_int))+max_value
                if (over .EQ. 1) then
                   res@xyDashPattern  = 2 
@@ -2816,5 +2857,13 @@
    end do
    ;#########ENDE DO LOOP FOR no_files GT 1#############
-   
+
+   if (isStrSubset(data@long_name," SR " ) .and. over_remind) then
+      print(" ")
+      print("If you have outputs of statistic regions you cannot overlay variables;")
+      print("'over' is set to 0" )
+      print(" ")
+      over = 0
+   end if 
+
    if (count_var .EQ. 0) then
       print(" ")
@@ -2824,12 +2873,4 @@
       print(" ")
       exit        
-   end if
-
-   if (isStrSubset(data@long_name," SR " ))then
-      print(" ")
-      print("If you have outputs of statistic regions you cannot overlay variables;")
-      print("'over' is set to 0" )
-      print(" ")
-      over = 0
    end if
    
@@ -3002,22 +3043,25 @@
             z=z/norm_z
 	    
-	    if (abs(min(data(varn,:,:))) .GT. 10)then
-	       min_value = abs(0.01*min(data(varn,:,:)))
-	       max_value = abs(0.01*max(data(varn,:,:)))
+	    if (abs(min(data(varn,:,min_z_int:max_z_int))) .GT. 10)then
+	       min_value = abs(0.01*min(data(varn,:,min_z_int:max_z_int)))
+	       max_value = abs(0.01*max(data(varn,:,min_z_int:max_z_int)))
 	    else
-	       if (abs(min(data(varn,:,:))) .LT. 0.01 .AND. abs(max(data(varn,:,:))) .GT. 0.01)then
-	          min_value = abs(0.1*max(data(varn,:,:)))
-	          max_value = abs(0.1*max(data(varn,:,:)))
+	       if (abs(min(data(varn,:,min_z_int:max_z_int))) .LT. 0.01 .AND. \
+                   abs(max(data(varn,:,min_z_int:max_z_int))) .GT. 0.01)then
+	          min_value = abs(0.1*max(data(varn,:,min_z_int:max_z_int)))
+	          max_value = abs(0.1*max(data(varn,:,min_z_int:max_z_int)))
 	       else
-	          if (abs(max(data(varn,:,:))) .LT. 0.01 .AND. abs(min(data(varn,:,:))) .GT. 0.01)then
-	             min_value = abs(0.1*min(data(varn,:,:)))
-	             max_value = abs(0.1*min(data(varn,:,:)))
+	          if (abs(max(data(varn,:,:))) .LT. 0.01 .AND. \
+                      abs(min(data(varn,:,min_z_int:max_z_int))) .GT. 0.01)then
+	             min_value = abs(0.1*min(data(varn,:,min_z_int:max_z_int)))
+	             max_value = abs(0.1*min(data(varn,:,min_z_int:max_z_int)))
 	          else
-	             min_value = abs(0.1*min(data(varn,:,:)))
-	             max_value = abs(0.1*max(data(varn,:,:)))
+	             min_value = abs(0.1*min(data(varn,:,min_z_int:max_z_int)))
+	             max_value = abs(0.1*max(data(varn,:,min_z_int:max_z_int)))
 	          end if
 	       end if
 	    end if 
-	    if (min(data(varn,:,:)) .EQ. 0 .AND. max(data(varn,:,:)) .EQ. 0)then
+	    if (min(data(varn,:,min_z_int:max_z_int)) .EQ. 0 .AND.\
+                max(data(varn,:,min_z_int:max_z_int)) .EQ. 0)then
 	       min_value = 0.1
 	       max_value = 0.1
@@ -3032,10 +3076,10 @@
 
             if (xs .EQ. -1) then 
-               res@trXMinF = min(data(varn,:,:))-min_value
+               res@trXMinF = min(data(varn,:,min_z_int:max_z_int))-min_value
             else 
                res@trXMinF = xs
             end if
             if (xe .EQ. -1) then 
-               res@trXMaxF = max(data(varn,:,:))+max_value
+               res@trXMaxF = max(data(varn,:,min_z_int:max_z_int))+max_value
             else 
                res@trXMaxF = xe  
