[ncl-talk] wrfout file reading
Ehsan Taghizadeh
ehsantaghizadeh at yahoo.com
Fri Dec 4 10:42:27 MST 2020
Dear Dr. AnilAre your wrfout files hourly?However, why you don't use wrf_user_list_times to extract the list of available times?
fs1 = systemfunc("ls ../WRFV3/run/wrfout_d01*")
nfs1= dimsizes(fs1)do i = 0, nfs1-1
f1 = addfile(fs1(i)+".nc","r") times = wrf_user_list_times(f1) ; get times in the file ntimes = dimsizes(times) ; number of times in the file(s)
end doSincerely
Ehsan
On Friday, December 4, 2020, 05:57:54 PM GMT+3:30, Anil Kumar - NOAA Affiliate via ncl-talk <ncl-talk at mailman.ucar.edu> wrote:
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 KumarEnvironmental Modeling Center/NCEP/NWS/NOAA
College Park, MD, USA
_______________________________________________
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/20201204/fc1b9e52/attachment.html>
More information about the ncl-talk
mailing list