Index: palm/trunk/SCRIPTS/NCL/.ncl_preferences
===================================================================
--- palm/trunk/SCRIPTS/NCL/.ncl_preferences	(revision 154)
+++ palm/trunk/SCRIPTS/NCL/.ncl_preferences	(revision 154)
@@ -0,0 +1,66 @@
+___Parameter list________________________________________________________________________________
+___Please write your values/strings(wihtout " ") below the corresponding parameter line__________
+_________________________________________________________________________________________________
+___parameter name____example____________________________________default value_____________used by
+_________________________________________________________________________________________________
+
+___'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]
+x11
+___'file_out'________[path/name, i.e. ~/.../test]_______________default = test____________[ALL]
+test
+___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]
+1
+___no_lines__________[1,2,...]__________________________________default = 2_______________[ALL]
+2
+___'var'_____________[E dt umax,...]____________________________default = variables_______[ALL]
+variables
+___combine___________[0] or [1]_________________________________default = 0_______________[PR]
+0
+___number_comb_______[0] or [1]_________________________________default = 0_______________[PR]
+0
+___'c_var'___________[umax vmax wmax ,...]______________________default = c_variables_____[PR]
+c_variables
+___dash______________[0] or [1]_________________________________default = 0_______________[PR]
+0
+___black_____________[0] or [1]_________________________________default = 0_______________[PR]
+0
+___min_z_____________[0,10,...]_________________________________default = 0_______________[PR]
+0
+___max_z_____________[100,1000,...]_____________________________default = max(z_pr)_______[PR] 
+max(z_pr)
+___'sort'____________[time] or [layer]__________________________default = time____________[CS]
+time
+___'mode'____________[Fill], [Line] or [Both]___________________default = Fill____________[CS]
+Fill
+___'fill_mode'_______[AreaFill], [RasterFill] or [CellFill]_____default = AreaFill________[CS]
+AreaFill
+___shape_____________[0] or [1]_________________________________default = 1_______________[CS]
+1
+___xyc_______________[0] or [1]_________________________________default = 1_______________[CS]
+1
+___xzc_______________[0] or [1]_________________________________default = 0_______________[CS]
+0
+___yzc_______________[0] or [1]_________________________________default = 0_______________[CS]
+0
+___xs________________[0,1,...]__________________________________default = 0_______________[CS]
+0
+___xe________________[1,2,...]__________________________________default = xdim____________[CS]
+xdim
+___ys________________[0,1,...]__________________________________default = 0_______________[CS]
+ 0
+___ye________________[1,2,...]__________________________________default = ydim____________[CS]
+ydim
+___zs________________[0,1,...]__________________________________default = 0_______________[CS]
+0
+___ze________________[1,2,...]__________________________________default = zdim____________[CS]
+zdim
+___end of file "parameter_list_cross_section__________________________________________________
+
+
+
Index: palm/trunk/SCRIPTS/NCL/Archive/crosssections.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/Archive/crosssections.ncl	(revision 154)
+++ palm/trunk/SCRIPTS/NCL/Archive/crosssections.ncl	(revision 154)
@@ -0,0 +1,154 @@
+load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
+
+; cross-sections
+; last change: $Id: crosssections.ncl 127 2007-10-23 11:05:25Z letzel $
+
+begin
+;
+; set default value(s) for shell script variables assigned on command line
+  if ( .not. isvar("cm") ) then     ; colormap
+    cm = "ncview_default"
+  end if
+  if ( .not. isvar("di") ) then     ; input directory (with final /)
+    di = ""
+  end if
+  if ( .not. isvar("d") ) then      ; output directory (with final /)
+    d = di
+  end if
+  if ( .not. isvar("fi") ) then     ; base name of input file (without suffix)
+    fi = "example_xy"
+  end if
+  if ( .not. isvar("fill_mode") ) then ; "AreaFill", "RasterFill" or "CellFill"
+    fill_mode = "AreaFill"
+  end if
+  if ( .not. isvar("fo") ) then     ; base name of output files (without suffix)
+    fo = ""
+  end if
+  if ( .not. isvar("mode") ) then   ; output mode ("Fill" or "Line")
+    mode = "Fill"
+  end if
+  if ( .not. isvar("t") ) then      ; output time step
+    t = 0
+  end if
+  if ( .not. isvar("var") ) then    ; variable to be output
+    var = "u_xy"
+  end if
+  if ( .not. isvar("xs") ) then     ; output x-coordinate range start (in m)
+    xs = -1e+38
+  end if
+  if ( .not. isvar("xe") ) then     ; output x-coordinate range end (in m)
+    xe = 1e+38
+  end if
+  if ( .not. isvar("ys") ) then     ; output y-coordinate range start (in m)
+    ys = -1e+38
+  end if
+  if ( .not. isvar("ye") ) then     ; output y-coordinate range end (in m)
+    ye = 1e+38
+  end if
+  if ( .not. isvar("zs") ) then     ; output z-coordinate range start (in m)
+    zs = -1e+38
+  end if
+  if ( .not. isvar("ze") ) then     ; output z-coordinate range end (in m)
+    ze = 1e+38
+  end if
+;
+; open input file
+  f  = addfile( di + fi  + ".nc", "r" )
+;
+; open workstation(s) and set colormap
+  wks_x11 = gsn_open_wks("x11","cross-section") ; X11 workstation
+  gsn_define_colormap(wks_x11,cm)
+  if ( isvar("fo") ) then
+    wks_pdf = gsn_open_wks("pdf",d+fo)  ; optional workstations
+    gsn_define_colormap(wks_pdf,cm)
+    wks_eps = gsn_open_wks("eps",d+fo)  ; for output on file
+    gsn_define_colormap(wks_eps,cm)
+    wks_ps  = gsn_open_wks("ps",d+fo)
+    gsn_define_colormap(wks_ps,cm)
+  end if
+;
+; read input data using 'coordinate subscripting'
+; NCL uses the closest corresponding values (in case of two equally distant 
+; values NCL chooses the smaller one)
+  raw_data = f->$var$(t:t,{zs:ze},{ys:ye},{xs:xe})
+  raw_data!0 = "t"
+  raw_data!1 = "z"
+  raw_data!2 = "y"
+  raw_data!3 = "x"
+  time = raw_data&t
+;
+; reduce variable dimensions from 4D to 2D according to output ranges
+  if ( zs .eq. ze ) then
+    data = raw_data(0,0,:,:)
+    x_axis = "x"
+    y_axis = "y"
+    plane  = "z"
+    if ( raw_data&z .eq. -1 ) then
+      level = "-average"
+    else
+      level = "=" + raw_data&z + "m"
+    end if
+  else
+    if ( ys .eq. ye ) then
+      data = raw_data(0,:,0,:)
+      x_axis = "x"
+      y_axis = "z"
+      plane  = "y"
+      if ( raw_data&y .eq. -1 ) then
+        level = "-average"
+      else
+        level = "=" + raw_data&y + "m"
+      end if
+    else
+      if ( xs .eq. xe ) then
+        data = raw_data(0,:,:,0)
+        x_axis = "y"
+        y_axis = "z"
+        plane  = "x"
+        if ( raw_data&x .eq. -1 ) then
+          level = "-average"
+        else
+          level = "=" + raw_data&x + "m"
+        end if
+      end if
+    end if
+  end if
+  delete( raw_data )
+;
+; set up resources
+  cs_res                         = True
+  cs_res@gsnMaximize             = True 
+  cs_res@gsnPaperOrientation     = "portrait"
+  cs_res@gsnPaperWidth           = 8.27
+  cs_res@gsnPaperHeight          = 11.69
+  cs_res@gsnPaperMargin          = 0.79
+  cs_res@tiMainFuncCode          = "~"
+  cs_res@tiMainFontHeightF       = 0.015
+  cs_res@tiMainString            = f@title
+  cs_res@tiXAxisString           = x_axis + " [m]"
+  cs_res@tiYAxisString           = y_axis + " [m]"
+;  cs_res@gsnLeftString           = ""   ; gsn_csm_* scripts use default data
+  cs_res@gsnCenterString         = "t=" + time + "s  " + plane + level
+;  cs_res@gsnRightString          = ""   ; gsn_csm_* scripts use default data
+  cs_res@tmXBMode                ="Automatic"
+  cs_res@tmYLMode                ="Automatic"
+  if ( mode .eq. "Fill" ) then
+    cs_res@cnFillOn                = True
+    cs_res@gsnSpreadColors         = True
+    cs_res@cnFillMode              = fill_mode
+    cs_res@lbOrientation           = "Vertical"  ; vertical label bar
+    cs_res@cnLinesOn               = False
+    cs_res@cnLineLabelsOn          = False
+  end if
+;
+; data output
+  plot_x11 = gsn_csm_contour(wks_x11,data,cs_res)
+  if ( isvar("fo") ) then
+    plot_pdf = gsn_csm_contour(wks_pdf,data,cs_res)
+    plot_eps = gsn_csm_contour(wks_eps,data,cs_res)
+    plot_ps  = gsn_csm_contour(wks_ps, data,cs_res)
+  end if
+end
Index: palm/trunk/SCRIPTS/NCL/Archive/crosssections.usage.txt
===================================================================
--- palm/trunk/SCRIPTS/NCL/Archive/crosssections.usage.txt	(revision 154)
+++ palm/trunk/SCRIPTS/NCL/Archive/crosssections.usage.txt	(revision 154)
@@ -0,0 +1,58 @@
+Usage of PALM NCL script crosssections.ncl
+==========================================
+Last change: $Id: crosssections.usage.txt 127 2007-10-23 11:05:25Z letzel $
+Marcus Letzel, 17 July 2007
+
+Command-line syntax
+===================
+ncl crosssections.ncl [parameters]
+
+The parameter syntax depends on their data type:
+A) numeric data    : parameter=value      (for example t=0)
+B) character string: 'parameter="string"' (for example 'var="u_xy"')
+
+Alphabetical parameter list
+===========================
+Name	Default value		Meaning
+-----------------------------------------------------------------------------
+cm	"ncview_default"	colormap
+di	""			input directory (with final /)
+d	=di			output directory (with final /)
+fi	"example_xy"		base name of input file (without suffix)
+fo	""			base name of output files (without suffix)
+fill_mode "AreaFill"		fill mode for mode="Fill":
+				"AreaFill", "RasterFill" or "CellFill"
+mode	"Fill"			output mode ("Fill" or "Line")
+t	0			output time step
+var	"u_xy"			variable to be output
+xs	-1e+38			output x-coordinate range start (in m)
+xe	+1e+38			output x-coordinate range end   (in m)
+ys	-1e+38			output y-coordinate range start (in m)
+ye	+1e+38			output y-coordinate range end   (in m)
+zs	-1e+38			output z-coordinate range start (in m)
+ze	+1e+38			output z-coordinate range end   (in m)
+
+Usage
+=====
+This script draws NCL contour plots from two-dimensional cross-sections of 
+NetCDF data produced by PALM. Instantaneous or time-averaged xy-, xz-, yz- or 
+3D-data can be used with this script.
+
+The sectional plane has neither a default orientation nor a default position.
+Both must be specified together using the coordinate range parameters:
+- For xy cross-sections specify zs and ze (with zs=za).
+- For xz cross-sections specify ys and ye (with ys=ya).
+- For yz cross-sections specify xs and xe (with xs=xa).
+
+The remaining coordinate range parameters can optionally be used to restrict 
+the output coordinate range.
+
+By default, only screen output is produced. Additional file output is optional
+and requires to specify the parameter fo. This will create three files: fo.pdf,
+fo.eps and fo.ps.
+
+Input and output files can optionally be preceeded by an input and output
+directory di and d, respectively. If not specified, this scripts expects the
+input file to reside in the current directory.
+
+The contours can be drawn either in "Fill" (default) or "Line" mode.
Index: palm/trunk/SCRIPTS/NCL/Archive/crosssections_new.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/Archive/crosssections_new.ncl	(revision 154)
+++ palm/trunk/SCRIPTS/NCL/Archive/crosssections_new.ncl	(revision 154)
@@ -0,0 +1,473 @@
+load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
+
+; cross-sections
+; last change: $Id: crosssections_new.ncl 127 2007-10-23 11:05:25Z letzel $
+
+begin
+;
+; set default value(s) for shell script variables assigned on command line
+  if ( .not. isvar("cm") ) then     ; colormap
+    cm = "ncview_default"
+  end if
+  if ( .not. isvar("di") ) then     ; input directory (with final /)
+    di = ""
+  end if
+  if ( .not. isvar("d") ) then      ; output directory (with final /)
+    d = di
+  end if
+  if ( .not. isvar("fi") ) then     ; base name of input file (without suffix)
+    fi = "example_xy"
+  end if
+  if ( .not. isvar("fill_mode") ) then ; "AreaFill", "RasterFill" or "CellFill"
+    fill_mode = "AreaFill"
+  end if
+  if ( .not. isvar("fo") ) then     ; base name of output files (without suffix)
+    fo = ""
+  end if
+  if ( .not. isvar("mode") ) then   ; output mode ("Fill" or "Line")
+    mode = "Fill"
+  end if
+  if ( .not. isvar("t") ) then      ; output time step
+    t = 0
+  end if
+  if ( .not. isvar("var") ) then    ; variable to be output
+    var = "u_xy"
+  end if
+  if ( .not. isvar("xs") ) then     ; output x-coordinate range start (in m)
+    xs = -1e+38
+  end if
+  if ( .not. isvar("xe") ) then     ; output x-coordinate range end (in m)
+    xe = 1e+38
+  end if
+  if ( .not. isvar("ys") ) then     ; output y-coordinate range start (in m)
+    ys = -1e+38
+  end if
+  if ( .not. isvar("ye") ) then     ; output y-coordinate range end (in m)
+    ye = 1e+38
+  end if
+  if ( .not. isvar("zs") ) then     ; output z-coordinate range start (in m)
+    zs = -1e+38
+  end if
+  if ( .not. isvar("ze") ) then     ; output z-coordinate range end (in m)
+    ze = 1e+38
+  end if
+;
+; open input file
+  f  = addfile( di + fi  + ".nc", "r" )
+;
+; open workstation(s) and set colormap
+  wks_x11 = gsn_open_wks("x11","cross-section") ; X11 workstation
+  gsn_define_colormap(wks_x11,cm)
+  if ( isvar("fo") ) then
+    wks_pdf = gsn_open_wks("pdf",d+fo)  ; optional workstations
+    gsn_define_colormap(wks_pdf,cm)
+    wks_eps = gsn_open_wks("eps",d+fo)  ; for output on file
+    gsn_define_colormap(wks_eps,cm)
+    wks_ps  = gsn_open_wks("ps",d+fo)
+    gsn_define_colormap(wks_ps,cm)
+  end if
+;
+; read input data using 'coordinate subscripting'
+; NCL uses the closest corresponding values (in case of two equally distant 
+; values NCL chooses the smaller one)
+  raw_data = f->$var$(t:t,{zs:ze},{ys:ye},{xs:xe})
+  raw_data!0 = "t"
+  raw_data!1 = "z"
+  raw_data!2 = "y"
+  raw_data!3 = "x"
+  time = raw_data&t
+;
+; reduce variable dimensions from 4D to 2D according to output ranges
+  if ( zs .eq. ze ) then
+    data = raw_data(0,0,:,:)
+    x_axis = "x"
+    y_axis = "y"
+    plane  = "z"
+
+    dx =  f->x(1)
+    dy =  f->y(1)
+
+    if ( raw_data&z .eq. -1 ) then
+      level = "-average"
+    else
+      level = "=" + raw_data&z + "m"
+    end if
+  else
+    if ( ys .eq. ye ) then
+      data = raw_data(0,:,0,:)
+      x_axis = "x"
+      y_axis = "z"
+      plane  = "y"
+
+      dx =  f->x(1)
+      if (isfilevar(f, "zw_3d")) then
+        dz =  f->zw_3d(1)
+      else
+        dz =  f->zw(1)
+      end if
+
+      if ( raw_data&y .eq. -1 ) then
+        level = "-average"
+      else
+        level = "=" + raw_data&y + "m"
+      end if
+    else
+      if ( xs .eq. xe ) then
+        data = raw_data(0,:,:,0)
+        x_axis = "y"
+        y_axis = "z"
+        plane  = "x"
+
+        dy =  f->y(1)
+        if (isfilevar(f, "zw_3d")) then
+          dz =  f->zw_3d(1)
+        else
+          dz =  f->zw(1)
+        end if
+
+        if ( raw_data&x .eq. -1 ) then
+          level = "-average"
+        else
+          level = "=" + raw_data&x + "m"
+        end if
+      end if
+    end if
+  end if
+  delete( raw_data )
+;
+; set up resources
+  cs_res                         = True
+  cs_res@gsnDraw                 = False  
+  cs_res@gsnFrame                = False 
+  cs_res@gsnMaximize             = True 
+  cs_res@gsnPaperOrientation     = "portrait"
+  cs_res@gsnPaperWidth           = 8.27
+  cs_res@gsnPaperHeight          = 11.69
+  cs_res@gsnPaperMargin          = 0.79
+  cs_res@tiMainFuncCode          = "~"
+  cs_res@tiMainFontHeightF       = 0.015
+  cs_res@tiMainString            = f@title
+  cs_res@tiXAxisString           = x_axis + " [m]"
+  cs_res@tiYAxisString           = y_axis + " [m]"
+;  cs_res@gsnLeftString           = ""   ; gsn_csm_* scripts use default data
+  cs_res@gsnCenterString         = "t=" + time + "s  " + plane + level
+;  cs_res@gsnRightString          = ""   ; gsn_csm_* scripts use default data
+  cs_res@tmXBMode                ="Automatic"
+  cs_res@tmYLMode                ="Automatic"
+  if ( mode .eq. "Fill" ) then
+    cs_res@cnFillOn                = True
+    cs_res@gsnSpreadColors         = True
+    cs_res@cnFillMode              = fill_mode
+    cs_res@lbOrientation           = "Vertical"  ; vertical label bar
+    cs_res@cnLinesOn               = False
+    cs_res@cnLineLabelsOn          = False
+  end if
+
+  vector     = True
+  co_overlay = True
+
+  if ( .not. isvar("wv1") ) then
+    vector = False
+  end if
+  if ( .not. isvar("wv2") ) then
+    vector = False
+  end if
+  if ( .not. isvar("co") ) then
+    co_overlay = False
+  end if
+
+  if ( vector .eq. True ) then
+
+    if ( wv1 .eq. "u_xy" .or.  wv1 .eq. "u_xz" .or. wv1 .eq. "u_yz" ) then
+
+      raw_data = f->$wv1$(t:t,{zs:ze},{ys:ye},{xs-(0.5*dx):xe-(0.5*dx)}) 
+      raw_data!0 = "t"
+      raw_data!1 = "z"
+      raw_data!2 = "y"
+      raw_data!3 = "x"
+      time = raw_data&t
+
+    else
+
+      if ( wv1 .eq. "v_xy" .or.  wv1 .eq. "v_xz" .or. wv1 .eq. "v_yz" ) then
+
+        raw_data = f->$wv1$(t:t,{zs:ze},{ys-(0.5*dy):ye-(0.5*dy)},{xs:xe}) 
+        raw_data!0 = "t"
+        raw_data!1 = "z"
+        raw_data!2 = "y"
+        raw_data!3 = "x"
+        time = raw_data&t
+
+      else
+
+        if ( wv1 .eq. "w_xy" .or.  wv1 .eq. "w_xz" .or. wv1 .eq. "w_yz" ) then
+
+          raw_data = f->$wv1$(t:t,{zs+(0.5*dz):ze+(0.5*dz)},{ys:ye},{xs:xe}) 
+          raw_data!0 = "t"
+          raw_data!1 = "z"
+          raw_data!2 = "y"
+          raw_data!3 = "x"
+          time = raw_data&t
+
+        end if
+      end if
+    end if
+
+    if ( zs .eq. ze ) then
+      data_u = raw_data(0,0,:,:)
+    else
+      if ( ys .eq. ye ) then
+        data_u = raw_data(0,:,0,:)
+      else
+        if ( xs .eq. xe ) then
+          data_u = raw_data(0,:,:,0)
+        end if
+      end if
+    end if
+    delete( raw_data )
+
+    if ( wv2 .eq. "u_xy" .or.  wv2 .eq. "u_xz" .or. wv2 .eq. "u_yz" ) then
+
+      raw_data = f->$wv2$(t:t,{zs:ze},{ys:ye},{xs-(0.5*dx):xe-(0.5*dx)}) 
+      raw_data!0 = "t"
+      raw_data!1 = "z"
+      raw_data!2 = "y"
+      raw_data!3 = "x"
+      time = raw_data&t
+
+    else
+
+      if ( wv2 .eq. "v_xy" .or.  wv2 .eq. "v_xz" .or. wv2 .eq. "v_yz" ) then
+
+        raw_data = f->$wv2$(t:t,{zs:ze},{ys-(0.5*dy):ye-(0.5*dy)},{xs:xe}) 
+        raw_data!0 = "t"
+        raw_data!1 = "z"
+        raw_data!2 = "y"
+        raw_data!3 = "x"
+        time = raw_data&t
+
+      else
+
+        if ( wv2 .eq. "w_xy" .or.  wv2 .eq. "w_xz" .or. wv2 .eq. "w_yz" ) then
+
+          raw_data = f->$wv2$(t:t,{zs+(0.5*dz):ze+(0.5*dz)},{ys:ye},{xs:xe}) 
+          raw_data!0 = "t"
+          raw_data!1 = "z"
+          raw_data!2 = "y"
+          raw_data!3 = "x"
+          time = raw_data&t
+
+        end if
+      end if
+    end if
+
+
+    if ( zs .eq. ze ) then
+      data_v = raw_data(0,0,:,:)
+    else
+      if ( ys .eq. ye ) then
+        data_v = raw_data(0,:,0,:)
+      else
+        if ( xs .eq. xe ) then
+          data_v = raw_data(0,:,:,0)
+        end if
+      end if
+    end if
+    delete( raw_data )
+
+    wv_res                     = True
+    wv_res@gsnDraw             = False  
+    wv_res@gsnFrame            = False
+    wv_res@gsnRightString      = ""
+    wv_res@gsnLeftString       = ""
+    wv_res@gsnCenterString     = ""
+    wv_res@vpClipOn            = True
+
+  end if
+
+  if ( co_overlay .eq. True ) then
+
+    raw_data = f->$co$(t:t,{zs:ze},{ys:ye},{xs:xe}) 
+    raw_data!0 = "t"
+    raw_data!1 = "z"
+    raw_data!2 = "y"
+    raw_data!3 = "x"
+    time = raw_data&t
+
+    if ( zs .eq. ze ) then
+      data2 = raw_data(0,0,:,:)
+    else
+      if ( ys .eq. ye ) then
+        data2 = raw_data(0,:,0,:)
+      else
+        if ( xs .eq. xe ) then
+          data2 = raw_data(0,:,:,0)
+        end if
+      end if
+    end if
+    delete( raw_data )
+
+    co_res                              = True
+    co_res@cnLineThicknessF             = 1.0
+    co_res@gsnDraw                      = False
+    co_res@gsnFrame                     = False
+    co_res@gsnContourZeroLineThicknessF = 2.0
+    co_res@gsnContourNegLineDashPattern = 4
+    co_res@cnLineColor                  = "Black"
+    co_res@gsnRightString   = ""
+    co_res@gsnLeftString    = ""
+    co_res@gsnCenterString  = ""
+
+;    co_res1@cnLevelSelectionMode = "ManualLevels"     ; set manual contour levels
+;    co_res1@cnMinLevelValF       = -5.                ; set min contour level
+;    co_res1@cnMaxLevelValF       =  5.                ; set max contour level
+;    co_res1@cnLevelSpacingF      =  0.5               ; set contour spacing
+     co_res@cnLineLabelsOn        = True
+     co_res@cnLineLabelPlacementMode   = "constant"
+;    co_res@cnLineLabelBackgroundColor = "white"
+
+  end if
+
+  if ( co_overlay .eq. True .and. vector .eq. True ) then 
+
+    if ( isvar("fo") ) then
+
+      plot_pdf2 = gsn_csm_contour(wks_pdf,data2,co_res)
+      plot_pdf1 = gsn_csm_contour(wks_pdf,data,cs_res)
+      plot_pdf3 = gsn_csm_vector(wks_pdf,data_u,data_v,wv_res)
+      overlay(plot_pdf1,plot_pdf2)
+      overlay(plot_pdf1,plot_pdf3)
+      draw(plot_pdf1)
+      frame(wks_pdf)
+
+      plot_eps2 = gsn_csm_contour(wks_eps,data2,co_res)
+      plot_eps1 = gsn_csm_contour(wks_eps,data,cs_res)
+      plot_eps3 = gsn_csm_vector(wks_eps,data_u,data_v,wv_res)
+      overlay(plot_eps1,plot_eps2)
+      overlay(plot_eps1,plot_eps3)
+      draw(plot_eps1)
+      frame(wks_eps)
+
+      plot_ps2 = gsn_csm_contour(wks_ps,data2,co_res)
+      plot_ps1 = gsn_csm_contour(wks_ps,data,cs_res)
+      plot_ps3 = gsn_csm_vector(wks_ps,data_u,data_v,wv_res)
+      overlay(plot_ps1,plot_ps2)
+      overlay(plot_ps1,plot_ps3)
+      draw(plot_ps1)
+      frame(wks_ps)
+
+    end if
+
+    plot1 = gsn_csm_contour(wks_x11,data,cs_res)
+    plot2 = gsn_csm_contour(wks_x11,data2,co_res)
+    plot3 = gsn_csm_vector(wks_x11,data_u,data_v,wv_res)
+
+    overlay(plot1,plot2)
+    overlay(plot1,plot3)
+
+    draw(plot1)
+    frame(wks_x11)
+
+  else
+
+    if ( co_overlay .eq. True .and. vector .ne. True ) then
+
+      if ( isvar("fo") ) then
+
+        plot_pdf2 = gsn_csm_contour(wks_pdf,data2,co_res)
+        plot_pdf1 = gsn_csm_contour(wks_pdf,data,cs_res)
+        overlay(plot_pdf1,plot_pdf2)
+        draw(plot_pdf1)       
+        frame(wks_pdf)
+
+        plot_eps2 = gsn_csm_contour(wks_eps,data2,co_res)
+        plot_eps1 = gsn_csm_contour(wks_eps,data,cs_res)
+        overlay(plot_eps1,plot_eps2)
+        draw(plot_eps1)
+        frame(wks_eps)
+
+        plot_ps2 = gsn_csm_contour(wks_ps,data2,co_res)
+        plot_ps1 = gsn_csm_contour(wks_ps,data,cs_res)
+        overlay(plot_ps1,plot_ps2)
+        draw(plot_ps1)
+        frame(wks_ps)
+
+      end if 
+
+      plot1 = gsn_csm_contour(wks_x11,data,cs_res)
+      plot2 = gsn_csm_contour(wks_x11,data2,co_res)
+
+      overlay(plot1,plot2)
+
+      draw(plot1)
+      frame(wks_x11)
+
+    else
+
+    if ( co_overlay .ne. True .and. vector .eq. True ) then 
+
+      if ( isvar("fo") ) then
+
+        plot_pdf1 = gsn_csm_contour(wks_pdf,data,cs_res)
+        plot_pdf3 = gsn_csm_vector(wks_pdf,data_u,data_v,wv_res)
+        overlay(plot_pdf1,plot_pdf3)
+        draw(plot_pdf1)
+        frame(wks_pdf)
+
+        plot_eps1 = gsn_csm_contour(wks_eps,data,cs_res)
+        plot_eps3 = gsn_csm_vector(wks_eps,data_u,data_v,wv_res)
+        overlay(plot_eps1,plot_eps3)
+        draw(plot_eps1)
+        frame(wks_eps)
+
+        plot_ps1 = gsn_csm_contour(wks_ps,data,cs_res)
+        plot_ps3 = gsn_csm_vector(wks_ps,data_u,data_v,wv_res)
+        overlay(plot_ps1,plot_ps3)
+        draw(plot_ps1)
+        frame(wks_ps)
+
+      end if 
+
+      plot1 = gsn_csm_contour(wks_x11,data,cs_res)
+      plot3 = gsn_csm_vector(wks_x11,data_u,data_v,wv_res)
+
+      overlay(plot1,plot3)
+
+      draw(plot1)
+      frame(wks_x11)
+
+    else
+
+    if ( co_overlay .ne. True .and. vector .ne. True) then 
+
+      if ( isvar("fo") ) then
+
+        plot_pdf1 = gsn_csm_contour(wks_pdf,data,cs_res)
+        draw(plot_pdf1)
+        frame(wks_pdf)
+
+        plot_eps1 = gsn_csm_contour(wks_eps,data,cs_res)
+        draw(plot_eps1)
+        frame(wks_eps)
+
+        plot_ps1 = gsn_csm_contour(wks_ps,data,cs_res)
+        draw(plot_ps1)
+        frame(wks_ps)
+
+      end if 
+
+      plot1 = gsn_csm_contour(wks_x11,data,cs_res)
+
+      draw(plot1)
+      frame(wks_x11)
+
+    end if
+    end if
+    end if
+
+  end if
+
+end
Index: palm/trunk/SCRIPTS/NCL/Archive/crosssections_new.usage.txt
===================================================================
--- palm/trunk/SCRIPTS/NCL/Archive/crosssections_new.usage.txt	(revision 154)
+++ palm/trunk/SCRIPTS/NCL/Archive/crosssections_new.usage.txt	(revision 154)
@@ -0,0 +1,65 @@
+Usage of PALM NCL script crosssections_new.ncl
+==============================================
+Last change: $Id: crosssections_new.usage.txt 127 2007-10-23 11:05:25Z letzel $
+initial version: Marcus Letzel, 17 July 2007
+contour and vector overlay: Theres Franke/Marcus Letzel, 26 July 2007
+
+Command-line syntax
+===================
+ncl crosssections_new.ncl [parameters]
+
+The parameter syntax depends on their data type:
+A) numeric data    : parameter=value      (for example t=0)
+B) character string: 'parameter="string"' (for example 'var="u_xy"')
+
+Alphabetical parameter list
+===========================
+Name	Default value		Meaning
+-----------------------------------------------------------------------------
+cm	"ncview_default"	colormap
+di	""			input directory (with final /)
+d	=di			output directory (with final /)
+fi	"example_xy"		base name of input file (without suffix)
+fo	""			base name of output files (without suffix)
+fill_mode "AreaFill"		fill mode for mode="Fill":
+				"AreaFill", "RasterFill" or "CellFill"
+mode	"Fill"			output mode ("Fill" or "Line")
+t	0			output time step
+var	"u_xy"			variable to be output
+xs	-1e+38			output x-coordinate range start (in m)
+xe	+1e+38			output x-coordinate range end   (in m)
+ys	-1e+38			output y-coordinate range start (in m)
+ye	+1e+38			output y-coordinate range end   (in m)
+zs	-1e+38			output z-coordinate range start (in m)
+ze	+1e+38			output z-coordinate range end   (in m)
+co                              variable to be output as contour overlay
+wv1                             first component of wind vector overlay
+wv2                             second component of wind vector overlay
+
+Usage
+=====
+This script draws NCL contour plots from two-dimensional cross-sections of 
+NetCDF data produced by PALM. Instantaneous or time-averaged xy-, xz-, yz- or 
+3D-data can be used with this script.
+
+The sectional plane has neither a default orientation nor a default position.
+Both must be specified together using the coordinate range parameters:
+- For xy cross-sections specify zs and ze (with zs=za).
+- For xz cross-sections specify ys and ye (with ys=ya).
+- For yz cross-sections specify xs and xe (with xs=xa).
+
+The remaining coordinate range parameters can optionally be used to restrict 
+the output coordinate range.
+
+By default, only screen output is produced. Additional file output is optional
+and requires to specify the parameter fo. This will create three files: fo.pdf,
+fo.eps and fo.ps.
+
+Input and output files can optionally be preceeded by an input and output
+directory di and d, respectively. If not specified, this scripts expects the
+input file to reside in the current directory.
+
+The contours can be drawn either in "Fill" (default) or "Line" mode.
+
+The parameter co activates an optional contour overlay; the parameters wv1 and
+wv2 activate an optional vector overlay.
Index: palm/trunk/SCRIPTS/NCL/Archive/plotts.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/Archive/plotts.ncl	(revision 154)
+++ palm/trunk/SCRIPTS/NCL/Archive/plotts.ncl	(revision 154)
@@ -0,0 +1,111 @@
+load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
+
+; time series
+; last change: $Id: plotts.ncl 127 2007-10-23 11:05:25Z letzel $
+
+begin
+;
+; set default value(s) for shell script variables assigned on command line
+  if ( .not. isvar("cm") ) then     ; colormap
+    cm = "ncview_default"
+  end if
+  if ( .not. isvar("di") ) then     ; input directory (with final /)
+    di = ""
+  end if
+  if ( .not. isvar("d") ) then      ; output directory (with final /)
+    d = di
+  end if
+  if ( .not. isvar("fi") ) then     ; base name of input file (without suffix)
+    fi = "example_xy"
+  end if
+  if ( .not. isvar("fo") ) then     ; base name of output files (without suffix)
+    fo = ""
+  end if
+  if ( .not. isvar("ts") ) then      ; output time step
+    ts = 0
+  end if
+  if ( .not. isvar("te") ) then     ; output x-coordinate range start (in m)
+    te = 0
+  end if
+;
+; open input file
+  f  = addfile( di + fi  + ".nc", "r" )
+;
+; open workstation(s) and set colormap
+  wks_x11 = gsn_open_wks("x11","cross-section") ; X11 workstation
+  gsn_define_colormap(wks_x11,cm)
+  if ( isvar("fo") ) then
+    wks_pdf = gsn_open_wks("pdf",d+fo)  ; optional workstations
+    gsn_define_colormap(wks_pdf,cm)
+    wks_eps = gsn_open_wks("eps",d+fo)  ; for output on file
+    gsn_define_colormap(wks_eps,cm)
+    wks_ps  = gsn_open_wks("ps",d+fo)
+    gsn_define_colormap(wks_ps,cm)
+  end if
+;
+; read input data using 'coordinate subscripting'
+; NCL uses the closest corresponding values (in case of two equally distant 
+; values NCL chooses the smaller one)
+
+  if ( .not. isvar("var1") .and. .not. isvar("var2") .and. .not. isvar("var3")  .and. .not. isvar("var4") .and. .not. isvar("var5") .and. .not. isvar("var6")) then
+    vNam = getfilevarnames(f)
+    n2 = dimsizes(vNam)-1
+
+    print(vNam)
+
+  else
+
+    vNam = new((/6/), string)
+
+    vNam(0) = var1
+    vNam(1) = var2
+    vNam(2) = var3
+    vNam(3) = var4
+    vNam(4) = var5
+    vNam(5) = var6
+    n2 = 6
+  end if
+
+  t= f ->time({ts:te})
+
+  res=True
+  res@gsnDraw=False
+  res@gsnFrame=False
+
+  resP = True
+  resP@txString="time series"
+
+  res@vpWidthF=4
+
+  plot=new(40,graphic)                 ; create a plot array
+  plot_pdf=new(40,graphic)             ; create a plot array
+  plot_ps=new(40,graphic)              ; create a plot array
+  plot_eps=new(40,graphic)             ; create a plot array
+
+  n = 0
+
+  do while ( n .lt. n2)
+    data = f ->$vNam(n)$({ts:te})
+    plot(n) = gsn_csm_xy(wks_x11,t,data,res)
+    plot_pdf(n) = gsn_csm_xy(wks_pdf,t,data,res)
+    plot_eps(n) = gsn_csm_xy(wks_eps,t,data,res)
+    plot_ps(n) = gsn_csm_xy(wks_ps,t,data,res)
+    n = n + 1
+  end do
+
+  pa = 0
+  pb = 5
+
+  do while ( pa .lt. dimsizes(plot) )
+    gsn_panel(wks_pdf,plot_pdf(pa:pb),(/6,1/),resP) ; Panel the plots, first using rows x columns, then using number of plots per row
+    gsn_panel(wks_eps,plot_eps(pa:pb),(/6,1/),resP)
+    gsn_panel(wks_ps,plot_ps(pa:pb),(/6,1/),resP)
+    gsn_panel(wks_x11,plot(pa:pb),(/6,1/),resP)
+    pa = pa + 6
+    pb = pb + 6
+  end do
+
+end
Index: palm/trunk/SCRIPTS/NCL/cross_sections.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/cross_sections.ncl	(revision 154)
+++ palm/trunk/SCRIPTS/NCL/cross_sections.ncl	(revision 154)
@@ -0,0 +1,701 @@
+load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
+
+begin
+
+   ; ***************************************************
+   ; read parameter_list
+   ; ***************************************************
+
+   if (isfilepresent("~/.ncl_preferences")) then
+      parameter = asciiread("~/.ncl_preferences",63,"string")
+      delete(parameter@_FillValue)
+   else
+      print(" ")
+      print("Please copy '.ncl_preferences' into your $home dircetory")
+      print(" ")
+      exit
+   end if
+
+   ; ***************************************************
+   ; set default parameter values and strings if not assigned in prompt or parameter list
+   ; ***************************************************
+   
+   if ( .not. isvar("file_in") ) then     		; path+name of input file      
+      if (parameter(7) .EQ. "input file") then
+         print(" ")
+         print("Please provide input file 'file_in = ' either in prompt or parameter_list")
+         print(" ")
+         exit
+      else
+         file_in = parameter(7)
+      end if      
+   end if
+   if ( .not. isvar("format_out") ) then   		; format of output file 
+      format_out = "x11"
+      if (parameter(9) .NE. "x11") then
+         format_out = parameter(9)  
+      end if 
+   end if
+   if ( .not. isvar("file_out") ) then    	 	; path+name of output file
+      file_out = "test"
+      if (parameter(11) .NE. "test") then
+         file_out = parameter(11)  
+     end if     
+   end if
+   if ( .not. isvar("no_columns") ) then    		; number of plots in one row
+      no_columns = 1
+      if (parameter(17) .NE. "1") then
+         no_columns = stringtointeger(parameter(17))  
+      end if
+   end if
+   if ( .not. isvar("no_lines") ) then     		; number of plot-lines on one sheet
+      no_lines = 2
+      if (parameter(19) .NE. "2") then
+         no_lines = stringtointeger(parameter(19))  
+      end if
+   end if 
+   if ( .not. isvar("sort") ) then   			; sort of plots
+      sort = "time"
+      if (parameter(37) .NE. "time") then
+         sort = parameter(37)  
+      end if
+   end if 
+   if ( .not. isvar("mode") ) then   			; pattern of contour plots
+      mode = "Fill"
+      if (parameter(39) .NE. "Fill") then
+         mode = parameter(39)  
+      end if
+   end if
+   if ( .not. isvar("fill_mode") ) then 		; pattern of filling 
+      fill_mode = "AreaFill"
+      if (parameter(41) .NE. "AreaFill") then
+         mode = parameter(41)  
+      end if 
+   end if
+   if ( .not. isvar("shape") ) then   			; keeping of aspect ratio
+      shape = 1
+      if (parameter(43) .NE. "1") then
+         shape = stringtointeger(parameter(43)) 
+         if (stringtointeger(parameter(43)) .NE. 0) then
+            print(" ")
+            print("Please set 'shape' to 0 or 1")
+            print(" ")
+            exit
+         end if 
+      end if  
+   end if  
+   if ( .not. isvar("var") ) then     			; set output of all variables
+      check = True
+   end if
+
+   if ( .not. isvar("xyc") ) then   			; turn xy cross-section on or off
+      xyc = 0
+      if (parameter(45) .NE. "0") then
+         xyc = stringtointeger(parameter(45)) 
+         if (stringtointeger(parameter(45)) .NE. 1) then
+            print(" ")
+            print("Please set 'xyc' to 0 or 1")
+            print(" ")
+            exit
+         end if 
+      end if
+   end if 
+   if ( .not. isvar("xzc") ) then   			; turn xz cross-section on or off 
+      xzc = 0
+      if (parameter(47) .NE. "0") then
+         xzc = stringtointeger(parameter(47)) 
+         if (stringtointeger(parameter(47)) .NE. 1) then
+            print(" ")
+            print("Please set 'xzc' to 0 or 1")
+            print(" ")
+            exit
+         end if 
+      end if
+   end if
+   if ( .not. isvar("yzc") ) then   			; turn yz cross-section on or off 
+      yzc = 0
+      if (parameter(49) .NE. "0") then
+         yzc = stringtointeger(parameter(49)) 
+         if (stringtointeger(parameter(49)) .NE. 1) then
+            print(" ")
+            print("Please set 'yzc' to 0 or 1")
+            print(" ")
+            exit
+         end if 
+      end if
+   end if
+   if ( .not. isvar("xs") ) then     			; start of x-coordinate range 
+      xs = 0
+      if (parameter(51) .NE. "0") then
+         xs = stringtointeger(parameter(51))
+      end if
+   end if 
+   if ( .not. isvar("ys") ) then     			; start of y-coordinate range
+      ys = 0
+      if (parameter(55) .NE. "0") then
+         ys = stringtointeger(parameter(55))
+      end if
+   end if
+   if ( .not. isvar("zs") ) then     			; start of z-coordinate range
+      zs = 0
+      if (parameter(59) .NE. "0") then
+         zs = stringtointeger(parameter(59))
+      end if
+   end if  
+
+   if (xyc .EQ. 0 .AND. xzc .EQ. 0 .AND. yzc .EQ. 0) then
+      print(" ")
+      print("Please select one crossection (xyc=1 or xzc=1 or yzc=1)")
+      print(" ")
+      exit
+   end if
+   if (xyc .EQ. 1 ) then 
+      if (xzc .EQ. 1 .OR. yzc .EQ. 1) then
+         print(" ")
+         print("Please select just one crossection (xyc=1 or xzc=1 or yzc=1)")
+         print(" ") 
+         exit
+      end if
+   end if
+   if (xzc .EQ. 1) then
+      if (xyc .EQ. 1 .OR. yzc .EQ. 1) then
+         print(" ")
+         print("Please select just one crossection (xyc=1 or xzc=1 or yzc=1)")
+         print(" ")
+         exit
+      end if
+   end if
+   if (yzc .EQ. 1) then
+      if (xyc .EQ. 1 .OR. xzc .EQ. 1) then
+         print(" ")
+         print("Please select just one crossection (xyc=1 or xzc=1 or yzc=1)")
+         print(" ")
+         exit
+      end if
+   end if
+
+   ; ***************************************************
+   ; open input file
+   ; ***************************************************
+
+   f  = addfile( file_in, "r" )
+
+   vNam  = getfilevarnames(f) 
+   print(" ")
+   print("Variable on netCDF file: " + vNam)
+   print(" ")
+   dim   = dimsizes(vNam)
+  
+   ; ***************************************************
+   ; set up recourses
+   ; ***************************************************
+
+   cs_res                          = True
+   cs_res@gsnYAxisIrregular2Linear = True  
+
+   if( shape .eq. 1 ) then          			; keep the shape
+      cs_res@gsnShape = True
+   end if
+  
+   cs_res@gsnDraw                 = False
+   cs_res@gsnFrame                = False
+   cs_res@gsnMaximize             = True 
+   cs_res@gsnPaperOrientation     = "portrait"
+   cs_res@gsnPaperWidth           = 8.27
+   cs_res@gsnPaperHeight          = 11.69
+   cs_res@gsnPaperMargin          = 0.79
+   cs_res@tmXBLabelFontHeightF   = .02
+   cs_res@tmYLLabelFontHeightF   = .02
+   cs_res@tiXAxisFontHeightF     = .02
+   cs_res@tiYAxisFontHeightF     = .02
+   cs_res@tmXBMode                ="Automatic"
+   cs_res@tmYLMode                ="Automatic"
+   cs_res@lgTitleFontHeightF     = .02 
+   cs_res@lgLabelFontHeightF     = .02
+   cs_res@txFontHeightF          = .02
+   cs_resP = True
+   cs_resP@txString               = f@title
+   cs_resP@txFuncCode             = "~"         	; necessary for title
+   cs_resP@txFontHeightF          = .02
+  
+   if ( mode .eq. "Fill" ) then
+      cs_res@cnFillOn             = True
+      cs_res@gsnSpreadColors      = True
+      cs_res@cnFillMode           = fill_mode
+      cs_res@lbOrientation        = "Vertical"  	; vertical label bar
+      cs_res@cnLinesOn            = False	
+      cs_res@cnLineLabelsOn       = False
+   end if
+
+   if ( mode .eq. "Both" ) then
+      cs_res@cnFillOn             = True
+      cs_res@gsnSpreadColors      = True
+      cs_res@cnFillMode           = fill_mode
+      cs_res@lbOrientation        = "Vertical"  	; vertical label bar
+      cs_res@cnLinesOn            = True
+      cs_res@cnLineLabelsOn       = True
+   end if
+
+   ; ***************************************************
+   ; open workstation(s) 
+   ; ***************************************************
+
+   wks_ps  = gsn_open_wks(format_out,file_out)
+   gsn_define_colormap(wks_ps,"rainbow+white")
+
+   plot=new((/no_columns*no_lines/),graphic)
+
+   page = 0
+
+   nc1 = no_columns
+   nl1 = no_lines
+
+   print("plots sorted by '"+sort+"'")
+   print(" ")
+
+   do varn=0,dim-1    
+
+      data_all = f->$vNam(varn)$
+
+      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(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
+
+         ; ****************************************************
+         ; set up ranges of x-, y- and z-coordinates
+         ; ****************************************************         
+                    
+         xdim = dimsizes(data_all(0,0,0,:)) - 1    
+         ydim = 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
+            if (parameter(53) .NE. "xdim") then
+               if (stringtointeger(parameter(53)) .GT. xdim) then
+                  print(" ")
+                  print("range end for x-coordinate = "+parameter(53)+" is higher than available dimensions = "+xdim)
+                  print(" ") 
+                  exit
+               end if
+               if (stringtointeger(parameter(53)) .LT. 0 .OR. stringtointeger(parameter(53)) .LT. xs) then
+                  print(" ")
+                  print("range end for x-coordinate = "+parameter(53)+" is too small")
+                  print(" ")
+                  exit
+               end if
+               xe = stringtointeger(parameter(53)) 
+            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 ( .not. isvar("ye")) then     ; output y-coordinate range end (in index)
+            ye = ydim
+            if (parameter(57) .NE. "ydim") then
+               if (stringtointeger(parameter(57)) .GT. ydim) then
+                  print(" ")
+                  print("range end for y-coordinate = "+parameter(57)+" is higher than available dimensions = "+ydim)
+                  print(" ")
+                  exit
+               end if
+               if (stringtointeger(parameter(57)) .LT. 0 .OR. stringtointeger(parameter(57)) .LT. ys) then
+                  print(" ")
+                  print("range end for y-coordinate = "+parameter(57)+" is too small")
+                  print(" ")
+                  exit
+               end if
+               ye = stringtointeger(parameter(57)) 
+            end if 
+         else
+            if (ye .GT. ydim) then
+               print(" ")
+               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
+         end if
+         if ( .not. isvar("ze")) then     ; output z-coordinate range end (in index)
+            ze = zdim
+            if (parameter(61) .NE. "zdim") then
+               if (stringtointeger(parameter(61)) .GT. zdim) then
+                  print(" ")
+                  print("range end for z-coordinate = "+parameter(61)+" is higher than available dimensions = "+zdim)
+                  print(" ")
+                  exit
+               end if
+               if (stringtointeger(parameter(61)) .LT. 0 .OR. stringtointeger(parameter(61)) .LT. zs) then
+                  print(" ")
+                  print("range end for z-coordinate = "+parameter(61)+" is too small")
+                  print(" ")
+                  exit
+               end if
+               ze = stringtointeger(parameter(61)) 
+            end if 
+         else
+            if (ze .GT. zdim) then
+               print(" ")
+               print("range end for z-coordinate = "+ze+" is higher than available dimensions = "+zdim)
+               print(" ") 
+               exit
+            end if
+            if (ze .LT. 0 .OR. ze .LT. zs) then
+               print(" ")
+               print("range end for z-coordinate = "+ze+" is too small")
+               print(" ")
+               exit
+            end if
+         end if
+  
+         ; Defining inner and outer loop depending on variable
+         ; "sort" (values: time or layers) 
+    
+         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")
+
+         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"
+
+               if ( sort .eq. "time" ) then
+                  ta = li
+                  tb = min( (/li + no_lines*no_columns - 1, end_time_step/) )
+                  if ( xyc .eq. 1 ) then
+                     xa = xs
+                     xb = xe
+                     ya = ys
+                     yb = ye
+                     za = lo
+                     zb = lo
+                  end if
+                  if ( xzc .eq. 1 ) then
+                     xa = xs
+                     xb = xe
+                     ya = lo
+                     yb = lo
+                     za = zs
+                     zb = ze
+                  end if
+                  if ( yzc .eq. 1 ) then
+                     xa = lo
+                     xb = lo
+                     ya = ys
+                     yb = ye
+                     za = zs
+                     zb = ze
+                  end if
+               end if
+
+               if ( sort .eq. "layer" ) then
+                  ta = lo
+                  tb = lo
+                  if ( xyc .eq. 1 ) then
+                     xa = xs 
+                     xb = xe
+                     ya = ys
+                     yb = ye
+                     za = li
+                     zb = min( (/li + no_lines*no_columns - 1, ze/) )  
+                  end if
+                  if ( xzc .eq. 1 ) then
+                     xa = xs 
+                     xb = xe
+                     ya = li
+                     yb = min( (/li + no_lines*no_columns - 1, ye/) ) 
+                     za = zs
+                     zb = ze
+                  end if
+                  if ( yzc .eq. 1 ) then
+                     xa = li 
+                     xb = min( (/li + no_lines*no_columns - 1, xe/) ) 
+                     ya = ys
+                     yb = ye
+                     za = zs
+                     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
+
+               ; xy cross section
+
+               if ( xyc .eq. 1 ) then
+                  cs_res@tiXAxisString   = "x [m]"
+                  cs_res@tiYAxisString   = "y [m]"
+
+                  if ( sort .eq. "time" ) then
+                     if ( data&z(0) .eq. -1 ) then
+                        level = "-average"
+                     else 
+                        level = "=" + data&z(0) + "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)  
+                     end do
+                  end if
+
+                  if ( sort .eq. "layer" ) then
+                     do n = 0, zb-za
+                        if ( data&z(n) .eq. -1 ) then
+                           level = "-average"
+                        else 
+                           level = "=" + data&z(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)
+                     end do
+                  end if
+               end if
+
+               ; xz cross section
+
+               if ( xzc .eq. 1 ) then
+                  cs_res@tiXAxisString   = "x [m]"
+                  cs_res@tiYAxisString   = "z [m]"
+  
+                  if ( sort .eq. "time" ) then
+                     if ( data&y(0) .eq. -1 ) then
+                        level = "-average"
+                     else 
+                        level = "=" + data&y(0) + "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)  
+                     end do
+                  end if
+
+                  if ( sort .eq. "layer" ) then
+                     do n = 0, yb-ya
+                        if ( data&y(n) .eq. -1 ) then
+                           level = "-average"
+                        else 
+                           level = "=" + data&y(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)
+                     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 
+               ; ***************************************************
+         
+               gsn_panel(wks_ps, plot(0:n-1),(/no_lines,no_columns/),cs_resP)
+
+               ; To hold no_lines and no_columns constant, it must be defined again:
+
+               no_lines   = nl1
+               no_columns = nc1
+
+            end do 	
+         end do  
+      end if  
+  
+      delete(data_all)
+
+   end do   
+
+   print(" ")
+   print("Output to: " + file_out +"."+ format_out)
+   print(" ")  	
+ 
+end
Index: palm/trunk/SCRIPTS/NCL/crosssections.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/crosssections.ncl	(revision 149)
+++ 	(revision )
@@ -1,154 +1,0 @@
-load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
-load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
-load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
-load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
-
-; cross-sections
-; last change: $Id$
-
-begin
-;
-; set default value(s) for shell script variables assigned on command line
-  if ( .not. isvar("cm") ) then     ; colormap
-    cm = "ncview_default"
-  end if
-  if ( .not. isvar("di") ) then     ; input directory (with final /)
-    di = ""
-  end if
-  if ( .not. isvar("d") ) then      ; output directory (with final /)
-    d = di
-  end if
-  if ( .not. isvar("fi") ) then     ; base name of input file (without suffix)
-    fi = "example_xy"
-  end if
-  if ( .not. isvar("fill_mode") ) then ; "AreaFill", "RasterFill" or "CellFill"
-    fill_mode = "AreaFill"
-  end if
-  if ( .not. isvar("fo") ) then     ; base name of output files (without suffix)
-    fo = ""
-  end if
-  if ( .not. isvar("mode") ) then   ; output mode ("Fill" or "Line")
-    mode = "Fill"
-  end if
-  if ( .not. isvar("t") ) then      ; output time step
-    t = 0
-  end if
-  if ( .not. isvar("var") ) then    ; variable to be output
-    var = "u_xy"
-  end if
-  if ( .not. isvar("xs") ) then     ; output x-coordinate range start (in m)
-    xs = -1e+38
-  end if
-  if ( .not. isvar("xe") ) then     ; output x-coordinate range end (in m)
-    xe = 1e+38
-  end if
-  if ( .not. isvar("ys") ) then     ; output y-coordinate range start (in m)
-    ys = -1e+38
-  end if
-  if ( .not. isvar("ye") ) then     ; output y-coordinate range end (in m)
-    ye = 1e+38
-  end if
-  if ( .not. isvar("zs") ) then     ; output z-coordinate range start (in m)
-    zs = -1e+38
-  end if
-  if ( .not. isvar("ze") ) then     ; output z-coordinate range end (in m)
-    ze = 1e+38
-  end if
-;
-; open input file
-  f  = addfile( di + fi  + ".nc", "r" )
-;
-; open workstation(s) and set colormap
-  wks_x11 = gsn_open_wks("x11","cross-section") ; X11 workstation
-  gsn_define_colormap(wks_x11,cm)
-  if ( isvar("fo") ) then
-    wks_pdf = gsn_open_wks("pdf",d+fo)  ; optional workstations
-    gsn_define_colormap(wks_pdf,cm)
-    wks_eps = gsn_open_wks("eps",d+fo)  ; for output on file
-    gsn_define_colormap(wks_eps,cm)
-    wks_ps  = gsn_open_wks("ps",d+fo)
-    gsn_define_colormap(wks_ps,cm)
-  end if
-;
-; read input data using 'coordinate subscripting'
-; NCL uses the closest corresponding values (in case of two equally distant 
-; values NCL chooses the smaller one)
-  raw_data = f->$var$(t:t,{zs:ze},{ys:ye},{xs:xe})
-  raw_data!0 = "t"
-  raw_data!1 = "z"
-  raw_data!2 = "y"
-  raw_data!3 = "x"
-  time = raw_data&t
-;
-; reduce variable dimensions from 4D to 2D according to output ranges
-  if ( zs .eq. ze ) then
-    data = raw_data(0,0,:,:)
-    x_axis = "x"
-    y_axis = "y"
-    plane  = "z"
-    if ( raw_data&z .eq. -1 ) then
-      level = "-average"
-    else
-      level = "=" + raw_data&z + "m"
-    end if
-  else
-    if ( ys .eq. ye ) then
-      data = raw_data(0,:,0,:)
-      x_axis = "x"
-      y_axis = "z"
-      plane  = "y"
-      if ( raw_data&y .eq. -1 ) then
-        level = "-average"
-      else
-        level = "=" + raw_data&y + "m"
-      end if
-    else
-      if ( xs .eq. xe ) then
-        data = raw_data(0,:,:,0)
-        x_axis = "y"
-        y_axis = "z"
-        plane  = "x"
-        if ( raw_data&x .eq. -1 ) then
-          level = "-average"
-        else
-          level = "=" + raw_data&x + "m"
-        end if
-      end if
-    end if
-  end if
-  delete( raw_data )
-;
-; set up resources
-  cs_res                         = True
-  cs_res@gsnMaximize             = True 
-  cs_res@gsnPaperOrientation     = "portrait"
-  cs_res@gsnPaperWidth           = 8.27
-  cs_res@gsnPaperHeight          = 11.69
-  cs_res@gsnPaperMargin          = 0.79
-  cs_res@tiMainFuncCode          = "~"
-  cs_res@tiMainFontHeightF       = 0.015
-  cs_res@tiMainString            = f@title
-  cs_res@tiXAxisString           = x_axis + " [m]"
-  cs_res@tiYAxisString           = y_axis + " [m]"
-;  cs_res@gsnLeftString           = ""   ; gsn_csm_* scripts use default data
-  cs_res@gsnCenterString         = "t=" + time + "s  " + plane + level
-;  cs_res@gsnRightString          = ""   ; gsn_csm_* scripts use default data
-  cs_res@tmXBMode                ="Automatic"
-  cs_res@tmYLMode                ="Automatic"
-  if ( mode .eq. "Fill" ) then
-    cs_res@cnFillOn                = True
-    cs_res@gsnSpreadColors         = True
-    cs_res@cnFillMode              = fill_mode
-    cs_res@lbOrientation           = "Vertical"  ; vertical label bar
-    cs_res@cnLinesOn               = False
-    cs_res@cnLineLabelsOn          = False
-  end if
-;
-; data output
-  plot_x11 = gsn_csm_contour(wks_x11,data,cs_res)
-  if ( isvar("fo") ) then
-    plot_pdf = gsn_csm_contour(wks_pdf,data,cs_res)
-    plot_eps = gsn_csm_contour(wks_eps,data,cs_res)
-    plot_ps  = gsn_csm_contour(wks_ps, data,cs_res)
-  end if
-end
Index: palm/trunk/SCRIPTS/NCL/crosssections.usage.txt
===================================================================
--- palm/trunk/SCRIPTS/NCL/crosssections.usage.txt	(revision 149)
+++ 	(revision )
@@ -1,58 +1,0 @@
-Usage of PALM NCL script crosssections.ncl
-==========================================
-Last change: $Id$
-Marcus Letzel, 17 July 2007
-
-Command-line syntax
-===================
-ncl crosssections.ncl [parameters]
-
-The parameter syntax depends on their data type:
-A) numeric data    : parameter=value      (for example t=0)
-B) character string: 'parameter="string"' (for example 'var="u_xy"')
-
-Alphabetical parameter list
-===========================
-Name	Default value		Meaning
------------------------------------------------------------------------------
-cm	"ncview_default"	colormap
-di	""			input directory (with final /)
-d	=di			output directory (with final /)
-fi	"example_xy"		base name of input file (without suffix)
-fo	""			base name of output files (without suffix)
-fill_mode "AreaFill"		fill mode for mode="Fill":
-				"AreaFill", "RasterFill" or "CellFill"
-mode	"Fill"			output mode ("Fill" or "Line")
-t	0			output time step
-var	"u_xy"			variable to be output
-xs	-1e+38			output x-coordinate range start (in m)
-xe	+1e+38			output x-coordinate range end   (in m)
-ys	-1e+38			output y-coordinate range start (in m)
-ye	+1e+38			output y-coordinate range end   (in m)
-zs	-1e+38			output z-coordinate range start (in m)
-ze	+1e+38			output z-coordinate range end   (in m)
-
-Usage
-=====
-This script draws NCL contour plots from two-dimensional cross-sections of 
-NetCDF data produced by PALM. Instantaneous or time-averaged xy-, xz-, yz- or 
-3D-data can be used with this script.
-
-The sectional plane has neither a default orientation nor a default position.
-Both must be specified together using the coordinate range parameters:
-- For xy cross-sections specify zs and ze (with zs=za).
-- For xz cross-sections specify ys and ye (with ys=ya).
-- For yz cross-sections specify xs and xe (with xs=xa).
-
-The remaining coordinate range parameters can optionally be used to restrict 
-the output coordinate range.
-
-By default, only screen output is produced. Additional file output is optional
-and requires to specify the parameter fo. This will create three files: fo.pdf,
-fo.eps and fo.ps.
-
-Input and output files can optionally be preceeded by an input and output
-directory di and d, respectively. If not specified, this scripts expects the
-input file to reside in the current directory.
-
-The contours can be drawn either in "Fill" (default) or "Line" mode.
Index: palm/trunk/SCRIPTS/NCL/crosssections_new.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/crosssections_new.ncl	(revision 149)
+++ 	(revision )
@@ -1,473 +1,0 @@
-load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
-load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
-load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
-load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
-
-; cross-sections
-; last change: $Id$
-
-begin
-;
-; set default value(s) for shell script variables assigned on command line
-  if ( .not. isvar("cm") ) then     ; colormap
-    cm = "ncview_default"
-  end if
-  if ( .not. isvar("di") ) then     ; input directory (with final /)
-    di = ""
-  end if
-  if ( .not. isvar("d") ) then      ; output directory (with final /)
-    d = di
-  end if
-  if ( .not. isvar("fi") ) then     ; base name of input file (without suffix)
-    fi = "example_xy"
-  end if
-  if ( .not. isvar("fill_mode") ) then ; "AreaFill", "RasterFill" or "CellFill"
-    fill_mode = "AreaFill"
-  end if
-  if ( .not. isvar("fo") ) then     ; base name of output files (without suffix)
-    fo = ""
-  end if
-  if ( .not. isvar("mode") ) then   ; output mode ("Fill" or "Line")
-    mode = "Fill"
-  end if
-  if ( .not. isvar("t") ) then      ; output time step
-    t = 0
-  end if
-  if ( .not. isvar("var") ) then    ; variable to be output
-    var = "u_xy"
-  end if
-  if ( .not. isvar("xs") ) then     ; output x-coordinate range start (in m)
-    xs = -1e+38
-  end if
-  if ( .not. isvar("xe") ) then     ; output x-coordinate range end (in m)
-    xe = 1e+38
-  end if
-  if ( .not. isvar("ys") ) then     ; output y-coordinate range start (in m)
-    ys = -1e+38
-  end if
-  if ( .not. isvar("ye") ) then     ; output y-coordinate range end (in m)
-    ye = 1e+38
-  end if
-  if ( .not. isvar("zs") ) then     ; output z-coordinate range start (in m)
-    zs = -1e+38
-  end if
-  if ( .not. isvar("ze") ) then     ; output z-coordinate range end (in m)
-    ze = 1e+38
-  end if
-;
-; open input file
-  f  = addfile( di + fi  + ".nc", "r" )
-;
-; open workstation(s) and set colormap
-  wks_x11 = gsn_open_wks("x11","cross-section") ; X11 workstation
-  gsn_define_colormap(wks_x11,cm)
-  if ( isvar("fo") ) then
-    wks_pdf = gsn_open_wks("pdf",d+fo)  ; optional workstations
-    gsn_define_colormap(wks_pdf,cm)
-    wks_eps = gsn_open_wks("eps",d+fo)  ; for output on file
-    gsn_define_colormap(wks_eps,cm)
-    wks_ps  = gsn_open_wks("ps",d+fo)
-    gsn_define_colormap(wks_ps,cm)
-  end if
-;
-; read input data using 'coordinate subscripting'
-; NCL uses the closest corresponding values (in case of two equally distant 
-; values NCL chooses the smaller one)
-  raw_data = f->$var$(t:t,{zs:ze},{ys:ye},{xs:xe})
-  raw_data!0 = "t"
-  raw_data!1 = "z"
-  raw_data!2 = "y"
-  raw_data!3 = "x"
-  time = raw_data&t
-;
-; reduce variable dimensions from 4D to 2D according to output ranges
-  if ( zs .eq. ze ) then
-    data = raw_data(0,0,:,:)
-    x_axis = "x"
-    y_axis = "y"
-    plane  = "z"
-
-    dx =  f->x(1)
-    dy =  f->y(1)
-
-    if ( raw_data&z .eq. -1 ) then
-      level = "-average"
-    else
-      level = "=" + raw_data&z + "m"
-    end if
-  else
-    if ( ys .eq. ye ) then
-      data = raw_data(0,:,0,:)
-      x_axis = "x"
-      y_axis = "z"
-      plane  = "y"
-
-      dx =  f->x(1)
-      if (isfilevar(f, "zw_3d")) then
-        dz =  f->zw_3d(1)
-      else
-        dz =  f->zw(1)
-      end if
-
-      if ( raw_data&y .eq. -1 ) then
-        level = "-average"
-      else
-        level = "=" + raw_data&y + "m"
-      end if
-    else
-      if ( xs .eq. xe ) then
-        data = raw_data(0,:,:,0)
-        x_axis = "y"
-        y_axis = "z"
-        plane  = "x"
-
-        dy =  f->y(1)
-        if (isfilevar(f, "zw_3d")) then
-          dz =  f->zw_3d(1)
-        else
-          dz =  f->zw(1)
-        end if
-
-        if ( raw_data&x .eq. -1 ) then
-          level = "-average"
-        else
-          level = "=" + raw_data&x + "m"
-        end if
-      end if
-    end if
-  end if
-  delete( raw_data )
-;
-; set up resources
-  cs_res                         = True
-  cs_res@gsnDraw                 = False  
-  cs_res@gsnFrame                = False 
-  cs_res@gsnMaximize             = True 
-  cs_res@gsnPaperOrientation     = "portrait"
-  cs_res@gsnPaperWidth           = 8.27
-  cs_res@gsnPaperHeight          = 11.69
-  cs_res@gsnPaperMargin          = 0.79
-  cs_res@tiMainFuncCode          = "~"
-  cs_res@tiMainFontHeightF       = 0.015
-  cs_res@tiMainString            = f@title
-  cs_res@tiXAxisString           = x_axis + " [m]"
-  cs_res@tiYAxisString           = y_axis + " [m]"
-;  cs_res@gsnLeftString           = ""   ; gsn_csm_* scripts use default data
-  cs_res@gsnCenterString         = "t=" + time + "s  " + plane + level
-;  cs_res@gsnRightString          = ""   ; gsn_csm_* scripts use default data
-  cs_res@tmXBMode                ="Automatic"
-  cs_res@tmYLMode                ="Automatic"
-  if ( mode .eq. "Fill" ) then
-    cs_res@cnFillOn                = True
-    cs_res@gsnSpreadColors         = True
-    cs_res@cnFillMode              = fill_mode
-    cs_res@lbOrientation           = "Vertical"  ; vertical label bar
-    cs_res@cnLinesOn               = False
-    cs_res@cnLineLabelsOn          = False
-  end if
-
-  vector     = True
-  co_overlay = True
-
-  if ( .not. isvar("wv1") ) then
-    vector = False
-  end if
-  if ( .not. isvar("wv2") ) then
-    vector = False
-  end if
-  if ( .not. isvar("co") ) then
-    co_overlay = False
-  end if
-
-  if ( vector .eq. True ) then
-
-    if ( wv1 .eq. "u_xy" .or.  wv1 .eq. "u_xz" .or. wv1 .eq. "u_yz" ) then
-
-      raw_data = f->$wv1$(t:t,{zs:ze},{ys:ye},{xs-(0.5*dx):xe-(0.5*dx)}) 
-      raw_data!0 = "t"
-      raw_data!1 = "z"
-      raw_data!2 = "y"
-      raw_data!3 = "x"
-      time = raw_data&t
-
-    else
-
-      if ( wv1 .eq. "v_xy" .or.  wv1 .eq. "v_xz" .or. wv1 .eq. "v_yz" ) then
-
-        raw_data = f->$wv1$(t:t,{zs:ze},{ys-(0.5*dy):ye-(0.5*dy)},{xs:xe}) 
-        raw_data!0 = "t"
-        raw_data!1 = "z"
-        raw_data!2 = "y"
-        raw_data!3 = "x"
-        time = raw_data&t
-
-      else
-
-        if ( wv1 .eq. "w_xy" .or.  wv1 .eq. "w_xz" .or. wv1 .eq. "w_yz" ) then
-
-          raw_data = f->$wv1$(t:t,{zs+(0.5*dz):ze+(0.5*dz)},{ys:ye},{xs:xe}) 
-          raw_data!0 = "t"
-          raw_data!1 = "z"
-          raw_data!2 = "y"
-          raw_data!3 = "x"
-          time = raw_data&t
-
-        end if
-      end if
-    end if
-
-    if ( zs .eq. ze ) then
-      data_u = raw_data(0,0,:,:)
-    else
-      if ( ys .eq. ye ) then
-        data_u = raw_data(0,:,0,:)
-      else
-        if ( xs .eq. xe ) then
-          data_u = raw_data(0,:,:,0)
-        end if
-      end if
-    end if
-    delete( raw_data )
-
-    if ( wv2 .eq. "u_xy" .or.  wv2 .eq. "u_xz" .or. wv2 .eq. "u_yz" ) then
-
-      raw_data = f->$wv2$(t:t,{zs:ze},{ys:ye},{xs-(0.5*dx):xe-(0.5*dx)}) 
-      raw_data!0 = "t"
-      raw_data!1 = "z"
-      raw_data!2 = "y"
-      raw_data!3 = "x"
-      time = raw_data&t
-
-    else
-
-      if ( wv2 .eq. "v_xy" .or.  wv2 .eq. "v_xz" .or. wv2 .eq. "v_yz" ) then
-
-        raw_data = f->$wv2$(t:t,{zs:ze},{ys-(0.5*dy):ye-(0.5*dy)},{xs:xe}) 
-        raw_data!0 = "t"
-        raw_data!1 = "z"
-        raw_data!2 = "y"
-        raw_data!3 = "x"
-        time = raw_data&t
-
-      else
-
-        if ( wv2 .eq. "w_xy" .or.  wv2 .eq. "w_xz" .or. wv2 .eq. "w_yz" ) then
-
-          raw_data = f->$wv2$(t:t,{zs+(0.5*dz):ze+(0.5*dz)},{ys:ye},{xs:xe}) 
-          raw_data!0 = "t"
-          raw_data!1 = "z"
-          raw_data!2 = "y"
-          raw_data!3 = "x"
-          time = raw_data&t
-
-        end if
-      end if
-    end if
-
-
-    if ( zs .eq. ze ) then
-      data_v = raw_data(0,0,:,:)
-    else
-      if ( ys .eq. ye ) then
-        data_v = raw_data(0,:,0,:)
-      else
-        if ( xs .eq. xe ) then
-          data_v = raw_data(0,:,:,0)
-        end if
-      end if
-    end if
-    delete( raw_data )
-
-    wv_res                     = True
-    wv_res@gsnDraw             = False  
-    wv_res@gsnFrame            = False
-    wv_res@gsnRightString      = ""
-    wv_res@gsnLeftString       = ""
-    wv_res@gsnCenterString     = ""
-    wv_res@vpClipOn            = True
-
-  end if
-
-  if ( co_overlay .eq. True ) then
-
-    raw_data = f->$co$(t:t,{zs:ze},{ys:ye},{xs:xe}) 
-    raw_data!0 = "t"
-    raw_data!1 = "z"
-    raw_data!2 = "y"
-    raw_data!3 = "x"
-    time = raw_data&t
-
-    if ( zs .eq. ze ) then
-      data2 = raw_data(0,0,:,:)
-    else
-      if ( ys .eq. ye ) then
-        data2 = raw_data(0,:,0,:)
-      else
-        if ( xs .eq. xe ) then
-          data2 = raw_data(0,:,:,0)
-        end if
-      end if
-    end if
-    delete( raw_data )
-
-    co_res                              = True
-    co_res@cnLineThicknessF             = 1.0
-    co_res@gsnDraw                      = False
-    co_res@gsnFrame                     = False
-    co_res@gsnContourZeroLineThicknessF = 2.0
-    co_res@gsnContourNegLineDashPattern = 4
-    co_res@cnLineColor                  = "Black"
-    co_res@gsnRightString   = ""
-    co_res@gsnLeftString    = ""
-    co_res@gsnCenterString  = ""
-
-;    co_res1@cnLevelSelectionMode = "ManualLevels"     ; set manual contour levels
-;    co_res1@cnMinLevelValF       = -5.                ; set min contour level
-;    co_res1@cnMaxLevelValF       =  5.                ; set max contour level
-;    co_res1@cnLevelSpacingF      =  0.5               ; set contour spacing
-     co_res@cnLineLabelsOn        = True
-     co_res@cnLineLabelPlacementMode   = "constant"
-;    co_res@cnLineLabelBackgroundColor = "white"
-
-  end if
-
-  if ( co_overlay .eq. True .and. vector .eq. True ) then 
-
-    if ( isvar("fo") ) then
-
-      plot_pdf2 = gsn_csm_contour(wks_pdf,data2,co_res)
-      plot_pdf1 = gsn_csm_contour(wks_pdf,data,cs_res)
-      plot_pdf3 = gsn_csm_vector(wks_pdf,data_u,data_v,wv_res)
-      overlay(plot_pdf1,plot_pdf2)
-      overlay(plot_pdf1,plot_pdf3)
-      draw(plot_pdf1)
-      frame(wks_pdf)
-
-      plot_eps2 = gsn_csm_contour(wks_eps,data2,co_res)
-      plot_eps1 = gsn_csm_contour(wks_eps,data,cs_res)
-      plot_eps3 = gsn_csm_vector(wks_eps,data_u,data_v,wv_res)
-      overlay(plot_eps1,plot_eps2)
-      overlay(plot_eps1,plot_eps3)
-      draw(plot_eps1)
-      frame(wks_eps)
-
-      plot_ps2 = gsn_csm_contour(wks_ps,data2,co_res)
-      plot_ps1 = gsn_csm_contour(wks_ps,data,cs_res)
-      plot_ps3 = gsn_csm_vector(wks_ps,data_u,data_v,wv_res)
-      overlay(plot_ps1,plot_ps2)
-      overlay(plot_ps1,plot_ps3)
-      draw(plot_ps1)
-      frame(wks_ps)
-
-    end if
-
-    plot1 = gsn_csm_contour(wks_x11,data,cs_res)
-    plot2 = gsn_csm_contour(wks_x11,data2,co_res)
-    plot3 = gsn_csm_vector(wks_x11,data_u,data_v,wv_res)
-
-    overlay(plot1,plot2)
-    overlay(plot1,plot3)
-
-    draw(plot1)
-    frame(wks_x11)
-
-  else
-
-    if ( co_overlay .eq. True .and. vector .ne. True ) then
-
-      if ( isvar("fo") ) then
-
-        plot_pdf2 = gsn_csm_contour(wks_pdf,data2,co_res)
-        plot_pdf1 = gsn_csm_contour(wks_pdf,data,cs_res)
-        overlay(plot_pdf1,plot_pdf2)
-        draw(plot_pdf1)       
-        frame(wks_pdf)
-
-        plot_eps2 = gsn_csm_contour(wks_eps,data2,co_res)
-        plot_eps1 = gsn_csm_contour(wks_eps,data,cs_res)
-        overlay(plot_eps1,plot_eps2)
-        draw(plot_eps1)
-        frame(wks_eps)
-
-        plot_ps2 = gsn_csm_contour(wks_ps,data2,co_res)
-        plot_ps1 = gsn_csm_contour(wks_ps,data,cs_res)
-        overlay(plot_ps1,plot_ps2)
-        draw(plot_ps1)
-        frame(wks_ps)
-
-      end if 
-
-      plot1 = gsn_csm_contour(wks_x11,data,cs_res)
-      plot2 = gsn_csm_contour(wks_x11,data2,co_res)
-
-      overlay(plot1,plot2)
-
-      draw(plot1)
-      frame(wks_x11)
-
-    else
-
-    if ( co_overlay .ne. True .and. vector .eq. True ) then 
-
-      if ( isvar("fo") ) then
-
-        plot_pdf1 = gsn_csm_contour(wks_pdf,data,cs_res)
-        plot_pdf3 = gsn_csm_vector(wks_pdf,data_u,data_v,wv_res)
-        overlay(plot_pdf1,plot_pdf3)
-        draw(plot_pdf1)
-        frame(wks_pdf)
-
-        plot_eps1 = gsn_csm_contour(wks_eps,data,cs_res)
-        plot_eps3 = gsn_csm_vector(wks_eps,data_u,data_v,wv_res)
-        overlay(plot_eps1,plot_eps3)
-        draw(plot_eps1)
-        frame(wks_eps)
-
-        plot_ps1 = gsn_csm_contour(wks_ps,data,cs_res)
-        plot_ps3 = gsn_csm_vector(wks_ps,data_u,data_v,wv_res)
-        overlay(plot_ps1,plot_ps3)
-        draw(plot_ps1)
-        frame(wks_ps)
-
-      end if 
-
-      plot1 = gsn_csm_contour(wks_x11,data,cs_res)
-      plot3 = gsn_csm_vector(wks_x11,data_u,data_v,wv_res)
-
-      overlay(plot1,plot3)
-
-      draw(plot1)
-      frame(wks_x11)
-
-    else
-
-    if ( co_overlay .ne. True .and. vector .ne. True) then 
-
-      if ( isvar("fo") ) then
-
-        plot_pdf1 = gsn_csm_contour(wks_pdf,data,cs_res)
-        draw(plot_pdf1)
-        frame(wks_pdf)
-
-        plot_eps1 = gsn_csm_contour(wks_eps,data,cs_res)
-        draw(plot_eps1)
-        frame(wks_eps)
-
-        plot_ps1 = gsn_csm_contour(wks_ps,data,cs_res)
-        draw(plot_ps1)
-        frame(wks_ps)
-
-      end if 
-
-      plot1 = gsn_csm_contour(wks_x11,data,cs_res)
-
-      draw(plot1)
-      frame(wks_x11)
-
-    end if
-    end if
-    end if
-
-  end if
-
-end
Index: palm/trunk/SCRIPTS/NCL/crosssections_new.usage.txt
===================================================================
--- palm/trunk/SCRIPTS/NCL/crosssections_new.usage.txt	(revision 149)
+++ 	(revision )
@@ -1,65 +1,0 @@
-Usage of PALM NCL script crosssections_new.ncl
-==============================================
-Last change: $Id$
-initial version: Marcus Letzel, 17 July 2007
-contour and vector overlay: Theres Franke/Marcus Letzel, 26 July 2007
-
-Command-line syntax
-===================
-ncl crosssections_new.ncl [parameters]
-
-The parameter syntax depends on their data type:
-A) numeric data    : parameter=value      (for example t=0)
-B) character string: 'parameter="string"' (for example 'var="u_xy"')
-
-Alphabetical parameter list
-===========================
-Name	Default value		Meaning
------------------------------------------------------------------------------
-cm	"ncview_default"	colormap
-di	""			input directory (with final /)
-d	=di			output directory (with final /)
-fi	"example_xy"		base name of input file (without suffix)
-fo	""			base name of output files (without suffix)
-fill_mode "AreaFill"		fill mode for mode="Fill":
-				"AreaFill", "RasterFill" or "CellFill"
-mode	"Fill"			output mode ("Fill" or "Line")
-t	0			output time step
-var	"u_xy"			variable to be output
-xs	-1e+38			output x-coordinate range start (in m)
-xe	+1e+38			output x-coordinate range end   (in m)
-ys	-1e+38			output y-coordinate range start (in m)
-ye	+1e+38			output y-coordinate range end   (in m)
-zs	-1e+38			output z-coordinate range start (in m)
-ze	+1e+38			output z-coordinate range end   (in m)
-co                              variable to be output as contour overlay
-wv1                             first component of wind vector overlay
-wv2                             second component of wind vector overlay
-
-Usage
-=====
-This script draws NCL contour plots from two-dimensional cross-sections of 
-NetCDF data produced by PALM. Instantaneous or time-averaged xy-, xz-, yz- or 
-3D-data can be used with this script.
-
-The sectional plane has neither a default orientation nor a default position.
-Both must be specified together using the coordinate range parameters:
-- For xy cross-sections specify zs and ze (with zs=za).
-- For xz cross-sections specify ys and ye (with ys=ya).
-- For yz cross-sections specify xs and xe (with xs=xa).
-
-The remaining coordinate range parameters can optionally be used to restrict 
-the output coordinate range.
-
-By default, only screen output is produced. Additional file output is optional
-and requires to specify the parameter fo. This will create three files: fo.pdf,
-fo.eps and fo.ps.
-
-Input and output files can optionally be preceeded by an input and output
-directory di and d, respectively. If not specified, this scripts expects the
-input file to reside in the current directory.
-
-The contours can be drawn either in "Fill" (default) or "Line" mode.
-
-The parameter co activates an optional contour overlay; the parameters wv1 and
-wv2 activate an optional vector overlay.
Index: palm/trunk/SCRIPTS/NCL/plotts.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/plotts.ncl	(revision 149)
+++ 	(revision )
@@ -1,111 +1,0 @@
-load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
-load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
-load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
-load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
-
-; time series
-; last change: $Id$
-
-begin
-;
-; set default value(s) for shell script variables assigned on command line
-  if ( .not. isvar("cm") ) then     ; colormap
-    cm = "ncview_default"
-  end if
-  if ( .not. isvar("di") ) then     ; input directory (with final /)
-    di = ""
-  end if
-  if ( .not. isvar("d") ) then      ; output directory (with final /)
-    d = di
-  end if
-  if ( .not. isvar("fi") ) then     ; base name of input file (without suffix)
-    fi = "example_xy"
-  end if
-  if ( .not. isvar("fo") ) then     ; base name of output files (without suffix)
-    fo = ""
-  end if
-  if ( .not. isvar("ts") ) then      ; output time step
-    ts = 0
-  end if
-  if ( .not. isvar("te") ) then     ; output x-coordinate range start (in m)
-    te = 0
-  end if
-;
-; open input file
-  f  = addfile( di + fi  + ".nc", "r" )
-;
-; open workstation(s) and set colormap
-  wks_x11 = gsn_open_wks("x11","cross-section") ; X11 workstation
-  gsn_define_colormap(wks_x11,cm)
-  if ( isvar("fo") ) then
-    wks_pdf = gsn_open_wks("pdf",d+fo)  ; optional workstations
-    gsn_define_colormap(wks_pdf,cm)
-    wks_eps = gsn_open_wks("eps",d+fo)  ; for output on file
-    gsn_define_colormap(wks_eps,cm)
-    wks_ps  = gsn_open_wks("ps",d+fo)
-    gsn_define_colormap(wks_ps,cm)
-  end if
-;
-; read input data using 'coordinate subscripting'
-; NCL uses the closest corresponding values (in case of two equally distant 
-; values NCL chooses the smaller one)
-
-  if ( .not. isvar("var1") .and. .not. isvar("var2") .and. .not. isvar("var3")  .and. .not. isvar("var4") .and. .not. isvar("var5") .and. .not. isvar("var6")) then
-    vNam = getfilevarnames(f)
-    n2 = dimsizes(vNam)-1
-
-    print(vNam)
-
-  else
-
-    vNam = new((/6/), string)
-
-    vNam(0) = var1
-    vNam(1) = var2
-    vNam(2) = var3
-    vNam(3) = var4
-    vNam(4) = var5
-    vNam(5) = var6
-    n2 = 6
-  end if
-
-  t= f ->time({ts:te})
-
-  res=True
-  res@gsnDraw=False
-  res@gsnFrame=False
-
-  resP = True
-  resP@txString="time series"
-
-  res@vpWidthF=4
-
-  plot=new(40,graphic)                 ; create a plot array
-  plot_pdf=new(40,graphic)             ; create a plot array
-  plot_ps=new(40,graphic)              ; create a plot array
-  plot_eps=new(40,graphic)             ; create a plot array
-
-  n = 0
-
-  do while ( n .lt. n2)
-    data = f ->$vNam(n)$({ts:te})
-    plot(n) = gsn_csm_xy(wks_x11,t,data,res)
-    plot_pdf(n) = gsn_csm_xy(wks_pdf,t,data,res)
-    plot_eps(n) = gsn_csm_xy(wks_eps,t,data,res)
-    plot_ps(n) = gsn_csm_xy(wks_ps,t,data,res)
-    n = n + 1
-  end do
-
-  pa = 0
-  pb = 5
-
-  do while ( pa .lt. dimsizes(plot) )
-    gsn_panel(wks_pdf,plot_pdf(pa:pb),(/6,1/),resP) ; Panel the plots, first using rows x columns, then using number of plots per row
-    gsn_panel(wks_eps,plot_eps(pa:pb),(/6,1/),resP)
-    gsn_panel(wks_ps,plot_ps(pa:pb),(/6,1/),resP)
-    gsn_panel(wks_x11,plot(pa:pb),(/6,1/),resP)
-    pa = pa + 6
-    pb = pb + 6
-  end do
-
-end
Index: palm/trunk/SCRIPTS/NCL/profiles.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/profiles.ncl	(revision 154)
+++ palm/trunk/SCRIPTS/NCL/profiles.ncl	(revision 154)
@@ -0,0 +1,541 @@
+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"
+ 
+begin
+
+   ; ***************************************************
+   ; read parameter_list
+   ; ***************************************************
+
+   if (isfilepresent("~/.ncl_preferences")) then
+      parameter = asciiread("~/.ncl_preferences",63,"string")
+      delete(parameter@_FillValue)
+   else
+      print(" ")
+      print("Please copy '.ncl_preferences' into your $home dircetory")
+      print(" ")
+      exit
+   end if
+ 
+   ; ***************************************************
+   ; set up default parameter values and strings if not assigned in prompt or parameter list
+   ; ***************************************************
+ 
+   if ( .not. isvar("file_in") ) then     		; path+name of input file      
+      if (parameter(7) .EQ. "input file") then
+         print(" ")
+         print("Please provide input file 'file_in = ' either in prompt or parameter_list")
+         print(" ")
+         exit
+      else
+         file_in = parameter(7)
+      end if      
+   end if
+   if ( .not. isvar("format_out") ) then   		; format of output file 
+      format_out = "x11"
+      if (parameter(9) .NE. "x11") then
+         format_out = parameter(9)  
+      end if 
+   end if
+   if ( .not. isvar("file_out") ) then    	 	; path+name of output file
+      file_out = "test"
+      if (parameter(11) .NE. "test_ts") then
+         file_out = parameter(11)  
+     end if     
+   end if
+   if ( .not. isvar("no_columns") ) then    		; number of plots in one row
+      no_columns = 1
+      if (parameter(17) .NE. "1") then
+         no_columns = stringtointeger(parameter(17))  
+      end if
+   end if
+   if ( .not. isvar("no_lines") ) then     		; number of plot-lines on one sheet
+      no_lines = 2
+      if (parameter(19) .NE. "2") then
+         no_lines = stringtointeger(parameter(19))  
+      end if
+   end if 
+   if ( .not. isvar("combine") ) then  		 	; color of lines
+      combine = 0
+      if (parameter(23) .NE. "0") then
+         combine = stringtointeger(parameter(23)) 
+         if (stringtointeger(parameter(23)) .NE. 1) then
+            print(" ")
+            print("Please set 'combine' to 0 or 1")
+            print(" ")
+            exit
+         end if
+      end if
+   end if
+   if (combine .EQ. 1) then
+      if( .not. isvar("c_var") ) then
+         c_var=" "
+         if (parameter(27) .NE. "c_variables") then
+            c_var=parameter(27)
+         end if
+      end if
+   end if
+   if ( .not. isvar("black") ) then  		 	; color of lines
+      black = 0
+      if (parameter(31) .NE. "0") then
+         black = stringtointeger(parameter(31)) 
+         if (stringtointeger(parameter(31)) .NE. 1) then
+            print(" ")
+            print("Please set 'black' to 0 or 1")
+            print(" ")
+            exit
+         end if
+      end if
+   end if
+   if ( .not. isvar("dash") ) then   		 	; pattern of lines
+      dash = 0
+      if (parameter(29) .NE. "0") then
+         dash = stringtointeger(parameter(29))
+         if (stringtointeger(parameter(29)) .NE. 1) then
+            print(" ")
+            print("Please set 'dash' to 0 or 1")
+            print(" ")
+            exit
+         end if  
+      end if
+   end if
+
+   ; ***************************************************
+   ; open input file
+   ; ***************************************************
+
+   f=addfile( file_in,"r")
+   
+   vNam  = getfilevarnames(f) 
+   print(" ")
+   print("Variable on netCDF file: " + vNam)
+   print(" ")
+   dim   = dimsizes(vNam)
+   z_pr  = f->zpt
+   dimz  = dimsizes(z_pr)
+   t_all = f->time
+   nt    = dimsizes(t_all)
+
+   ; ****************************************************	
+   ; 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(13))
+            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
+
+   ; ****************************************************
+   ; set up legend and colors 
+   ; ****************************************************
+   
+   legend_label=new(nt-1,double)
+   do p=start_time_step,end_time_step
+      legend_label(p-start_time_step)=t_all(p)
+   end do
+   
+   np = end_time_step-start_time_step  
+   if ( black .eq. 0 ) then
+      res=True      
+      res@xyLineColors = ispan(2,237,235/np)
+   end if
+
+   ; ***************************************************
+   ; set up recourses
+   ; ***************************************************
+
+   res@gsnDraw                 = False
+   res@gsnFrame                = False
+   res@gsnPaperOrientation     = "portrait"
+   ;  res@gsnmaximize             = True
+   res@gsnPaperWidth           = 8.27
+   res@gsnPaperHeight          = 11.69
+   res@gsnPaperMargin          = 0.79
+   res@txFont                  = "helvetica"
+   res@tiMainFont              = "helvetica"
+   res@tiXAxisFont             = "helvetica"
+   res@tiYAxisFont             = "helvetica"
+   res@tmXBLabelFont           = "helvetica"
+   res@tmYLLabelFont           = "helvetica"
+   res@lgLabelFont             = "helvetica"
+   res@tmLabelAutoStride       = True
+   res@pmLegendDisplayMode     = "Always"
+   res@pmLegendSide            = "Top"
+   res@xyExplicitLegendLabels  = legend_label
+   res@pmLegendParallelPosF    = 1.4
+   res@pmLegendOrthogonalPosF  = -1.085
+   res@pmLegendWidthF          = 0.12
+   res@pmLegendHeightF         = 0.3
+   res@lgLabelFontHeightF     = .02 
+   ;  res@XBLabelConstantSpacingF = 1.0
+
+   if ( dash .eq. 0 ) then
+      res@xyMonoDashPattern       = True  
+   end if 
+
+   resP                        = True
+   resP@txFont                 = "helvetica"
+   resP@txString               = f@title
+   resP@txFuncCode             = "~"
+   resP@txFontHeightF          = 0.014
+
+   ; ***************************************************
+   ; set up colors and recourses for combined plot
+   ; ***************************************************
+   
+   if (combine .EQ. 1) then
+
+      if (.not. isvar("number_comb")) then
+         m=0
+         m=stringtointeger(parameter(25))
+         if(m .EQ. 0) then
+            print(" ")
+            print("Please indicate the number of variables you would like to combine ('number_comb')")
+            print(" ")
+            exit
+         end if
+      end if
+    
+      ores=True
+      
+      colors=new(m*(nt-1),integer)
+      do j=0,m-1
+         colors(j+j*(nt-2):(j+1)*(nt-1)-1) = ispan(2,237,235/np)
+      end do   
+      ores@xyLineColors = colors
+
+      dash_oplot=new(m*(nt-1),integer)
+      do j=0,m-1
+         dash_oplot(j+j*(nt-2):(j+1)*(nt-1)-1)=j
+      end do
+      ores@xyDashPatterns = dash_oplot
+
+      ores                         = True
+      ores@gsnDraw                 = False
+      ores@gsnFrame                = False
+      ores@gsnPaperOrientation     = "portrait"
+      ;  ores@gsnmaximize             = True
+      ores@gsnPaperWidth           = 8.27
+      ores@gsnPaperHeight          = 11.69
+      ores@gsnPaperMargin          = 0.79
+      ores@txFont                  = "helvetica"
+      ores@tiMainFont              = "helvetica"
+      ores@tiXAxisFont             = "helvetica"
+      ores@tiYAxisFont             = "helvetica"
+      ores@tmXBLabelFont           = "helvetica"
+      ores@tmYLLabelFont           = "helvetica"
+      ores@lgLabelFont             = "helvetica"
+      ores@tmLabelAutoStride       = True
+      ores@pmLegendDisplayMode     = "Always"
+      ores@pmLegendSide            = "Top"
+      ores@pmLegendParallelPosF    = 1.4
+      ores@pmLegendOrthogonalPosF  = -1.085
+      ores@pmLegendWidthF          = 0.15
+      ores@pmLegendHeightF         = 0.60
+      ores@lgLabelFontHeightF     = .02 
+      ;  ores@XBLabelConstantSpacingF = 1.0
+ 
+   end if
+
+   ; ***************************************************
+   ; set up graphics for plot
+   ; ***************************************************
+
+   plot  = new(dim,graphic)
+
+   wks=gsn_open_wks(format_out,file_out)
+   gsn_define_colormap(wks,"rainbow+white") 
+ 
+   ; ***************************************************
+   ; indicate plot number
+   ; ***************************************************
+
+   if (combine .EQ. 1) then
+      n = 1 
+   else
+      n = 0
+   end if 
+  
+   ; ***************************************************
+   ; set up minimum and maximum height
+   ; ***************************************************
+
+   if (.not. isvar("min_z"))
+      min_z=0
+      if (stringtointeger(parameter(33)) .NE. 0) then
+         if (stringtointeger(parameter(33)) .GE. max(z_pr) ) then
+            print(" ")
+            print("Minimum of height ('min_z'="+stringtointeger(parameter(33))+") is greater than available heights (="+max(z_pr)+")")
+            print(" ")
+            exit
+         end if
+         if (stringtointeger(parameter(33)) .LT. 0 ) then
+            print(" ")
+            print("Begin minimum of height 'min_z' with 0")
+            print(" ")
+            exit
+         end if 
+         min_z=stringtointeger(parameter(33))
+      end if
+   else
+      if (min_z .GE. max(z_pr) ) then
+         print(" ")
+         print("Minimum of height ('min_z'="+min_z+") is greater than available heights (="+max(z_pr)+")")
+         print(" ")
+         exit
+      end if
+      if (min_z .LT. 0 ) then
+         print(" ")
+         print("Begin minimum of height 'min_z' with 0")
+         print(" ")
+         exit
+      end if
+   end if
+
+   if (.not. isvar("max_z"))
+      max_z=max(z_pr)
+      if ((parameter(35)) .NE. "max(z_pr)") then
+         if (stringtofloat(parameter(35)) .GE. max(z_pr) ) then
+            print(" ")
+            print("Maximum of height ('max_z'="+parameter(35)+") is greater than available heights (="+max(z_pr)+")")
+            print(" ")
+            exit
+         end if
+         if (stringtointeger(parameter(35)) .LE. 0 ) then
+            print(" ")
+            print("Maximum of height 'max_z' should be at least 1")
+            print(" ")
+            exit
+         end if 
+         max_z=stringtointeger(parameter(35))
+      end if
+   else
+      if (max_z .GE. max(z_pr) ) then
+         print(" ")
+         print("Maximum of height ('max_z'="+max_z+") is greater than available heights (="+max(z_pr)+")")
+         print(" ")
+         exit
+      end if
+      if (max_z .LE. 0 ) then
+         print(" ")
+         print("Maximum of height 'max_z' should be at least 1")
+         print(" ")
+         exit
+      end if
+   end if
+
+   ; ***************************************************
+   ; read data and create plots
+   ; ***************************************************
+      
+   do ti = start_time_step, end_time_step
+      if( t_all(ti) .lt. 10^36) then
+         start_time_step = ti
+         break
+      end if
+   end do  
+   
+   if (combine .EQ. 1) then
+      data_o=new((/m,end_time_step,dimz/),float)
+      data_o!0 = "e"
+      legend_label_oplot=new(m*(nt-1),string)
+      mini=new(m,float)
+      maxi=new(m,float)
+      e=-1
+   end if  
+    
+   do varn = 0, dim-1   
+     
+      if ( isStrSubset( vNam(varn), "NORM") .or. isStrSubset( vNam(varn), "time") )
+         check = False
+      else
+         if (.not. isvar("var")) then
+            check = True
+            if (parameter(21) .NE. "variables") then
+               var=parameter(21)
+               check = isStrSubset( var,vNam(varn)+"," )
+            end if
+         else          
+            check = isStrSubset( var,vNam(varn)+"," )
+         end if
+      end if
+     
+      if (combine .EQ. 1) then
+         if (c_var .EQ. " ") then
+            print(" ")
+            print("Please indicate the variables you would like to combine ('c_var')")
+            print(" ")
+            exit
+         end if               
+         com=isStrSubset(c_var,vNam(varn)+",")      
+         if (com) then
+            e=e+1
+            check = False
+            temp = f->$vNam(varn)$            
+            data_o!1 = temp!0
+            data_o!2 = temp!1           
+            data_o(e,:,:) = temp(start_time_step:end_time_step,:)
+            mini(e) = min(data_o(e,:,:)) 
+            maxi(e) = max(data_o(e,:,:))
+            
+            do j=e,e
+               do p=start_time_step,end_time_step
+                  legend_label_oplot(e*end_time_step+p-start_time_step)=" "+flt2string(doubletofloat(t_all(p)))+" "+vNam(varn)
+               end do
+            end do
+           
+            delete(temp)
+            varn = varn + 1
+    
+         end if        
+      end if  
+ 
+      if(check) then
+
+         temp = f->$vNam(varn)$      
+         data = temp(start_time_step:end_time_step,:)      
+         print("         plot of " + vNam(varn))
+         data!1 = "z"
+  
+         res@gsnLeftString      = "PROFILE plot of"
+         res@gsnRightString     = vNam(varn)
+         res@txFontHeightF      = 0.02
+         res@tiXAxisFontHeightF = 0.02
+         res@tiYAxisFontHeightF = 0.02
+         res@tiXAxisString      = " "    
+         res@tiYAxisString      = "Height [z]"
+         res@trXMinF            = min(data(:,:))
+         res@trXMaxF            = max(data(:,:))
+         res@trYMinF            = min_z
+         res@trYMaxF            = max_z    
+        
+         plot(n) = gsn_csm_xy(wks,data,z_pr,res)  
+      
+         delete(temp)
+         delete(data)
+         n = n + 1 
+         varn = varn + 1
+       
+      end if      
+
+   end do
+
+   if (combine .EQ. 1) then
+      data_all=new((/m*end_time_step,dimz/),float)
+      do j=0,e
+         data_all(start_time_step-1+j*end_time_step:(j+1)*end_time_step-1,:) = data_o(j,:,:)
+      end do  
+
+      ores@gsnLeftString      = "combined PROFILE plot of" 
+      ores@gsnRightString     = c_var
+      ores@txFontHeightF      = 0.02
+      ores@tiXAxisFontHeightF = 0.02
+      ores@tiYAxisFontHeightF = 0.02
+      ores@tiXAxisString      = " "    
+      ores@tiYAxisString      = "Height [z]"
+      ores@trXMinF            = min(mini(:))
+      ores@trXMaxF            = max(maxi(:))
+      ores@trYMinF            = min_z
+      ores@trYMaxF            = max_z   
+      ores@xyExplicitLegendLabels  = legend_label_oplot
+
+      print(" ")
+      print("combined plot of " + c_var) 
+ 
+      plot(0) = gsn_csm_xy(wks,data_all,z_pr,ores) 
+      
+   end if
+
+   ; ***************************************************
+   ; merge plots onto one page 
+   ; ***************************************************
+  
+   do i = 0, n-1, no_lines*no_columns 
+      if( (i+no_lines*no_columns) .gt. (n-1)) then
+        gsn_panel(wks,plot(i:n-1),(/no_lines,no_columns/),resP)
+      else
+        gsn_panel(wks,plot(i:i+no_lines*no_columns-1),(/no_lines,no_columns/),resP)
+      end if
+   end do
+
+   print(" ")
+   print("Output to: " + file_out +"."+ format_out)
+   print(" ")
+
+end
Index: palm/trunk/SCRIPTS/NCL/timeseries.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/timeseries.ncl	(revision 154)
+++ palm/trunk/SCRIPTS/NCL/timeseries.ncl	(revision 154)
@@ -0,0 +1,252 @@
+load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
+load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
+
+begin
+ 
+   ; ***************************************************
+   ; read parameter_list
+   ; ***************************************************
+   
+   if (isfilepresent("~/.ncl_preferences")) then
+      parameter = asciiread("~/.ncl_preferences",63,"string")
+      delete(parameter@_FillValue)
+   else
+      print(" ")
+      print("Please copy '.ncl_preferences' into your $home dircetory")
+      print(" ")
+      exit
+   end if
+
+   ; ***************************************************
+   ; set up default parameter values and strings if not assigned in prompt or parameter list
+   ; ***************************************************
+   
+   if ( .not. isvar("file_in") ) then     		; path+name of input file      
+      if (parameter(7) .EQ. "input file") then
+         print(" ")
+         print("Please provide input file 'file_in = ' either in prompt or parameter_list")
+         print(" ")
+         exit
+      else
+         file_in = parameter(7)
+      end if      
+   end if
+   if ( .not. isvar("format_out") ) then   		; format of output file 
+      format_out = "x11"
+      if (parameter(9) .NE. "x11") then
+         format_out = parameter(9)  
+      end if 
+   end if
+   if ( .not. isvar("file_out") ) then    	 	; path+name of output file
+      file_out = "test"
+      if (parameter(11) .NE. "test") then
+         file_out = parameter(11)  
+      end if     
+   end if
+   if ( .not. isvar("no_columns") ) then    		; number of plots in one row
+      no_columns = 1
+      if (parameter(17) .NE. "1") then
+         no_columns = stringtointeger(parameter(17))  
+      end if
+   end if
+   if ( .not. isvar("no_lines") ) then     		; number of plot-lines on one sheet
+      no_lines = 2
+      if (parameter(19) .NE. "2") then
+         no_lines = stringtointeger(parameter(19))  
+      end if
+   end if  
+   if ( .not. isvar("var") ) then   			; variable name
+      check = True
+   end if 
+  
+   ; ***************************************************
+   ; open input file
+   ; ***************************************************
+
+   f  = addfile(file_in , "r" )
+
+   vNam  = getfilevarnames(f) 
+   print(" ")
+   print("Variable on netCDF file: " + vNam)
+   print(" ")
+   dim   = dimsizes(vNam)
+   t_all = f->time
+   nt    = dimsizes(t_all)
+
+   ; ****************************************************	
+   ; 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) .LE. "1") then
+         if (parameter(13) .EQ. "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(13))
+            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  
+
+   t = f->time(start_time_step:end_time_step)
+
+  
+   ; ***************************************************
+   ; set up recourses
+   ; ***************************************************
+
+   res                         = True
+   res@gsnDraw                 = False
+   res@gsnFrame                = False
+   res@gsnPaperOrientation     = "portrait"
+   res@gsnPaperWidth           = 8.27
+   res@gsnPaperHeight          = 11.69
+   res@gsnPaperMargin          = 0.79
+   res@tmXBMode                = True
+   res@tmYLMode                = True
+   res@txFont                  = "helvetica"
+   res@tiMainFont              = "helvetica"
+   res@tiXAxisFont             = "helvetica"
+   res@tiYAxisFont             = "helvetica"
+   res@tmXBLabelFont           = "helvetica"
+   res@tmYLLabelFont           = "helvetica"  
+   res@xyLineColors            = (/237/)
+   resP                        = True
+   resP@txFont                 = "helvetica"
+   resP@txString               = f@title+" time series "
+   resP@txFuncCode             = "~" 
+   resP@txFontHeightF          = 0.015
+
+   res@vpWidthF=4
+
+
+   ; ***************************************************
+   ; read data and create plots
+   ; ***************************************************
+   
+   wks_ps = gsn_open_wks(format_out,file_out)		
+   gsn_define_colormap(wks_ps,"rainbow+white") 
+   plot_ps=new(dim,graphic)                            	 
+   n=0 
+ 
+   do varn = 0, dim-1  
+      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( isStrSubset (vNam(varn), "time") )
+         check = False
+      end if
+  
+      if(check) then
+ 
+         n=n+1
+         data = f ->$vNam(varn)$          
+         print("plot of " + vNam(varn))
+
+         res@gsnRightString       = vNam(varn)
+         res@tiXAxisString        = " time [s] "
+         res@tiXAxisFontHeightF   = 0.07
+         res@txFontHeightF        = 0.07
+         res@tiYAxisFontHeightF   = 0.07
+      
+         plot_ps(n) = gsn_csm_xy(wks_ps,t,data(start_time_step:end_time_step),res)
+   
+      end if
+ 
+   end do
+
+   ; ***************************************************
+   ; merge plots onto one page 
+   ; ***************************************************
+
+   do np = 1,n,no_lines*no_columns
+    
+      if ( np + no_lines*no_columns .gt. n) then   
+         gsn_panel(wks_ps, plot_ps(np:n),(/no_lines,no_columns/),resP)
+      else
+         gsn_panel(wks_ps, plot_ps(np:np+no_lines*no_columns-1),(/no_lines,no_columns/),resP)
+      end if
+     
+   end do
+
+   print(" ")
+   print("Output to: " + file_out +"."+ format_out)
+   print(" ")
+ 
+end
