<div dir="ltr"><div>I'm not sure what to advise. There's nothing wrong with the statement "a->XLAT(:,:)". The code is complaining about the file-variable "a".  Prior to line #21 is this statement: "T = wrf_user_getvar(a,"T2",-1)"  which references filevar a.  I take it there are no errors from that line, and if you were to print(T) everything looks OK?  If so, does  lat2d = wrf_get_var(a, "XLAT", -1) work?</div><div><br></div><div>Wish I could be of more help...</div><div>Rick<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 6, 2021 at 9:04 AM Zilore Mumba <<a href="mailto:zmumba@gmail.com" target="_blank">zmumba@gmail.com</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"><div>Rick, I have 24 files, hourly for one day. Apparently every day there are two or three files which are current out of the WRF output. nco shows the same corrupt files. ncdump on the corrupt files gives a number of major and minor errors.</div><div><br></div><div>HDF5-DIAG: Error detected in HDF5 (1.10.4) thread 140519944219520:<br>  #000: H5G.c line 470 in H5Gopen2(): unable to open group<br>    major: Symbol table<br>    minor: Can't open object<br>  #001: H5Gint.c line 323 in H5G__open_name(): can't get object type<br>    major: Symbol table<br>    minor: Can't get value<br> .........................................................</div><div><br></div><div>When I run my script with the two corrupt files removed I get </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><br></div><div>and line 21 in my script is lat2d    = a->XLAT(:,:)</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 6, 2021 at 4:16 PM Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@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"><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" target="_blank">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>
</blockquote></div>
</blockquote></div>