[ncl-talk] how plot temperature profile for four time step in wrf out file

sdafis sdafis at noa.gr
Sat Dec 15 04:17:16 MST 2018


Dear Elham, I am giving you a simple code to read and plot a time series
for T2m and 10-m wind speed  for two locations defined by "locs",
"lats", "lons". You can add more locations if you like or choose a
sub-period by defining "it". 

a = addfile("wrf_file.nc","r")  

; Get variables for 10-m wind 

uvmet = wrf_user_getvar(a, "_uvmet10_", -1) 

u = uvmet(0,:,:,:) 
v = uvmet(1,:,:,:)  

; Get Temp at 2m in Kelvin

 tc2 = WRF_USER_GETVAR(a,"T2",-1)  

it = 0 ; first time step, ignore it if you want a time-series 

locs = (/ "1st Location", "2nd Location" /)  ; define the locations  

lats = (/ 37.5938, 40.6401 /) 
lons = (/ 23.4375, 22.9444/) 

nlocs = dimsizes(locs) 
loc = wrf_user_ll_to_ij(a, lons, lats, True)  ; find the indices of the
closest WRF grid points to locations 

do iloc = 0, nlocs-1

print("Working for " + locs(iloc)) 

locX = loc(0, iloc) - 1
locY = loc(1, iloc) - 1 

wind= sqrt(u(:, locY, locX)*u(:, locY, locX) + v(:, locY, locX)*v(:,
locY, locX)) ; replace ":" with "it" if you want one time-step only 

temp = tc2(:, locY, locX)   ; if you want only one time step: temp =
tc2(it, locY, locX) 

print( ""+wind+"   "+temp+"") 

end do 

regards, 

-- 

Stavros NTAFIS (DAFIS)
-----------------------------------------------
Physicist - Meteorologist, M.Sc.
Ph.D. Candidate, Polytechnic School of Paris, France
Laboratory of Dynamic Meteorology (LMD)
Research Associate, National Observatory of Athens (NOA/IERSD)
ORCID: https://orcid.org/0000-0002-1513-1930
Tel. : (+33)1 69 33 51 64
(+33)9 81 94 22 12
Mobile: (+33) 066 030 0147
(+30) 697 04 20 242
---------------
Weather charts:
http://www.meteo.gr
http://www.meteo.gr/meteomaps/ 

Στις 2018-12-15 11:54, E Mobarak έγραψε:

> Hi dear ncl usr 
> I want plot some data for example temperature or wind speed in some time step from wrf out data file in one location 
> how i should it? 
> Best Regarads 
> Elham 
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181215/7d2c0426/attachment.html>


More information about the ncl-talk mailing list