[ncl-talk] Failing to open WRF file

Zilore Mumba zmumba at gmail.com
Fri Aug 6 02:57:06 MDT 2021


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210806/1fa18a7d/attachment.html>


More information about the ncl-talk mailing list