Index: palm/trunk/SCRIPTS/NCL/.ncl_preferences
===================================================================
--- palm/trunk/SCRIPTS/NCL/.ncl_preferences	(revision 156)
+++ palm/trunk/SCRIPTS/NCL/.ncl_preferences	(revision 157)
@@ -5,19 +5,19 @@
 _________________________________________________________________________________________________
 
-___'file_in'_________[path/name.nc, i.e. ~/.../example.nc]______default = input file______[ALL]
+___'file_in'_________[path/name.nc; i.e. ~/.../example.nc]______default = input file______[ALL]
 input file
-___'format_out'______[ncgm, ps, eps, epsi, pdf, x11]____________default = x11_____________[ALL]
+___'format_out'______[ncgm; ps; eps; epsi; pdf; x11]____________default = x11_____________[ALL]
 x11
-___'file_out'________[path/name, i.e. ~/.../test]_______________default = test____________[ALL]
+___'file_out'________[path/name; i.e. ~/.../test]_______________default = test____________[ALL]
 test
-___start_time_step___[0,1,...]__________________________________default = 1_______________[ALL]
+___start_time_step___[0;1;...]__________________________________default = 1_______________[ALL]
 1
-___end_time_step_____[1,2,...]__________________________________default = nt-1____________[ALL]
-nt-1
-___no_columns________[1,2,...]__________________________________default = 1_______________[ALL]
+___end_time_step_____[1;2;...]__________________________________default = nt______________[ALL]
+nt
+___no_columns________[1;2;...]__________________________________default = 1_______________[ALL]
 1
-___no_lines__________[1,2,...]__________________________________default = 2_______________[ALL]
+___no_lines__________[1;2;...]__________________________________default = 2_______________[ALL]
 2
-___'var'_____________[E dt umax,...]____________________________default = variables_______[ALL]
+___'var'_____________[E,dt,umax,;...]___________________________default = variables_______[ALL]
 variables
 ___combine___________[0] or [1]_________________________________default = 0_______________[PR]
@@ -25,5 +25,5 @@
 ___number_comb_______[0] or [1]_________________________________default = 0_______________[PR]
 0
-___'c_var'___________[umax vmax wmax ,...]______________________default = c_variables_____[PR]
+___'c_var'___________[umax,vmax,wmax,;...]______________________default = c_variables_____[PR]
 c_variables
 ___dash______________[0] or [1]_________________________________default = 0_______________[PR]
@@ -31,7 +31,7 @@
 ___black_____________[0] or [1]_________________________________default = 0_______________[PR]
 0
-___min_z_____________[0,10,...]_________________________________default = 0_______________[PR]
+___min_z_____________[0;10;...]_________________________________default = 0_______________[PR]
 0
-___max_z_____________[100,1000,...]_____________________________default = max(z_pr)_______[PR] 
+___max_z_____________[100;1000;...]_____________________________default = max(z_pr)_______[PR] 
 max(z_pr)
 ___'sort'____________[time] or [layer]__________________________default = time____________[CS]
@@ -43,6 +43,6 @@
 ___shape_____________[0] or [1]_________________________________default = 1_______________[CS]
 1
-___xyc_______________[0] or [1]_________________________________default = 1_______________[CS]
-1
+___xyc_______________[0] or [1]_________________________________default = 0_______________[CS]
+0
 ___xzc_______________[0] or [1]_________________________________default = 0_______________[CS]
 0
@@ -51,16 +51,23 @@
 ___xs________________[0,1,...]__________________________________default = 0_______________[CS]
 0
-___xe________________[1,2,...]__________________________________default = xdim____________[CS]
+___xe________________[1;2;...]__________________________________default = xdim____________[CS]
 xdim
-___ys________________[0,1,...]__________________________________default = 0_______________[CS]
- 0
-___ye________________[1,2,...]__________________________________default = ydim____________[CS]
+___ys________________[0;1;...]__________________________________default = 0_______________[CS]
+0
+___ye________________[1;2;...]__________________________________default = ydim____________[CS]
 ydim
-___zs________________[0,1,...]__________________________________default = 0_______________[CS]
+___zs________________[0;1;...]__________________________________default = 0_______________[CS]
 0
-___ze________________[1,2,...]__________________________________default = zdim____________[CS]
+___ze________________[1;2;...]__________________________________default = zdim____________[CS]
 zdim
-___end of file "parameter_list_cross_section__________________________________________________
-
-
-
+___vector____________[0] or [1]_________________________________default = 0_______________[CS]
+0
+___'vec1'____________[u,;v,;...]________________________________default = vec1____________[CS]
+vec1
+___'vec2'____________[u,;v,;...]________________________________default = vec2____________[CS]
+vec2
+__'plotvec'__________[u,;v,;...]________________________________default = plotvec_________[CS]
+plotvec
+___ref_mag___________[0.1;0.02;...]_____________________________default = 0.05____________[CS]
+0.05
+___end of file ".ncl_preferences"_____________________________________________________________
Index: palm/trunk/SCRIPTS/NCL/cross_sections.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/cross_sections.ncl	(revision 156)
+++ palm/trunk/SCRIPTS/NCL/cross_sections.ncl	(revision 157)
@@ -1,3 +1,4 @@
 load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
@@ -11,5 +12,5 @@
 
    if (isfilepresent("~/.ncl_preferences")) then
-      parameter = asciiread("~/.ncl_preferences",63,"string")
+      parameter = asciiread("~/.ncl_preferences",73,"string")
       delete(parameter@_FillValue)
    else
@@ -177,4 +178,22 @@
       end if
    end if
+   if ( .not. isvar("vector") ) then   			; sort of plots
+      vector = 0
+      if (parameter(63) .NE. "0") then
+         vector = stringtointeger(parameter(63)) 
+         if (stringtointeger(parameter(63)) .NE. 1) then
+            print(" ")
+            print("Please set 'vector' to 0 or 1")
+            print(" ")
+            exit
+         end if   
+      end if
+   end if
+   if ( .not. isvar("ref_mag") ) then   			; sort of plots
+      ref_mag = 0.05
+      if (parameter(71) .NE. "0.05") then
+         ref_mag = stringtofloat(parameter(71))   
+      end if
+   end if 
 
    ; ***************************************************
@@ -257,7 +276,138 @@
    print(" ")
 
-   do varn=0,dim-1    
-
-      data_all = f->$vNam(varn)$
+   ; *********************************************
+   ; set up of start_time_step and end_time_step
+   ; *********************************************
+
+   t = f->time
+   nt = dimsizes(t)
+     
+   ; *********************************************	
+   ; start of time step and different types of mistakes that could be done
+   ; *********************************************
+
+   if ( .not. isvar("start_time_step") ) then   	
+      start_time_step = 1
+      if (parameter(13) .NE. "1") then
+         if (parameter(13) .LE. "0")
+            print(" ")
+            print("Begin with time step 1")
+            print(" ")
+            exit
+         end if
+         if (stringtointeger(parameter(13)) .GT. nt)
+            print(" ")
+            print("'start_time_step' = "+ parameter(13) +" is greater than available time steps = " + (nt))
+            print(" ")
+            exit
+         end if
+         start_time_step = stringtointeger(parameter(13))  
+      end if
+   else 
+      if (start_time_step .LE. 0)
+         print(" ")
+         print("Begin with time step 1")
+         print(" ")
+         exit
+      end if
+      if (start_time_step .GT. nt)
+         print(" ")
+         print("'start_time_step' = "+ start_time_step +" is greater than available time steps = " + (nt)) 
+         print(" ")
+         exit
+      end if
+   end if
+
+   ; ****************************************************
+   ; end of time step and different types of mistakes that could be done
+   ; ****************************************************
+
+   if ( .not. isvar("end_time_step") ) then     	
+      end_time_step = nt
+      if (parameter(15) .NE. "nt") then
+         if (parameter(15) .LE. "0")
+            print(" ")
+            print("'end_time_step' = "+parameter(15)+ " is too small; 'end_time_step' should be at least 1 ")
+            print(" ")
+            exit
+         end if
+         if (stringtointeger(parameter(15)) .GT. nt)
+            print(" ")
+            print("'end_time_step' = "+ parameter(15) +" is greater than available time steps = " + (nt))
+            print(" ")
+            exit
+         end if
+         if (stringtointeger(parameter(15)) .LT. stringtointeger(parameter(13)) )
+            print(" ")
+            print("'end_time_step' = "+ parameter(15) +" is lower than 'start_time_step' = "+parameter(15))
+            print(" ")
+            exit
+         end if
+         end_time_step = stringtointeger(parameter(15))  
+      end if    
+   else
+      if (end_time_step .LE. 0)
+         print(" ")
+         print("'end_time_step' = "+end_time_step+ " is too small; 'end_time_step' should be at least 1 ")
+         print(" ")
+         exit
+      end if
+      if (end_time_step .GT. nt)
+         print(" ")
+         print("'end_time_step' = "+ end_time_step +" is greater than available time steps = "+(nt))
+         print(" ") 
+         exit
+      end if
+      if (end_time_step .LT. start_time_step)
+         print(" ")
+         print("'end_time_step' = "+end_time_step +" is lower than 'start_time_step' = "+start_time_step)
+         print(" ")
+         exit
+      end if
+   end if
+
+   ; ****************************************************
+   ; set up variables for vector plot if required
+   ; ****************************************************   
+
+   if (vector .EQ. 1) then
+      if ( .not. isvar("plotvec") ) then
+         plotvec = parameter(69)
+         if (parameter(69) .EQ. "plotvec") then
+            print(" ")
+            print("Please indicate the variable where the vector plot shall overlay ('plotvec')")
+            print(" ")
+            exit
+         end if
+      end if
+      if ( .not. isvar("vec1") ) then
+         vec1 = parameter(65)
+         if (parameter(65) .EQ. "vec1") then
+            print(" ")
+            print("Please indicate Vector 1 ('vec1') for Vector-Plot")
+            print(" ")
+            exit
+         end if
+      end if
+      if ( .not. isvar("vec2") ) then
+         vec2 = parameter(67)
+         if (parameter(67) .EQ. "vec2") then
+            print(" ")
+            print("Please indicate Vector 2 ('vec2') for Vector-Plot")
+            print(" ")
+            exit
+         end if
+      end if             
+   end if 
+
+   check_vec1 = False
+   check_vec2 = False
+   check_vecp = False
+
+   ; ****************************************************
+   ; get data for plots
+   ; ****************************************************
+
+   do varn=0,dim-1  
 
       if ( vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "xu" ) then
@@ -266,6 +416,5 @@
       if ( vNam(varn) .eq. "zwwi" .or. vNam(varn) .eq. "zusi") then
          check = False
-      end if
-      
+      end if      
       if (  isvar("var") ) then  
          check = isStrSubset( var,vNam(varn)+",")
@@ -274,101 +423,9 @@
          var = parameter(21) 
          check = isStrSubset( var,vNam(varn)+"," ) 
-      end if 
+      end if   
 
       if(check) then
-
-         print("plot of "+vNam(varn))
-         print(" ")
-
-         ; *********************************************
-         ; set up of start_time_step and end_time_step
-         ; *********************************************
-
-         t = f->time
-         nt = dimsizes(t)
-         
-         ; *********************************************	
-         ; start of time step and different types of mistakes that could be done
-         ; *********************************************
-
-         if ( .not. isvar("start_time_step") ) then   	
-            start_time_step = 1
-            if (parameter(13) .NE. "1") then
-               if (parameter(13) .LE. "0")
-                  print(" ")
-                  print("Begin with time step 1")
-                  print(" ")
-                  exit
-               end if
-               if (stringtointeger(parameter(13)) .GE. nt)
-                  print(" ")
-                  print("'start_time_step' = "+ parameter(13) +" is greater than available time steps = " + (nt-1))
-                  print(" ")
-                  exit
-               end if
-               start_time_step = stringtointeger(parameter(13))  
-            end if
-         else 
-            if (start_time_step .LE. 0)
-               print(" ")
-               print("Begin with time step 1")
-               print(" ")
-               exit
-            end if
-            if (start_time_step .GE. nt)
-               print(" ")
-               print("'start_time_step' = "+ start_time_step +" is greater than available time steps = " + (nt-1)) 
-               print(" ")
-               exit
-            end if
-         end if
-
-         ; ****************************************************
-         ; end of time step and different types of mistakes that could be done
-         ; ****************************************************
-
-         if ( .not. isvar("end_time_step") ) then     	
-            end_time_step = nt-1
-            if (parameter(15) .NE. "nt-1") then
-               if (parameter(15) .LE. "0")
-                  print(" ")
-                  print("'end_time_step' = "+parameter(15)+ " is too small; 'end_time_step' should be at least 1 ")
-                  print(" ")
-                  exit
-               end if
-               if (stringtointeger(parameter(15)) .GE. nt)
-                  print(" ")
-                  print("'end_time_step' = "+ parameter(15) +" is greater than available time steps = " + (nt-1))
-                  print(" ")
-                  exit
-               end if
-               if (stringtointeger(parameter(15)) .LT. stringtointeger(parameter(13)) )
-                  print(" ")
-                  print("'end_time_step' = "+ parameter(15) +" is lower than 'start_time_step' = "+parameter(15))
-                  print(" ")
-                  exit
-               end if
-               end_time_step = stringtointeger(parameter(15))  
-            end if    
-         else
-            if (end_time_step .LE. 0)
-               print(" ")
-               print("'end_time_step' = "+end_time_step+ " is too small; 'end_time_step' should be at least 1 ")
-               print(" ")
-               exit
-            end if
-            if (end_time_step .GE. nt)
-               print(" ")
-               print("'end_time_step' = "+ end_time_step +" is greater than available time steps = "+(nt-1))
-               print(" ") 
-               exit
-            end if
-            if (end_time_step .LT. start_time_step)
-               print(" ")
-               print("'end_time_step' = "+end_time_step +" is lower than 'start_time_step' = "+start_time_step)
-               print(" ")
-               exit
-            end if
-         end if
+       
+         data_all = f->$vNam(varn)$
 
          ; ****************************************************
@@ -378,6 +435,6 @@
          xdim = dimsizes(data_all(0,0,0,:)) - 1    
          ydim = dimsizes(data_all(0,0,:,0)) - 1        
-         zdim = dimsizes(data_all(0,:,0,0)) - 1   
-    
+         zdim = dimsizes(data_all(0,:,0,0)) - 1  
+       
          if ( .not. isvar("xe")) then     ; output x-coordinate range end (in index)
             xe = xdim
@@ -398,17 +455,18 @@
             end if 
          else
-           if (xe .GT. xdim) then
-              print(" ")
-              print("range end for x-coordinate = "+xe+" is higher than available dimensions = "+xdim)
-              print(" ")
-              exit
-           end if
-           if (xe .LT. 0 .OR. xe .LT. xs) then
-              print(" ")
-              print("range end for x-coordinate = "+xe+" is too small")
-              print(" ")
-              exit
-           end if                  
-         end if
+            if (xe .GT. xdim) then
+               print(" ")
+               print("range end for x-coordinate = "+xe+" is higher than available dimensions = "+xdim)
+               print(" ")
+               exit
+            end if
+            if (xe .LT. 0 .OR. xe .LT. xs) then
+               print(" ")
+               print("range end for x-coordinate = "+xe+" is too small")
+               print(" ")
+               exit
+            end if                  
+         end if
+
          if ( .not. isvar("ye")) then     ; output y-coordinate range end (in index)
             ye = ydim
@@ -433,13 +491,14 @@
                print("range end for y-coordinate = "+ye+" is higher than available dimensions = "+ydim)
                print(" ")
+               exit 
+            end if
+            if (ye .LT. 0 .OR. ye .LT. ys) then
+               print(" ")
+               print("range end for y-coordinate = "+ye+" is too small")
+               print(" ")
                exit
             end if
-            if (ye .LT. 0 .OR. ye .LT. ys) then
-               print(" ")
-               print("range end for y-coordinate = "+ye+" is too small")
-               print(" ")
-               exit
-            end if
-         end if
+         end if
+
          if ( .not. isvar("ze")) then     ; output z-coordinate range end (in index)
             ze = zdim
@@ -472,46 +531,152 @@
                exit
             end if
-         end if
+         end if   
+         delete(data_all)
+      end if  
+   end do
+
+   data  = new((/dim,nt,(ze-zs)+1,(ye-ys)+1,(xe-xs)+1/),float)
+
+   ; ****************************************************
+   ; define inner and outer loops depending on "sort"
+   ; ****************************************************       
+    
+   if ( xyc .eq. 1 ) then
+      lays = zs
+      laye = ze
+   end if
+   if ( xzc .eq. 1 ) then
+      lays = ys
+      laye = ye
+   end if
+   if ( yzc .eq. 1) then
+      lays = xs
+      laye = xe
+   end if
+
+   if ( sort .eq. "time" ) then
+      lis = start_time_step
+      lie = end_time_step
+      los = lays 
+      loe = laye
+   else
+      lis = lays
+      lie = laye
+      los = start_time_step 
+      loe = end_time_step
+   end if 
+
+   check = True
+   v1=0
+   v2=0
+
+   do varn=0,dim-1  
+      
+      data_all = f->$vNam(varn)$ 
+
+      if (vector .EQ. 1) then    
+         check_vec1 = isStrSubset( vec1,vNam(varn)+",")
+         check_vec2 = isStrSubset( vec2,vNam(varn)+",")
+      end if
+           
+      if ( vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "xu" ) then
+         check = False
+      end if
+      if ( vNam(varn) .eq. "zwwi" .or. vNam(varn) .eq. "zusi") then
+         check = False
+      end if      
+      if (  isvar("var") ) then  
+         check = isStrSubset( var,vNam(varn)+",")
+      end if
   
-         ; Defining inner and outer loop depending on variable
-         ; "sort" (values: time or layers) 
+      if (parameter(21) .NE. "variables") then
+         var = parameter(21) 
+         check = isStrSubset( var,vNam(varn)+"," ) 
+      end if  
+
+      if(check) then 
+
+         if (vector .EQ. 1) then
+            if (vNam(varn)+"," .EQ. vec1) then
+               v1=v1+1
+            end if
+            if (vNam(varn)+"," .EQ. vec2) then
+               v2=v2+1
+            end if
+         end if 
+
+         data(varn,:,:,:,:)=data_all(0:nt-1,zs:ze,ys:ye,xs:xe) 
+         if (check_vec1) then
+            print("in vec1")
+            vect1=data_all
+         end if
+         if (check_vec2) then
+             print("in vec2")
+            vect2=data_all
+         end if
+
+         data!0 = "var"
+   	 data!1 = "t"
+   	 data!2 = "z"
+   	 data!3 = "y"
+   	 data!4 = "x"   
+
+      end if
+
+      delete(data_all)
+
+   end do  
+
+   if (vector .EQ. 1) then
+      if (v1 .EQ. 0)then
+         print(" ")
+         print("Varible for vector-plot ('vec1') must be one of the varibles for plot ('var')")
+         print(" ")
+         exit
+      end if
+
+      if (v2 .EQ. 0)then
+         print(" ")
+         print("Varible for vector-plot ('vec2') must be one of the varibles for plot ('var')")
+         print(" ")
+         exit
+      end if
+   end if
+
+   ; ***************************************************
+   ; create plots 
+   ; ***************************************************
+
+   check = True
+
+   do varn=0,dim-1 
+
+      if (vector .EQ. 1) then    
+         check_vecp = isStrSubset( plotvec,vNam(varn)+",") 
+      end if 
+
+      if ( vNam(varn) .eq. "zw" .or. vNam(varn) .eq. "yv" .or. vNam(varn) .eq. "xu" ) then
+         check = False
+      end if
+      if ( vNam(varn) .eq. "zwwi" .or. vNam(varn) .eq. "zusi") then
+         check = False
+      end if      
+      if (  isvar("var") ) then  
+         check = isStrSubset( var,vNam(varn)+",")
+      end if
+      if (parameter(21) .NE. "variables") then
+         var = parameter(21) 
+         check = isStrSubset( var,vNam(varn)+"," ) 
+      end if 
     
-         if ( xyc .eq. 1 ) then
-            lays = zs
-            laye = ze
-         end if
-         if ( xzc .eq. 1 ) then
-            lays = ys
-            laye = ye
-         end if
-         if ( yzc .eq. 1) then
-            lays = xs
-            laye = xe
-         end if
-
-         if ( sort .eq. "time" ) then
-            lis = start_time_step
-            lie = end_time_step
-            los = lays 
-            loe = laye
-         else
-            lis = lays
-            lie = laye
-            los = start_time_step 
-            loe = end_time_step
-         end if 
-
-
-         ; loops over time and layer (order depends on "sort")
+      if(check) then
+      
+         ; ****************************************************
+         ; loops over time and layer
+         ; **************************************************** 
 
          do lo = los, loe           				; lo: loop outer
-            do li = lis, lie, no_lines*no_columns		; li: loop inner
-
-               print("page "+page)
-               page = page + 1
-
-               ; Defining indices for reading data needed to plot one page
-	       ; The indices depend on the parameter "sort"
-
+            do li = lis, lie, no_lines*no_columns		; li: loop inner 
+               
                if ( sort .eq. "time" ) then
                   ta = li
@@ -570,111 +735,199 @@
                      zb = ze
                   end if
-               end if
-                            
-               data = data_all(ta:tb,za:zb,ya:yb,xa:xb)
-       
-               data!0 = "t"
-               data!1 = "z"
-               data!2 = "y"
-               data!3 = "x"
-
-               ; set up labels and plot
-
+               end if   
+
+               ; ****************************************************
                ; xy cross section
-
-               if ( xyc .eq. 1 ) then
+               ; ****************************************************
+
+               if ( xyc .eq. 1 ) then 
+                
                   cs_res@tiXAxisString   = "x [m]"
                   cs_res@tiYAxisString   = "y [m]"
-
+                  cs_res@gsnLeftString = "Plot of "+vNam(varn)
+                  
                   if ( sort .eq. "time" ) then
-                     if ( data&z(0) .eq. -1 ) then
+                     if ( data&z(lo) .eq. -1 ) then
                         level = "-average"
                      else 
-                        level = "=" + data&z(0) + "m"
+                        level = "=" + data&z(lo) + "m"
+                     end if
+                     do n = 0,tb-ta
+                        cs_res@gsnCenterString = "time=" + data&t(li+n-1) +"s  z"+level
+                        plot1 = gsn_csm_contour(wks_ps,data(varn,li+n-1,lo,:,:),cs_res)  
+                        if (check_vecp)
+                           vecres                  = True            ; vector only resources
+  			   vecres@gsnDraw          = False           ; don't draw
+  			   vecres@gsnFrame         = False           ; don't advance frame
+  			   vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
+  			   vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
+  			   vecres@vcRefLengthF     = 0.05            ; define length of vec ref
+  			   vecres@gsnRightString   = " "             ; turn off right string
+  			   vecres@gsnLeftString    = " "             ; turn off left string
+  			   vecres@tiXAxisString    = " "   
+                           plot_vec=gsn_csm_vector(wks_ps,vect1(li+n-1,lo,:,:),vect2(li+n-1,lo,:,:),vecres)
+                           overlay(plot1, plot_vec)
+                        end if                      
+                        plot(n) = plot1                         
+                     end do
+                  end if
+
+                  if ( sort .eq. "layer" ) then
+                     do n = 0, zb-za
+                        if ( data&z(li+n) .eq. -1 ) then
+                           level = "-average"
+                        else 
+                           level = "=" + data&z(li+n) + "m"
+                        end if
+                        cs_res@gsnCenterString = "t=" + data&t(lo-1) + "s  z"+ level
+                        plot1 = gsn_csm_contour(wks_ps,data(varn,lo-1,li+n,:,:),cs_res)
+                        if (check_vecp)
+                           vecres                  = True            ; vector only resources
+  			   vecres@gsnDraw          = False           ; don't draw
+  			   vecres@gsnFrame         = False           ; don't advance frame
+  			   vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
+  			   vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
+  			   vecres@vcRefLengthF     = 0.05            ; define length of vec ref
+  			   vecres@gsnRightString   = " "             ; turn off right string
+  			   vecres@gsnLeftString    = " "             ; turn off left string
+  			   vecres@tiXAxisString    = " "   
+                           plot_vec=gsn_csm_vector(wks_ps,vect1(lo-1,li+n,:,:),vect2(lo-1,li+n,:,:),vecres)
+                           overlay(plot1, plot_vec)
+                        end if 
+                        plot(n) = plot1
+                     end do
+                  end if
+
+               end if
+
+               ; ****************************************************
+               ; xz cross section
+               ; ****************************************************
+
+               if ( xzc .eq. 1 ) then
+        
+                  cs_res@tiXAxisString   = "x [m]"
+                  cs_res@tiYAxisString   = "z [m]"
+		  cs_res@gsnLeftString = "Plot of "+vNam(varn)
+
+                  if ( sort .eq. "time" ) then
+                     if ( data&z(lo) .eq. -1 ) then
+                        level = "-average"
+                     else 
+                        level = "=" + data&y(lo) + "m"
                      end if
                      do n = 0, tb-ta
-                        cs_res@gsnCenterString = "t=" + data&t(n) + "s  z"+ level
-                        plot(n) = gsn_csm_contour(wks_ps,data(n,0,:,:),cs_res)  
+                        cs_res@gsnCenterString = "t=" + data&t(li+n-1) + "s  y"+ level
+                        plot1 = gsn_csm_contour(wks_ps,data(varn,li+n-1,:,lo,:),cs_res)
+                        if (check_vecp)
+                           vecres                  = True            ; vector only resources
+  			   vecres@gsnDraw          = False           ; don't draw
+  			   vecres@gsnFrame         = False           ; don't advance frame
+  			   vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
+  			   vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
+  			   vecres@vcRefLengthF     = 0.05            ; define length of vec ref
+  			   vecres@gsnRightString   = " "             ; turn off right string
+  			   vecres@gsnLeftString    = " "             ; turn off left string
+  			   vecres@tiXAxisString    = " "   
+                           plot_vec=gsn_csm_vector(wks_ps,vect1(li+n-1,lo,:,:),vect2(li+n-1,lo,:,:),vecres)
+                           overlay(plot1, plot_vec)
+                        end if
+                        plot(n) = plot1  
                      end do
                   end if
 
                   if ( sort .eq. "layer" ) then
-                     do n = 0, zb-za
-                        if ( data&z(n) .eq. -1 ) then
+                     do n = 0, yb-ya
+                        if ( data&z(li+n) .eq. -1 ) then
                            level = "-average"
                         else 
-                           level = "=" + data&z(n) + "m"
+                           level = "=" + data&y(li+n) + "m"
                         end if
-                        cs_res@gsnCenterString = "t=" + data&t(0) + "s  z"+ level
-                        plot(n) = gsn_csm_contour(wks_ps,data(0,n,:,:),cs_res)
+                        cs_res@gsnCenterString = "t=" + data&t(lo-1) + "s  y"+ level
+                        plot1 = gsn_csm_contour(wks_ps,data(varn,lo-1,:,li+n,:),cs_res)
+                        if (check_vecp)
+                           vecres                  = True            ; vector only resources
+  			   vecres@gsnDraw          = False           ; don't draw
+  			   vecres@gsnFrame         = False           ; don't advance frame
+  			   vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
+  			   vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
+  			   vecres@vcRefLengthF     = 0.05            ; define length of vec ref
+  			   vecres@gsnRightString   = " "             ; turn off right string
+  			   vecres@gsnLeftString    = " "             ; turn off left string
+  			   vecres@tiXAxisString    = " "   
+                           plot_vec=gsn_csm_vector(wks_ps,vect1(li+n-1,lo,:,:),vect2(li+n-1,lo,:,:),vecres)
+                           overlay(plot1, plot_vec)
+                        end if
+                        plot(n) = plot1
                      end do
-                  end if
+                  end if                  
+                  
                end if
 
-               ; xz cross section
-
-               if ( xzc .eq. 1 ) then
-                  cs_res@tiXAxisString   = "x [m]"
+               ; ****************************************************
+               ; yz cross section
+               ; ****************************************************
+
+               if ( yzc .eq. 1 ) then
+               
+                  cs_res@tiXAxisString   = "y [m]"
                   cs_res@tiYAxisString   = "z [m]"
-  
+		  cs_res@gsnLeftString = "Plot of "+vNam(varn)
+
                   if ( sort .eq. "time" ) then
-                     if ( data&y(0) .eq. -1 ) then
+                     if ( data&z(lo) .eq. -1 ) then
                         level = "-average"
                      else 
-                        level = "=" + data&y(0) + "m"
+                        level = "=" + data&z(lo) + "m"
                      end if
                      do n = 0, tb-ta
-                        cs_res@gsnCenterString = "t=" + data&t(n) + "s  z"+ level
-                        plot(n) = gsn_csm_contour(wks_ps,data(n,:,0,:),cs_res)  
+                        cs_res@gsnCenterString = "t=" + data&t(li+n-1) + "s  x"+ level
+                        plot1 = gsn_csm_contour(wks_ps,data(varn,li+n-1,:,:,lo),cs_res)
+                        if (check_vecp)
+                           vecres                  = True            ; vector only resources
+  			   vecres@gsnDraw          = False           ; don't draw
+  			   vecres@gsnFrame         = False           ; don't advance frame
+  			   vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
+  			   vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
+  			   vecres@vcRefLengthF     = 0.05            ; define length of vec ref
+  			   vecres@gsnRightString   = " "             ; turn off right string
+  			   vecres@gsnLeftString    = " "             ; turn off left string
+  			   vecres@tiXAxisString    = " "   
+                           plot_vec=gsn_csm_vector(wks_ps,vect1(li+n-1,lo,:,:),vect2(li+n-1,lo,:,:),vecres)
+                           overlay(plot1, plot_vec)
+                        end if
+                        plot(n) = plot1  
                      end do
                   end if
 
                   if ( sort .eq. "layer" ) then
-                     do n = 0, yb-ya
-                        if ( data&y(n) .eq. -1 ) then
+                     do n = 0, xb-xa
+                        if ( data&z(li+n) .eq. -1 ) then
                            level = "-average"
                         else 
-                           level = "=" + data&y(n) + "m"
+                           level = "=" + data&z(li+n) + "m"
                         end if
-                        cs_res@gsnCenterString = "t=" + data&t(0) + "s  z"+ level
-                        plot(n) = gsn_csm_contour(wks_ps,data(0,:,n,:),cs_res)
+                        cs_res@gsnCenterString = "t=" + data&t(lo-1) + "s  x"+ level
+                        plot1 = gsn_csm_contour(wks_ps,data(varn,lo-1,:,:,li+n),cs_res)
+                        if (check_vecp)
+                           vecres                  = True            ; vector only resources
+  			   vecres@gsnDraw          = False           ; don't draw
+  			   vecres@gsnFrame         = False           ; don't advance frame
+  			   vecres@vcGlyphStyle     = "CurlyVector"   ; curly vectors
+  			   vecres@vcRefMagnitudeF  = ref_mag         ; define vector ref mag
+  			   vecres@vcRefLengthF     = 0.05            ; define length of vec ref
+  			   vecres@gsnRightString   = " "             ; turn off right string
+  			   vecres@gsnLeftString    = " "             ; turn off left string
+  			   vecres@tiXAxisString    = " "   
+                           plot_vec=gsn_csm_vector(wks_ps,vect1(li+n-1,lo,:,:),vect2(li+n-1,lo,:,:),vecres)
+                           overlay(plot1, plot_vec)
+                        end if
+                        plot(n) = plot1
                      end do
                   end if
+
                end if
 
-               ; yz cross section
-
-               if ( yzc .eq. 1 ) then
-                  cs_res@tiXAxisString   = "y [m]"
-                  cs_res@tiYAxisString   = "z [m]"
-  
-                  if ( sort .eq. "time" ) then
-                     if ( data&x(0) .eq. -1 ) then
-                        level = "-average"
-                     else 
-                        level = "=" + data&x(0) + "m"
-                     end if
-                     do n = 0, tb-ta
-                        cs_res@gsnCenterString = "t=" + data&t(n) + "s  x"+ level
-                        plot(n) = gsn_csm_contour(wks_ps,data(n,:,:,0),cs_res)  
-                     end do
-                  end if
-
-                  if ( sort .eq. "layer" ) then
-                     do n = 0, xb-xa
-                        if ( data&x(n) .eq. -1 ) then
-                           level = "-average"
-                        else 
-                           level = "=" + data&x(n) + "m"
-                        end if
-                        cs_res@gsnCenterString = "t=" + data&t(0) + "s  x"+ level
-                        plot(n) = gsn_csm_contour(wks_ps,data(0,:,:,n),cs_res)
-                     end do
-                  end if
-               end if
-
-               delete(data)
-
-               ; ***************************************************
+	       ; ***************************************************
                ; merge plots onto one page 
                ; ***************************************************
@@ -689,8 +942,5 @@
             end do 	
          end do  
-      end if  
-  
-      delete(data_all)
-
+      end if 
    end do   
 
Index: palm/trunk/SCRIPTS/NCL/profiles.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/profiles.ncl	(revision 156)
+++ palm/trunk/SCRIPTS/NCL/profiles.ncl	(revision 157)
@@ -10,5 +10,5 @@
 
    if (isfilepresent("~/.ncl_preferences")) then
-      parameter = asciiread("~/.ncl_preferences",63,"string")
+      parameter = asciiread("~/.ncl_preferences",73,"string")
       delete(parameter@_FillValue)
    else
@@ -160,5 +160,5 @@
    if ( .not. isvar("end_time_step") ) then     	
       end_time_step = nt-1
-      if (parameter(15) .NE. "nt-1") then
+      if (parameter(15) .NE. "nt") then
          if (parameter(15) .LE. "0")
             print(" ") 
@@ -420,5 +420,5 @@
       e=-1
    end if  
-    
+
    do varn = 0, dim-1   
      
@@ -470,5 +470,6 @@
 
          temp = f->$vNam(varn)$      
-         data = temp(start_time_step:end_time_step,:)      
+         data = temp(start_time_step:end_time_step,:)   
+         testx= data*100  
          print("         plot of " + vNam(varn))
          data!1 = "z"
@@ -487,5 +488,5 @@
         
          plot(n) = gsn_csm_xy(wks,data,z_pr,res)  
-      
+   
          delete(temp)
          delete(data)
Index: palm/trunk/SCRIPTS/NCL/timeseries.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/timeseries.ncl	(revision 156)
+++ palm/trunk/SCRIPTS/NCL/timeseries.ncl	(revision 157)
@@ -11,5 +11,5 @@
    
    if (isfilepresent("~/.ncl_preferences")) then
-      parameter = asciiread("~/.ncl_preferences",63,"string")
+      parameter = asciiread("~/.ncl_preferences",73,"string")
       delete(parameter@_FillValue)
    else
@@ -118,5 +118,5 @@
    if ( .not. isvar("end_time_step") ) then     	
       end_time_step = nt-1
-      if (parameter(15) .NE. "nt-1") then
+      if (parameter(15) .NE. "nt") then
          if (parameter(15) .LE. "0")
             print(" ")
