When used in conjunction with an NCL script, command line arguments can set a variable’s value, help determine initial conditions, and so forth:
% cat modelRun.ncl
begin
[...]
if (.not. isvar("nyrStrt")) then ; is nyrStrt on command line?
nyrSrt = 1960
end if
if (.not. isvar("nyrLast")) then ; is nyrLast on command line?
nyrLast = 2002;
end if
print(nyrStrt) ; for illustrative purposes
print(nyrLast)
[...]
end
(Variables nyrStrt and nyrLast are set on the command line)
% ncl nyrStrt=1900 nyrLast=1968 modelRun.ncl
Variable: nyrStrt
Type: integer
Total Size: 4 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) 1900
Variable: nyrStrt
Type: integer
Total Size: 4 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) 1968
Consider the following
ncl nyrStrt=1930 'fName="Model*"' gravity=9.8 opt=True cyclic=False latS=-30 latN=30 lonL=130 lonR=290 modelRun.ncl
When the number of CLOs is large, it might be clearer to enter only one or two per line. The Unix line continuation character, </b>, can be used to accomplish this:
ncl nyrStrt=1930 \
'fName="Model*"' \
gravity=9.8 \
latS=-30 latN=30 \
lonL=130 lonR=290 \
modelRun.ncl