[ncl-talk] Trapping warnings for corrupted files

Jennifer Krauel jkrauel at utk.edu
Thu Dec 12 13:11:59 MST 2019


I'm running a script that opens a NARR GRIB file, reads data, and writes a
.csv file. It seems to work fine if the data is valid, but sometimes the
GRIB file is bad. I would like to trap this and handle it gracefully but I
can't figure out how to do this. When I call addfile I get this warning:

warning:_NclOpenFile: Can not open file <NARR3D_201811_0103.subset>; file
format not supported or file is corrupted

Despite this warning, the function isfile returns true. Later when I try to
access a variable in the file I get these errors:

fatal:file (g3d) isn't defined

fatal:["Execute.c":8637]:Execute: Error occurred at or near line 35 in file
read3D.ncl

What I'd like to do is just quit the script if I get that initial warning.
What is the best way to handle this?

Thanks,

Jennifer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191212/c5fa9f24/attachment.html>


More information about the ncl-talk mailing list