NCL won't work when calling from script

From: Walter Hannah <whannah_at_nyahnyahspammersnyahnyah>
Date: Mon Apr 09 2012 - 10:19:04 MDT

I have a script that can be run from the terminal with no problems.
However, when I try to run the NCL script from a bash shell script like
this:

    #! /bin/bash

    ncl '~/analysis/plot.3D.ts.basic.ncl'

I get this set of errors:

      Copyright (C) 1995-2009 - All Rights Reserved
      University Corporation for Atmospheric Research
      NCAR Command Language Version 5.1.1
      The use of this software is governed by a License Agreement.
      Seehttp://www.ncl.ucar.edu/for more details.
    fatal:syntax error: line 3629 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    documentWorkstationClass
             cairo = create res_file documentWorkstationClass
    -------------------------------------------------------^

    fatal:syntax error: line 3630 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkFileName
               "wkFileName"
    ---------------------^

    fatal:error in statement
    fatal:syntax error: line 3631 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkFormat
               "wkFormat"
    -------------------^

    fatal:error in statement
    fatal:syntax error: line 3632 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkPDFResolution
               "wkPDFResolution"
    --------------------------^

    fatal:error in statement
    fatal:syntax error: line 3633 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkPaperSize
               "wkPaperSize"
    ----------------------^

    fatal:error in statement
    fatal:syntax error: line 3634 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkPaperWidthF
               "wkPaperWidthF"
    ------------------------^

    fatal:error in statement
    fatal:syntax error: line 3635 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkPaperHeightF
               "wkPaperHeightF"
    -------------------------^

    fatal:error in statement
    fatal:syntax error: line 3636 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near create
             end create
    -----------------^

    fatal:error in statement
    fatal:Syntax Error in block, block not executed
    fatal:error at line 3670 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl

    fatal:syntax error: line 3691 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    xwdimageWorkstationClass
           image = create res_file xwdimageWorkstationClass
    -----------------------------------------------------^

    fatal:syntax error: line 3692 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkImageFileName
             "wkImageFileName"
    ------------------------^

    fatal:error in statement
    fatal:syntax error: line 3693 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkImageFormat
             "wkImageFormat"
    ----------------------^

    fatal:error in statement
    fatal:syntax error: line 3694 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkColorMap
             "wkColorMap"
    -------------------^

    fatal:error in statement
    fatal:syntax error: line 3695 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkWidth
             "wkWidth"
    ----------------^

    fatal:error in statement
    fatal:syntax error: line 3696 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkHeight
             "wkHeight"
    -----------------^

    fatal:error in statement
    fatal:syntax error: line 3697 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near create
           end create
    ---------------^

    fatal:error in statement
    fatal:syntax error: line 3699 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    xwdimageWorkstationClass
           image = create res_file xwdimageWorkstationClass
    -----------------------------------------------------^

    fatal:syntax error: line 3700 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkImageFileName
             "wkImageFileName"
    ------------------------^

    fatal:error in statement
    fatal:syntax error: line 3701 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkImageFormat
             "wkImageFormat"
    ----------------------^

    fatal:error in statement
    fatal:syntax error: line 3702 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkWidth
             "wkWidth"
    ----------------^

    fatal:error in statement
    fatal:syntax error: line 3703 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near
    "wkHeight
             "wkHeight"
    -----------------^

    fatal:error in statement
    fatal:syntax error: line 3704 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl before or near create
           end create
    ---------------^

    fatal:error in statement
    fatal:Syntax Error in block, block not executed
    fatal:error at line 3708 in file
    $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl

I looked at the the lines specified in the error messages but they look
very foreign to me. So why is calling NCL from a bash shell script
different from calling ncl from the terminal with a bash shell?

Thanks,
Walter

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Apr 9 10:19:16 2012

This archive was generated by hypermail 2.1.8 : Mon Apr 09 2012 - 13:43:03 MDT