[ncl-talk] Failing to open WRF file

Rick Brownrigg brownrig at ucar.edu
Fri Aug 6 10:53:03 MDT 2021


As you said, T looks just fine, and these statements work just fine:

     lat2d = a->XLAT
     lat2d := wrf_user_getvar(a,"XLAT",-1)

A corrupted file *might* tell us something, although if it's corrupt,
there's not much that can be done about it.

Rick

On Fri, Aug 6, 2021 at 10:20 AM Zilore Mumba <zmumba at gmail.com> wrote:

> In case this may be of help, a file which is not corrupt is attached.
> print(T) or printVarSummary(T) print the values and the summary ok.
>
> On Fri, Aug 6, 2021 at 4:16 PM Rick Brownrigg <brownrig at ucar.edu> wrote:
>
>> Hi Zilore,
>>
>> 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.
>>
>> Rick
>>
>> On Fri, Aug 6, 2021 at 2:57 AM Zilore Mumba via ncl-talk <
>> ncl-talk at mailman.ucar.edu> wrote:
>>
>>> Hello,
>>> I need help opening a WRF output file. The code I am using is below
>>> ;Open input file.
>>>       ;************************
>>>         DATADir = "../DATA/"
>>>         FILES = systemfunc (" ls -1 " + DATADir + "wrfout_d01* ")
>>>         numFILES = dimsizes(FILES)
>>>         ;print(FILES)
>>>         ;exit
>>>
>>>         ;a = addfiles(FILES+".nc","r")
>>>
>>>         a = addfiles( DATADir+"wrfout_d01_2021-08-03_00:00:00.nc","r")
>>>
>>>         T = wrf_user_getvar(a,"T2",-1)
>>>         T = T-273.15
>>>         wrf_smooth_2d(T, 3)             ; smooth T
>>>         ;printVarSummary(T)
>>>         ;exit
>>>
>>>         lat2d    = a->XLAT(:,:)
>>>         lon2d    = a->XLONG(:,:)
>>>
>>>         lat2d     = lat2d(:,0)           ; create classic 1D coordinate
>>> arrays
>>>         lon2d     = lon2d(0,:)
>>>
>>>         lat at units= "degrees_north"
>>>         lon at units= "degrees_east"
>>>         lat!0    = "lat"
>>>         lon!0    = "lon"
>>>         lat&lat  =  lat
>>>         lon&lon  =  lon
>>>
>>>         printVarSummary(lat)
>>>         printVarSummary(lon)
>>>         exit
>>> When I try to open one file, I get the error
>>>
>>> fatal:(a) not reference to a valid file
>>> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 21 in
>>> file 20_PlotT2mMinMax.ncl
>>> ******************************
>>> 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.
>>> warning:_NclOpenFile: cannot open file <../DATA/wrfout_d01_2021-08-03_00:
>>> 00.nc>; No such file or directory
>>>
>>> warning:isfilevar: undefined file returning missing value
>>> fatal:The result of the conditional expression yields a missing value.
>>> NCL can not determine branch, see ismissing function
>>> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 108 in
>>> file /usr/local/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl
>>>
>>> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 1986 in
>>> file /usr/local/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl
>>>
>>> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 15 in
>>> file 20_PlotT2mMinMax.ncl
>>>
>>> Print(FILES) works ok
>>> printVarSummary(T) works ok
>>> printVarSummary(lat) and printVarSummary(lon) do not work.
>>>
>>> How do I extract XLAT, XLONG?
>>> Help will be appreciated.
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at mailman.ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210806/a8cfe948/attachment.html>


More information about the ncl-talk mailing list