Index: palm/trunk/SCRIPTS/NCL/crosssections.ncl
===================================================================
--- palm/trunk/SCRIPTS/NCL/crosssections.ncl	(revision 127)
+++ palm/trunk/SCRIPTS/NCL/crosssections.ncl	(revision 127)
@@ -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$
+
+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 127)
+++ palm/trunk/SCRIPTS/NCL/crosssections.usage.txt	(revision 127)
@@ -0,0 +1,58 @@
+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 127)
+++ palm/trunk/SCRIPTS/NCL/crosssections_new.ncl	(revision 127)
@@ -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$
+
+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 127)
+++ palm/trunk/SCRIPTS/NCL/crosssections_new.usage.txt	(revision 127)
@@ -0,0 +1,65 @@
+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 127)
+++ palm/trunk/SCRIPTS/NCL/plotts.ncl	(revision 127)
@@ -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$
+
+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/mrun
===================================================================
--- palm/trunk/SCRIPTS/mrun	(revision 126)
+++ palm/trunk/SCRIPTS/mrun	(revision 127)
@@ -263,5 +263,5 @@
     # EXPORTIERT WERDEN
  export  afname config_file cpp_opts cpumax do_batch do_trace fname fromhost
- export  input_list memory numprocs output_list queue run_mode
+ export  group_number input_list memory numprocs output_list queue run_mode
 
 
@@ -826,4 +826,5 @@
        # IN DER KONFIGURAIONSDATEI ANGEGEBENEN WERTE UEBERSTEUERN
     mrun_memory=$memory
+    mrun_group_number=$group_number
     mrun_cpumax=$cpumax
     mrun_numprocs=$numprocs
@@ -847,4 +848,5 @@
        # OPTIONSWERTE UEBERSTEUERN KONFIGURATIONSDATEI
     [[ $mrun_memory     != 0  ]]  &&  memory=$mrun_memory
+    [[ "$mrun_group_number" != "none" ]]  &&  group_number=$mrun_group_number
     [[ $mrun_cpumax     != 0  ]]  &&  cpumax=$mrun_cpumax
     [[ "$mrun_numprocs" != "" ]]  &&  numprocs=$mrun_numprocs
@@ -2798,6 +2800,6 @@
                 mpirun  -np $numprocs  a.out  $ROPTS
              else
-		 (( mem_tsubame = 31.0 / $tasks_per_node ))
-		 echo "Memory for Tsubame in GB:", $mem_tsubame
+		 (( mem_tsubame = $memory / 1024.0 ))
+		 echo "Memory for Tsubame for each process in GB:", $mem_tsubame
 #                n1ge  -fore  -g 1S060156  -mpi $numprocs  -mem 4  -N palm  -q $queue  a.out  $ROPTS
                /n1ge/TITECH_GRID/tools/bin/n1ge -fore -g $group_number -mpi ${numprocs}:$tasks_per_node -mem $mem_tsubame -N palm -rt $minuten -q $queue  a.out  $ROPTS
@@ -3588,5 +3590,5 @@
     [[ $return_password != "" ]]  &&  mrun_com=${mrun_com}" -P $return_password"
     [[ $delete_temporary_catalog = false ]]  &&  mrun_com=${mrun_com}" -B"
-    [[ $node_usage != default  &&  $node_usage != sla3 ]]  &&  mrun_com=${mrun_com}" -n $node_usage"
+    [[ $node_usage != default  &&  "$(echo $node_usage | cut -c1-3)" != "sla"  &&  $node_usage != novice ]]  &&  mrun_com=${mrun_com}" -n $node_usage"
     [[ $run_coupled_model = true ]]  &&  mrun_com=${mrun_com}" -Y"
     if [[ $do_remote = true ]]
