[ncl-talk] Segmentation fault with addfiles and addfile

Gus Correa gus at ldeo.columbia.edu
Tue Aug 27 13:55:56 MDT 2019


Hi Jenney

1) Maybe a missing trailing "/" in the "dir" variable?
This would make the file names wrong, and could explain the error message
Error: "warning:_NclOpenFile: Can not open file <filename> file format not
supported or file is corrupted"

2) Have you tried to add
print(files)
after
files=systemfunc(...)
to check what is in the "files" variable, just to see if it is really what
you want?
Once you know the "files" variable is correct, you can comment out that
"print".

I hope this helps,
Gus Correa

On Tue, Aug 27, 2019 at 2:43 PM Jenney,Andrea via ncl-talk <
ncl-talk at ucar.edu> wrote:

> All,
>
> I’m getting a segmentation fault error when using addfile and addfiles to
> read in netcdf files. Each single file is a monthly mean (only one time
> step) of many variables that are resolved in space. I’ve uploaded an
> example file to the link, (file is called "
> spcesm_cam5_control.cam.h0.1910-05.nc"):
> http://saddleback.atmos.colostate.edu/rr/docexch.php. Running
> ncl_filedump and ncl_convert2nc on the files works fine and everything
> looks great. The non-ncl ncview and ncdump also show that things look
> normal to me. My files are smaller than 400 MB each, all variables are 3D
> or smaller, and the largest dimension is length 144.
>
> Relevant code:
> (when using addfiles)
>
> fnameIn = dir + "spcesm_cam5_*.h0.*.nc"
> files = systemfunc("ls "+fnameIn)
> f     = addfiles(files, "r") ; <- Error: "warning:_NclOpenFile: Can not
> open file <filename> file format not supported or file is corrupted"
>
>
> (when using addfile)
> fnameIn = dir + "spcesm_cam5_*.h0.*.nc"
> files = systemfunc("ls "+fnameIn)
> nf    = dimsizes(files)
> do ifile = 0,nf-1
> f = addfile(files(ifile), "r") ; <- Error: "Segmentation fault"
>> end do
>
> Thanks in advance for your help
> ---
> Andrea Jenney
> PhD Candidate | Randall & Barnes Groups
> Colorado State University | Dept. of Atmospheric Science
>
> _______________________________________________
> 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/20190827/3248ed37/attachment.html>


More information about the ncl-talk mailing list