Re: 'getenv' behavior in NCL not as advertised...

From: Gary Strand (strandwg@XXXXXX)
Date: Fri Feb 23 2001 - 11:00:16 MST


>> However, if I do a getenv on an undefined environment variable, I get a
>> fatal error:
>> fatal:getenv : (NDAYS) is not a defined environment parameter

> Has anybody contacted you with regard to this problem yet?

You're the first - thanks for the prompt reply.

> I think "getenv" is behaving as it should, in the sense that it returns a
> variable that is set to "missing". The "fatal" error message is kind
> of misleading, because it doesn't actually cause the program to
> stop. (At least it didn't in the small test case I tried it on.)

Upon further review, you're correct.

The context is that I'm trying to write an NCL script that could be used to
look at a variable number of files, ie, plot the time series of the same
field from 1, 2, 3, or 4 files, the file names being passed in via environ-
ment variables. Is there an easy way to check the status of a getenv, so
that if it "fails", as above, I don't try to access the field from that file,
which does result in a truly fatal error?

Thanks!

--
Gary Strand               Climate Change Research Section, NCAR (303) 497-1336
strandwg AT ucar.edu                         http://www.cgd.ucar.edu/ccr/strandwg



This archive was generated by hypermail 2b29 : Tue Feb 19 2002 - 09:06:05 MST