Dear NCL users,
The NCL Development Team is considering introducing command line options
and arguments into NCL. The Team would appreciate user input before any
decisions are made.
If you would find this functionality useful, please let us know how
you would use it. Specific examples are welcome.
Below are two possible methods for implementing command line options
and arguments. Would either, or both, meet your needs? Other ideas
are welcome.
1. Command line arguments are user defined, and consist of [name=value] pairs
Example arguments and usage:
mask=5
smooth=True
ncl mask=5 smooth=True myScript.ncl
Within an NCL script, the method for retrieval of specified information
from the command line might look something like:
begin
mask_val = get_ARGS("mask")
make_smooth = get_ARGS("smooth")
...
end
A function like "get_ARGS()" is currently a placeholder function, to
illustrate how accessing command line arguments might occur.
2. Command line options are pre-defined, and may take one of two forms:
options with single dashes, or options with double dashes.
Single dash:
-option=value pairs, or simply -option
Example options and usage:
-f myData.nc
-v T
-r
ncl -f myData.nc -v T -r myScript.ncl
Double dash:
--option=value pairs, or simply --option
Example options and usage:
--file=myData.nc
--variable=T
--version
ncl --file=myData.nc --variable=T --version myScript.ncl
For information provided via command line options, NCL code might look
something like:
begin
datafile = get_ARGS("file") ; -f myData.nc or --file=myData.nc
g = addfile(datafile, "r")
tvar = get_ARGS("variable") ; -v T or --variable=T
var_to_plot = g->$tvar$
...
end
Please note that the NCL script name to execute (if one is provided) is
always the last argument on the command line, regardless of the method chosen
for command line arguments/options. As well, the name of the NCL script
to execute would be available to the user within that script.
Thank you for your input!
The NCL Development Team
_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Fri Feb 20 2004 - 08:24:38 MST