Index: palm/trunk/SCRIPTS/nc2vdf
===================================================================
--- palm/trunk/SCRIPTS/nc2vdf	(revision 1059)
+++ palm/trunk/SCRIPTS/nc2vdf	(revision 1062)
@@ -15,4 +15,5 @@
     check_muk=false
     check_hlrn=false
+    check_workstation=false
     sys="unknown"
 
@@ -40,4 +41,9 @@
        check_hlrn=true
     fi
+#    if [ $(expr "$HOSTNAME" : "") -eq 1 ] ### insert $HOSTNAME of your workstation here if you are not running vapor on one of the systems above
+#    then
+#       check_workstation=true
+#    fi
+
 
 
@@ -55,9 +61,14 @@
        module load ncl
     fi
+    
+    if [ $check_workstation == "true" ]
+    then
+       sys="workstation"
+    fi
 
     if [ $sys == "unknown" ]
     then
-       echo "+++ unknown system. Exiting..."
-       exit 0
+       echo "+++ unknown system."
+       #exit 0
     else
        echo "*** nc2vdf will execute at $sys"
Index: palm/trunk/SCRIPTS/nc2vdf.ncl
===================================================================
--- palm/trunk/SCRIPTS/nc2vdf.ncl	(revision 1059)
+++ palm/trunk/SCRIPTS/nc2vdf.ncl	(revision 1062)
@@ -18,4 +18,9 @@
 ; Current revisions:
 ; -----------------
+; full batch mode support, loading configuration from an external file
+; fallback to interactive mode if no configuration present
+; batch mode does not support loading more than one variable per file if there
+; is more than one file specified (but there is a workaround)
+; you cannot add time steps to a variable from an additional file in batch mode
 ;
 ; Former revisions:
@@ -40,12 +45,21 @@
 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
 
-outputfile = "default.vdf"
+alt_varnames = False
+man = True
+path = ""
 
 if(isfilepresent(inputfile)) then
    print("*** Loading " + inputfile)
    loadscript(inputfile)
+   man = False
 else
-   print("+++ Input file does not exist. Exiting...")
-   exit
+    print("+++ Input file does not exist.")
+    man_resp = systemfunc("read -p 'Enter manual mode? (y/n) ' RESP; echo $RESP")
+    if (man_resp .eq. "y") then
+       man = True
+    else
+       print("+++ Exiting...")
+       exit
+    end if
 end if
 
@@ -53,4 +67,5 @@
 begin
 
+if (.not. man) then
 ;   print loaded data from input file
     print("*** loading " + dimsizes(files) + ":")
@@ -60,12 +75,56 @@
 
     print("*** will create dataset " + outputfile)
-
-
-    workpath = systemfunc("echo $PWD") + "/"
-    path     = ""
-
-
-; hannes stuff below ;-)
-
+end if
+
+;******************************************************
+;give path to the directory where NetCDF files are stored:
+    print("*** Checking hostname...")
+    sys        = "unknown"
+    query      = systemfunc("echo $HOSTNAME")
+    check_muk  = isStrSubset(query,"muk.uni-hannover.de") 
+    check_hice = isStrSubset(query,"hicegate2") 
+    check_bice = isStrSubset(query,"bicegate2")
+    check_huv  = isStrSubset(query,"huv")
+    check_buv  = isStrSubset(query,"buv")
+    check_WS   = isStrSubset(query,"kookaburra") ;*** insert name of your workstation here
+
+
+
+    if ( check_muk .eq. True ) then
+       print("*** nc2vdf will execute at IMUK")
+       sys  = "IMUK"
+    else
+       if ( check_hice .eq. True .or. check_bice .eq. True ) then
+          print("*** nc2vdf will execute on hicegate2/bicegate2")
+          sys = "HLRN"
+       else
+          if ( check_huv .eq. True .or. check_buv .eq. True ) then
+             print("*** nc2vdf will execute on UV")
+             sys = "HLRN"
+             else
+                if ( check_WS .eq. True) then
+                print("*** nc2vdf will execute on a workstation PC/Mac")
+                sys = "workstation"
+                path     = "/Applications/VAPOR.app/Contents/MacOS/" ;*** costomize path for WS
+          end if
+          end if
+       end if
+    end if
+    if ( sys .eq. "unknown" ) then
+       print("+++ unknown system. Exiting...")
+       exit
+    end if
+
+    
+workpath = systemfunc("echo $PWD") + "/"
+
+
+;******************************************************
+;******************************************************
+if man then
+;specify name of output file:
+outputfile	= "building.vdf" ;<<<<------------- !!!
+end if
+;******************************************************
 ;******************************************************
 
@@ -86,24 +145,25 @@
 
 
-;print("You may need to run 'vapor-setup.sh' in order to set all enviroment variables.")
-;/muksoft/packages/vapor/2.1.0/bin/vapor-setup.sh
-
-
-;**** Get names of variables wanted to appear in the VDF file, then get their dimensions with min/max x,y,z
-print(" ")
-print("Choose the *.nc files containing 3D data by typing their indices (seperated by ','). Start with the first files of the timeseries.")
-print(" ")
-files_avail   = systemfunc("cd "+workpath+"; ls *.nc")
-print(" "+files_avail)
-
-
-files_in_ary  = toint(str_split(systemfunc("read file; echo $file"), ","))
-nofiles       = dimsizes(files_in_ary)
-file_in       = new(nofiles,string)
-
-do i=0,nofiles-1
-    file_in(i)    = files_avail(files_in_ary(i))
-end do
-
+
+if man then
+    ;**** Get names of variables wanted to appear in the VDF file, then get their dimensions with min/max x,y,z
+    print(" ")
+    print("Choose the *.nc files containing 3D data by typing their indices (seperated by ','). Start with the first files of the timeseries.")
+    print(" ")
+    files_avail   = systemfunc("cd "+workpath+"; ls *.nc")
+    print(" "+files_avail)
+
+
+    files_in_ary  = toint(str_split(systemfunc("read file; echo $file"), ","))
+    nofiles       = dimsizes(files_in_ary)
+    file_in       = new(nofiles,string)
+
+    do i=0,nofiles-1
+        file_in(i)    = files_avail(files_in_ary(i))
+    end do
+else
+    file_in = files
+    nofiles = dimsizes(file_in)
+end if
 
 
@@ -113,5 +173,7 @@
 if (nofiles .ge. 2) then
 nvars   = 1
+if man then
 varString  = new((/nofiles,nvars/),string)
+end if; man
 dimNames   = new((/nofiles,nvars,4/),string)
 end if
@@ -119,10 +181,11 @@
 
 do i=0,nofiles-1
+    print("Loading file...")
     f             = addfile(workpath+file_in(i),"r")
 
     varNames      = getfilevarnames(f)
-    print("Loading file...")
     
-   
+    
+    if man then
     print(" ")
     print("The following variables were found in "+file_in(i)+":")
@@ -136,7 +199,10 @@
 
     nvars = dimsizes(vars)
-
+    end if; man
+    
     if (nofiles .eq. 1) then
+    if man then
     varString  = new((/nofiles,nvars/),string)
+    end if; man
     dimNames   = new((/nofiles,nvars,4/),string)
     end if
@@ -145,11 +211,16 @@
 
     do n=0,nvars-1
-
+       if man then
        varString(i,n) = varNames(vars(n))
+       end if; man
+       
+       if alt_varnames then
+            varString(i,n) = varNames(vars(i,n))
+       end if
        
        if (vars3d .ne. "") then
-       vars3d       = vars3d + ":" + varNames(vars(n))
+       vars3d       = vars3d + ":" + varString(i,n)
        else
-       vars3d       = varNames(vars(n))
+       vars3d       = varString(i,n)
        end if
 
@@ -164,5 +235,5 @@
        z     	= f->$dimNames(i,n,1)$
        y     	= f->$dimNames(i,n,2)$
-       x	= f->$dimNames(i,n,3)$
+       x	    = f->$dimNames(i,n,3)$
 
        if (z_min .ge. min(z)) then
@@ -197,12 +268,21 @@
 end do
 
-print(varString)
-
+;print(varString)
+
+if man then
 delete(files_avail)
-
-
-print(" ")
-periodic              = systemfunc("read -p 'Periodic lateral boundaries? (y/n) ' RESP; echo $RESP")
-if (periodic .eq. "y") then
+end if
+
+if man then
+    print(" ")
+    periodic_resp              = systemfunc("read -p 'Periodic lateral boundaries? (y/n) ' RESP; echo $RESP")
+    if (periodic_resp .eq. "y") then
+        periodic = True
+    else
+        periodic = False
+    end if
+end if
+
+if (periodic) then
    px		= 1
    py		= 1
@@ -214,8 +294,18 @@
 print(" ")
 
-grid              = systemfunc("read -p 'Is grid stretching used? (y/n) YES will cut of heights above dz_stretch_level? ' RESP; echo $RESP")
-if (grid .eq. "y") then
-   stretch_level    = stringtointeger(systemfunc("read -p 'Please type height of dz_stretch_level (in meters) ' RESP; echo $RESP"))
-   z_max = stretch_level ;**** limit z_max
+if man then
+    grid_resp              = systemfunc("read -p 'Is grid stretching used? (y/n) YES will cut of heights above dz_stretch_level? ' RESP; echo $RESP")
+    if (grid_resp .eq. "y") then
+        grid_stretch = True
+    else
+        grid_stretch = False
+    end if
+end if
+
+if (grid_stretch) then
+    if man then
+       stretch_level    = stringtointeger(systemfunc("read -p 'Please type height of dz_stretch_level (in meters) ' RESP; echo $RESP"))
+    end if; man
+    z_max = stretch_level ;**** limit z_max
 end if
 
@@ -238,4 +328,5 @@
 end if
 
+if man then
 print(" ")
 
@@ -250,15 +341,32 @@
    t_end	= stringtointeger(systemfunc("read -p 'Type index of last time step: ' ts; echo $ts"))
 end if
-
-print(" ")
-askreflevel              = systemfunc("read -p 'Specify a maximum refinement level? (y/n) No will set the default value.  ' RESP; echo $RESP")
-if (askreflevel .eq. "y") then
-   reflevel    = systemfunc("read -p 'Please type maximum refinement level ' RESP; echo $RESP")
-   reflevel_str = "-level "+ reflevel
+end if
+
+if (.not. man) then
+    if (.not. spec_ts) then
+           t_start 	= 0
+           t_end	= dimsizes(time)-1
+    end if
+end if
+
+if man then
+    print(" ")
+    askreflevel              = systemfunc("read -p 'Specify a maximum refinement level? (y/n) No will set the default value.  ' RESP; echo $RESP")
+    if (askreflevel .eq. "y") then
+       reflevel    = systemfunc("read -p 'Please type maximum refinement level ' RESP; echo $RESP")
+       reflevel_str = "-level "+ reflevel
+    else
+       reflevel_str = ""
+    end if
+    print(" ")
 else
-   reflevel_str = ""
-end if
-print(" ")
-
+    if spec_reflevel then
+        reflevel_str = "-level "+ reflevel
+    else
+       reflevel_str = ""
+    end if
+end if
+
+        
 
 ;*******************************************************************************
@@ -313,5 +421,5 @@
 
 ;*******************************************************************************
-
+if man then
 ;**** Read more files and add them to VDF/VDC
 addmore = "y"
@@ -448,5 +556,5 @@
    addmore       = systemfunc("read -p 'Add additional *.nc files? (y/n) ' RESP; echo $RESP")
 end do
-
+end if; man
 ;*******************************************************************************
 print("Done.")
