[ncl-talk] How to Make NCL throw an error?
Mary Haley
haley at ucar.edu
Mon Jul 27 15:45:10 MDT 2015
Hi Walter,
Sorry if somebody already responded to this.
In general, NCL is supposed to give you a line number where it fails.
Can you be more specific about what the error message is? Perhaps there's
a way we can improve it.
There is one particular warning that shows up now and then, that I find
frustrating because it doesn't give you a line number:
Argument N of the current function or procedure was coerced to the
appropriate
type and thus will not change if the function or procedure modifies
its value
In this case, I will comment out the "begin" and "end" statements, if any,
and rerun the script with "ncl -x". This causes every line to be echoed to
standard out as you execute it, and hence you can see where the warning
occurs.
--Mary
On Tue, Jul 14, 2015 at 9:35 AM, Walter Hannah <walter at hannahlab.org> wrote:
> I write a lot of my own custom functions in NCL. I always put in various
> checks that will print an error message and exit. But when I encounter
> this, I never know which line is causing the problem.
>
> For example, I might have a block of code like:
>
> ...
> 09
> 10 y = some_function (x)
> 11
>
> 12 a = some_function (b)
> 13
> ...
>
>
> and when I run the script I get something like:
>
> ERROR: "some_function" doesn't like your input!
>
>
> But I would like more information, like a typical NCL error message:
>
> fatal:Execute: Error occurred at or near line 3 in file ...
>
>
> So, how can I get NCL to throw an error that will mention the line where
> the function was called?
>
> Thanks,
> Walter
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150727/329cc127/attachment.html
More information about the ncl-talk
mailing list