<div dir="ltr"><div>Hi Jenney</div><div><br></div><div>1) Maybe a missing trailing "/" in the "dir" variable? <br></div><div>This would make the file names wrong, and could explain the error message <br></div><div>Error: "warning:_NclOpenFile: Can not open file <filename> file format not supported or file is corrupted"</div><div><br></div><div>2) Have you tried to add <br></div><div>print(files) <br></div><div>after <br></div><div>files=systemfunc(...) <br></div><div>to check what is in the "files" variable, just to see if it is really what you want?</div><div>Once you know the "files" variable is correct, you can comment out that "print".<br></div><div><br></div><div>I hope this helps,</div><div>Gus Correa</div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 27, 2019 at 2:43 PM Jenney,Andrea via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="overflow-wrap: break-word;">
All,
<div><br>
</div>
<div>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 "<a href="http://spcesm_cam5_control.cam.h0.1910-05.nc" target="_blank">spcesm_cam5_control.cam.h0.1910-05.nc</a>"): <a href="http://saddleback.atmos.colostate.edu/rr/docexch.php" target="_blank">http://saddleback.atmos.colostate.edu/rr/docexch.php</a>. 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. </div>
<div><br>
</div>
<div>Relevant code:</div>
<div>(when using addfiles)</div>
<div><br>
</div>
<div><font face="Menlo">fnameIn = dir + "spcesm_cam5_*.h0.*.nc"</font></div>
<div><font face="Menlo">files = systemfunc("ls "+fnameIn)<br>
f = addfiles(files, "r") ; </font><- Error: "warning:_NclOpenFile: Can not open file <filename> file format not supported or file is corrupted"</div>
<font face="Menlo"><br>
</font>
<div><br>
</div>
<div>(when using addfile)</div>
<div><span style="font-family:Menlo">fnameIn = dir + "spcesm_cam5_*.h0.*.nc"</span></div>
<div><font face="Menlo">files = systemfunc("ls "+fnameIn)</font></div>
<div><font face="Menlo">nf = dimsizes(files)</font></div>
<div><font face="Menlo">do ifile = 0,nf-1</font></div>
<div><font face="Menlo"><span class="gmail-m_-5462253519111698960Apple-tab-span" style="white-space:pre-wrap"></span>f = addfile(files(ifile), "r") ; </font><- Error: "Segmentation fault"</div>
<div><font face="Menlo"><span class="gmail-m_-5462253519111698960Apple-tab-span" style="white-space:pre-wrap"></span>…</font></div>
<div><font face="Menlo">end do</font></div>
<div><br>
<div>Thanks in advance for your help</div>
</div>
<div>
<div dir="auto" style="overflow-wrap: break-word;">
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">
---<br>
Andrea Jenney<br>
PhD Candidate | Randall & Barnes Groups<br>
Colorado State University | Dept. of Atmospheric Science </div>
</div>
</div>
<br>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div></div>