<div dir="ltr"><div>Hi Zilore,</div><div><br></div><div>I looked into the code at where that "not reference to a valid file" error originates. It would seem that the file is somehow corrupt, although I don't understand how or why. Are you able to open it with some other tool, such as "ncdump"?  Can you simply discard it from your analysis? If it's not too large and you can send it to me, I will take a look, although obviously that won't change the outcome if it is indeed corrupt.</div><div><br></div><div>Rick<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 6, 2021 at 2:57 AM Zilore Mumba via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.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 dir="ltr">Hello,<div>I need help opening a WRF output file. The code I am using is below</div><div>;Open input file.<br>      ;************************<br>        DATADir = "../DATA/"<br>        FILES = systemfunc (" ls -1 " + DATADir + "wrfout_d01* ")<br>        numFILES = dimsizes(FILES)<br>        ;print(FILES)<br>        ;exit<br><br>        ;a = addfiles(FILES+".nc","r")<br><br>        a = addfiles( DATADir+"wrfout_d01_2021-08-03_00:00:<a href="http://00.nc" target="_blank">00.nc</a>","r")<br><br>        T = wrf_user_getvar(a,"T2",-1)<br>        T = T-273.15<br>        wrf_smooth_2d(T, 3)             ; smooth T<br>        ;printVarSummary(T)<br>        ;exit<br><br>        lat2d    = a->XLAT(:,:)<br>        lon2d    = a->XLONG(:,:)<br><br>        lat2d     = lat2d(:,0)           ; create classic 1D coordinate arrays<br>        lon2d     = lon2d(0,:)<br><br>        lat@units= "degrees_north"<br>        lon@units= "degrees_east"<br>        lat!0    = "lat"<br>        lon!0    = "lon"<br>        lat&lat  =  lat<br>        lon&lon  =  lon<br><br>        printVarSummary(lat)<br>        printVarSummary(lon)<br>        exit<br></div><div>When I try to open one file, I get the error</div><div><br></div><div>fatal:(a) not reference to a valid file<br>fatal:["Execute.c":8637]:Execute: Error occurred at or near line 21 in file 20_PlotT2mMinMax.ncl<br></div><div>******************************</div><div>When I try to open many files with addfiles, there is one file which cannot be read, but the others are read and I get.</div><div>warning:_NclOpenFile: cannot open file <../DATA/wrfout_d01_2021-08-03_00:<a href="http://00.nc" target="_blank">00.nc</a>>; No such file or directory<br><br>warning:isfilevar: undefined file returning missing value<br>fatal:The result of the conditional expression yields a missing value. NCL can not determine branch, see ismissing function<br>fatal:["Execute.c":8637]:Execute: Error occurred at or near line 108 in file /usr/local/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl<br><br>fatal:["Execute.c":8637]:Execute: Error occurred at or near line 1986 in file /usr/local/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl<br><br>fatal:["Execute.c":8637]:Execute: Error occurred at or near line 15 in file 20_PlotT2mMinMax.ncl<br></div><div><br></div><div>Print(FILES) works ok</div><div>printVarSummary(T) works ok</div><div>printVarSummary(lat) and printVarSummary(lon) do not work.<br></div><div><br></div><div>How do I extract XLAT, XLONG?</div><div>Help will be appreciated.</div><div><br></div><div><br></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>