[ncl-talk] wrfout file reading

Dennis Shea shea at ucar.edu
Fri Dec 4 12:24:52 MST 2020


f1 = addfiles(fs1+".nc","r")    ; f1 is a variable of type 'list'
u10 = f1[:]->U10                    ; [:] extract and concatenate 'u10'
from all files
printVarSummary(u10)

On Fri, Dec 4, 2020 at 11:06 AM Anil Kumar - NOAA Affiliate via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Yes, Hourly wrf outputs.
>
> and yes when I extract times using *wrf_user_list_times*(f1) that works
> fine but only times.
> but how to extract variables like U10 time series?
>
> Thanks,
> Anil
>
>
>
> On Fri, Dec 4, 2020 at 12:42 PM Ehsan Taghizadeh <
> ehsantaghizadeh at yahoo.com> wrote:
>
>> Dear Dr. Anil
>> Are 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 <https://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml>(times)         ; number of times in the file(s)
>> end do
>>
>> *Sincerely*
>> *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 Kumar
>> Environmental 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
>>
>
>
> --
> Dr. Anil Kumar
> Environmental 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/092c2c30/attachment.html>


More information about the ncl-talk mailing list