Dear Mark,
if you have defined the infile variable in the csh script, e.g.
set infile = "inputfile.nc"
then you can call ncl within the csh script using the variable like this
ncl 'infile="'$infile'"' ncl_script.ncl
The ncl script should contain a check if the variable exists, e.g.
.....
if(.not. isvar("infile") .or. infile .eq. "") then
print("ERROR: no input file given")
exit
else
print("NCL script - input file: "+infile)
end if
f = addfile(infile,"r") ;-- open file
....
Bye,
Karin
Am 01.02.14 15:07, schrieb Mark Chan:
> Dear NCL users
> I could run NCL like this:
> ncl 'infile="wrfout_d01_1994-01-11_00:00:00.nc"' my_script.ncl
> And I want to use it in a c-shell script
> for example:
> set inf=wrfout_d01_1994-01-11_00:00:00.nc
> then using $inf to represent the input file
> I try as the below, but it doesn't work.
> ncl 'infile= $inf ' my_script.ncl
> Can one helps?
> ---my_script.ncl like this:---------
> ; a = addfile("wrfout_d01_1994-01-11_00:00:00.nc","r")
> a = addfile(infile,"r") ; Here "infile" is a variable from the
> C-shell script
> Thanks a lot in advance!
> Mark
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- Dipl. Geophys. Karin Meier-Fleischer Application Support, Visualization Deutsches Klimarechenzentrum GmbH E-Mail: meier-fleischer@dkrz.de Bundesstrasse 45a Internet: http://www.dkrz.de/ 20146 Hamburg Phone: +49 (0)40 460094 126 Germany Fax: +49 (0)40 460094 270 Geschäftsführer: Prof. Dr. Thomas Ludwig Sitz der Gesellschaft: Hamburg Amtsgericht Hamburg HRB 39784
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Feb 1 08:51:37 2014
This archive was generated by hypermail 2.1.8 : Fri Feb 07 2014 - 16:39:11 MST