There's nothing built in to NCL but you could use the shell:
testfile = "test.grb"
t = systemfunc("sh -c 'if test -f " + testfile + "; then echo 1; else echo 0; fi'")
if (t .eq. 1) then
f = addfile ... etc.
Not very pretty, I guess, but I think it works.
On Fri, 11 Apr 2003, Matt Fearon wrote:
> dear ncl users:
> is there a way to test if a file exists and print that result? for example,
> if i have the following statements where "test.grb" doesn't exist
> with this, i receive a fatal error, but "f" still prints a missing value. is
> there a way to check if "test.grb" exists before i use addfile?
> suggestions are much appreciated.
> thank you,
> ncl-talk mailing list
> ncl-talk AT ucar.edu
ncl-talk mailing list
ncl-talk AT ucar.edu
This archive was generated by hypermail 2b29 : Fri Apr 11 2003 - 13:49:06 MDT