Index: palm/trunk/SCRIPTS/NCL/profiles.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/profiles.ncl	(revision 961)
+++ palm/trunk/SCRIPTS/NCL/profiles.ncl	(revision 963)
@@ -1322,120 +1322,5 @@
       end if
 
-      ; ****************************************************
-      ; set up legend and colors 
-      ; ****************************************************
-      
-      legend_label=new(np,string)
-      do p=0, np-1
-	  legend_label(p)=sprintf("%6.2f", t_all(ti_in(p))/3600)
-      end do
-
-      ; ***************************************************
-      ; set up recourses
-      ; ***************************************************
-
-      res                         = True
-      res@gsnDraw                 = False
-      res@gsnFrame                = False
-      res@txFont                  = "helvetica"
-      res@tiMainFont              = "helvetica"
-      res@tiXAxisFont             = "helvetica"
-      res@tiYAxisFont             = "helvetica"
-      res@tmXBLabelFont           = "helvetica"
-      res@tmYLLabelFont           = "helvetica"
-      res@lgLabelFont             = "helvetica"
-      res@tmLabelAutoStride       = True
-
-
-      if (legend .EQ. 1)then
-	  res@pmLegendDisplayMode  = "Always"
-      end if
-
-      res@pmLegendSide            = "Right"
-      res@xyExplicitLegendLabels  = legend_label
-      res@pmLegendWidthF          = 0.12
-      res@pmLegendHeightF         = 0.05*np
-      res@pmLegendParallelPosF    = 1.0
-      res@pmLegendOrthogonalPosF  = -0.2625;-1.0
-      res@lgLabelFontHeightF      = font_size_legend
-      res@lgTitleString           = "Time (h)"
-      res@lgTitleFontHeightF      = font_size   
-      res@txFontHeightF           = font_size
-      res@tiXAxisFontHeightF      = font_size
-      res@tiYAxisFontHeightF      = font_size
-      res@tmXBLabelFontHeightF    = font_size
-      res@tmYLLabelFontHeightF    = font_size
-      res@tiXAxisString           = " " 
-      res@lgJustification         = "TopLeft"
-
-      if ( black .eq. 0 ) then  
-	  res@xyLineColors = -(ispan(-237,-2,235/np))
-      end if
-      if (norm_z .EQ. 1)then
-	  res@tiYAxisString = "Height (m)"
-      else   
-	  res@tiYAxisString = "Height / "+norm_z+" (m)"
-      end if
-	
-      if (log_z .EQ. 1) then
-	  res@trYLog = True 
-      end if
-
-      if (dash .EQ. 0 ) then
-	  res@xyMonoDashPattern = True 
-      else
-	  res@xyMonoDashPattern = False
-	  if (no_files .GT. 1)
-	    res@xyMonoDashPattern = True  
-	    print(" ") 
-	    print("If you use more than one file, patterns for different "+\
-		  "timesteps cannot be used")
-	    print(" ") 
-	  end if       
-      end if 
-
-      res@tmXBMinorPerMajor = 4
-      res@tmYLMinorPerMajor = 4
-
-      resP                            = True
-      resP@gsnMaximize                = True 
-      resP@gsnPanelXWhiteSpacePercent = 3.0
-      resP@gsnPanelYWhiteSpacePercent = 2.0
-      resP@txFont                     = "helvetica"
-      resP@txString                   = f_att@title
-      resP@txFuncCode                 = "~"
-      resP@txFontHeightF              = 0.015
-
-      ; ***************************************************
-      ; set up graphics for plot
-      ; ***************************************************
-
-      if (combine .EQ. 1) then
-	  plot_o = new(number_comb,graphic)  
-          label=new(number_comb,string)
-	  color_o=new(number_comb,integer)
-
-	  if (check_vType) then
-	    mini=new(number_comb,double)
-	    maxi=new(number_comb,double)
-	  else
-	    mini=new(number_comb,float)
-	    maxi=new(number_comb,float)
-	  end if
-      end if
-    
-      if ( format_out .EQ. "pdf" .OR. format_out .EQ. "ps" ) then
-	  format_out@wkPaperSize = "A4"
-      end if
-      if ( format_out .EQ. "png" ) then
-	  format_out@wkWidth  = 1000
-	  format_out@wkHeight = 1000
-      end if
-
-      if (wks_gsn_log) then
-	  wks=gsn_open_wks(format_out,file_out)
-	  gsn_define_colormap(wks,"rainbow+white") 
-	  wks_gsn_log = False
-      end if
+      if (com_i .EQ. 0) then
 
       ; ***************************************************
@@ -1541,4 +1426,138 @@
       min_z=min_z/norm_z
       max_z=max_z/norm_z
+
+      end if
+
+      ; ****************************************************
+      ; set up legend and colors 
+      ; ****************************************************
+      
+      legend_label=new(np,string)
+      do p=0, np-1
+	  legend_label(p)=sprintf("%6.2f", t_all(ti_in(p))/3600)
+      end do
+
+      ; ***************************************************
+      ; set up recourses
+      ; ***************************************************
+
+      res                         = True
+      res@gsnDraw                 = False
+      res@gsnFrame                = False
+      res@txFont                  = "helvetica"
+      res@tiMainFont              = "helvetica"
+      res@tiXAxisFont             = "helvetica"
+      res@tiYAxisFont             = "helvetica"
+      res@tmXBLabelFont           = "helvetica"
+      res@tmYLLabelFont           = "helvetica"
+      res@lgLabelFont             = "helvetica"
+      res@tmLabelAutoStride       = True
+
+
+      if (legend .EQ. 1)then
+	  res@pmLegendDisplayMode  = "Always"
+      end if
+
+      res@pmLegendSide            = "Left";"Right"
+      res@xyExplicitLegendLabels  = legend_label
+      res@pmLegendWidthF          = 0.12
+      res@pmLegendHeightF         = 0.05*np
+      res@pmLegendParallelPosF    = 1.0
+
+      if (max_z .GE. 1000.) then
+         res@pmLegendOrthogonalPosF  = -1.227
+      else if ((max_z .LT. 1000.) .AND. (max_z .GE. 100.)) then
+         res@pmLegendOrthogonalPosF  = -1.202
+      else if ((max_z .LT. 100.) .AND. (max_z .GE. 10.)) then
+         res@pmLegendOrthogonalPosF  = -1.177
+      else if ((max_z .LT. 10.) .AND. (max_z .GE. 1.)) then
+         res@pmLegendOrthogonalPosF  = -1.190
+      else if ((max_z .LT. 1.)) then
+         res@pmLegendOrthogonalPosF  = -1.215
+      end if
+      end if
+      end if
+      end if
+      end if
+      res@lgLabelFontHeightF      = font_size_legend
+      res@lgTitleString           = "Time (h)"
+      res@lgTitleFontHeightF      = font_size   
+      res@txFontHeightF           = font_size
+      res@tiXAxisFontHeightF      = font_size
+      res@tiYAxisFontHeightF      = font_size
+      res@tmXBLabelFontHeightF    = font_size
+      res@tmYLLabelFontHeightF    = font_size
+      res@tiXAxisString           = " " 
+      res@lgJustification         = "TopLeft"
+
+      if ( black .eq. 0 ) then  
+	  res@xyLineColors = -(ispan(-237,-2,235/np))
+      end if
+      if (norm_z .EQ. 1)then
+	  res@tiYAxisString = "Height (m)"
+      else   
+	  res@tiYAxisString = "Height / "+norm_z+" (m)"
+      end if
+	
+      if (log_z .EQ. 1) then
+	  res@trYLog = True 
+      end if
+
+      if (dash .EQ. 0 ) then
+	  res@xyMonoDashPattern = True 
+      else
+	  res@xyMonoDashPattern = False
+	  if (no_files .GT. 1)
+	    res@xyMonoDashPattern = True  
+	    print(" ") 
+	    print("If you use more than one file, patterns for different "+\
+		  "timesteps cannot be used")
+	    print(" ") 
+	  end if       
+      end if 
+
+      res@tmXBMinorPerMajor = 4
+      res@tmYLMinorPerMajor = 4
+
+      resP                            = True
+      resP@gsnMaximize                = True 
+      resP@gsnPanelXWhiteSpacePercent = 6.0
+      resP@gsnPanelYWhiteSpacePercent = 6.0
+      resP@txFont                     = "helvetica"
+      resP@txString                   = f_att@title
+      resP@txFuncCode                 = "~"
+      resP@txFontHeightF              = 0.0105
+
+      ; ***************************************************
+      ; set up graphics for plot
+      ; ***************************************************
+
+      if (combine .EQ. 1) then
+	  plot_o = new(number_comb,graphic)  
+          label=new(number_comb,string)
+	  color_o=new(number_comb,integer)
+
+	  if (check_vType) then
+	    mini=new(number_comb,double)
+	    maxi=new(number_comb,double)
+	  else
+	    mini=new(number_comb,float)
+	    maxi=new(number_comb,float)
+	  end if
+      end if
+    
+      if ( format_out .EQ. "pdf" .OR. format_out .EQ. "ps" ) then
+	  format_out@wkPaperSize = "A4"
+      end if
+      if ( format_out .EQ. "png" ) then
+	  format_out@wkWidth  = 1000
+	  format_out@wkHeight = 1000
+      end if
+
+      if (wks_gsn_log) then
+	  wks=gsn_open_wks(format_out,file_out)
+	  gsn_define_colormap(wks,"rainbow+white") 
+	  wks_gsn_log = False
+      end if
 
       ; ***************************************************
@@ -3337,5 +3356,5 @@
 		if (over .EQ. 0) then
 
-		   label = vNam(varn)
+		   label = " " + vNam(varn)
 
 		   lgres1                    = True
@@ -3344,5 +3363,5 @@
 		   lgres1@lgLabelFont        = "helvetica"    
 		   lgres1@lgLabelFontHeightF = font_size_legend * 10.0 * 0.7
-		   lgres1@vpWidthF           = 0.12           
+		   lgres1@vpWidthF           = 0.14           
 		   lgres1@vpHeightF          = 0.1 / 3.0 + 0.01         
 		
@@ -4552,5 +4571,5 @@
 		      end if
 		  end if
-		  label(n_o)=vNam(varn)
+		  label(n_o)=" " + vNam(varn)
 		  color_o(n_o)=237
 		  plot_o(n_o)=gsn_csm_xy(wks,data(varn,:,:),z,res) 
@@ -4599,8 +4618,9 @@
 	  lgres                    = True
 	  lgMonoDashIndex          = False
+          lgres@lgLineDashSegLenF  = 0.075
 	  lgres@lgDashIndexes      = (/0,1,2/)
 	  lgres@lgLabelFont        = "helvetica"    
-	  lgres@vpWidthF           = 0.12           
-	  lgres@vpHeightF          = 0.1 * number_comb / 3.0 + 0.01        
+	  lgres@vpWidthF           = 0.14           
+	  lgres@vpHeightF          = 0.1 * number_comb / 3.0 + (number_comb + 1) * 0.01        
           lgres@lgLabelFontHeightF = 10.0 * font_size_legend * ((number_comb \
 				     - 2.0) * 0.35 + 0.65)
