[ncl-talk] wrfout file reading

Anil Kumar - NOAA Affiliate anil.kumar at noaa.gov
Fri Dec 4 07:27:36 MST 2020


Hi,
I am trying to read multiple wrfout files. I am reading okay..no problem
with the code extracting variables.
Problem comes, when each file has multiple times in it and then I don't
know how to extract the time series of variables .
Below is the code, please let me know how to modify code to read many times
within each file.
************************
fs1 = systemfunc("ls ../WRFV3/run/wrfout_d01*")
 nfs1= dimsizes(fs1)
 f1 = addfiles(fs1+".nc","r")
  ntimes1 =  dimsizes(f1)         ; number of times in the file(s)

loc1 = wrf_user_ij_to_ll(f1, 593., 546., True)
 print("lon/lat locations are: " + loc)
uu1      = new((/ntimes1/),float)
vv1      = new((/ntimes1/),float)
psfc1      = new((/ntimes1/),float)
i1=0
do while (i1.le.ntimes1-1)
uu1(i1)    = f1[i1]->U(:,0,546,593)   ; (time, lat,lon)    ; (2,64,128)
vv1(i1)    = f1[i1]->V(:,0,546,593)        ; V10(:,29.301,-94.797)
psfc1(i1)  = f1[i1]->PSFC(:,546,593)
i1 = i1 + 1
end do
   model_wspd1 = sqrt(uu1^2+vv1^2) ;wind_speed(uu,vv)
   model_wdir1 = wind_direction(uu1,vv1,0)
   model_psfc1 = psfc1/100.
************************
-- 
Dr. Anil Kumar
Environmental Modeling Center/NCEP/NWS/NOAA
College Park, MD, USA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201204/3deb1c85/attachment.html>


More information about the ncl-talk mailing list