[ncl-install] Pb calling scripts
Rick Grubin
grubin at ucar.edu
Thu May 15 09:09:47 MDT 2008
Hi Gilles
> I have installed the last version of not OPeNDAP-enabled NCL
> binaries (NCL 5.0.0 32-bit binary for i686 chips for LINUX,
> compiled with gcc 3.x) on my Linux box and everything seems to work
> fine except that I can't run scripts.
The idiom for running scripts with NCL is to run them from the
command line, as:
% ncl myScript.ncl
or
% ncl myScript
Strictly speaking, the ".ncl" tag is not necessary, but is commonly
used to identify a file as containing NCL commands
> Here is the error message, essai.ncl being a script that I have no
> trouble running line by line:
>
> ncl 0> ncl essai
> fatal:syntax error: line 0 before or near essai
> ncl essai
> --------^
>
> fatal:error in statement
>
> What did I do wrong?
Given that your script executes as desired when run line by line, try
running it as described above, rather than from
within NCL, as you are doing. Attempting to run your script from
within NCL is not correct, as NCL is looking for
commands, just like the ones in your script. The name of your script
is not a command, thus the interpeter tells you
that's incorrect (command 'essai' is not part of the known syntax of
commands).
If you want to make NCL aware of a functions or procedcures you've
written in NCL, you can "load" that file within NCL:
ncl 0> load "myScript.ncl"
See: http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/
NclStatements.shtml
Here's the relevant portion:
The load command is used to load external scripts from files. These
external scripts can either be sets of functions and procedures or
actual NCL programs. Currently, file_path must be a constant value;
string expressions will generate syntax error messages. You can think
of the load command as being analogous to the C #include statement.
The load command executes immediately when it is encountered. It
cannot be executed conditionally. The following is an example:
load "file_path"
In order to conditionally load a script or use a string variable to
reference a file path see the loadscript procedure.
(I just noticed that Mary also answered this question, but I'll send
this anyway)
----
Rick Grubin NCAR/TDD/CISL/VETS
Visualization + Enabling Technologies
grubin at ucar.edu 303.497.1832
More information about the ncl-install
mailing list