load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" begin ; Make a list of all files we are interested in DATADir = "/media/mughal/Seagate/ECMWF_WRF_RUNS2" cmd = "find " + DATADir + "/run* -type d -print" dirWRF = systemfunc (cmd) print(dirWRF) n_dirWRF = dimsizes(dirWRF) do n=0,n_dirWRF- 1 ; loop over directories f = addfiles(dirWRF(n) +"wrfout_d04*nc", "r") end do times = wrf_user_list_times(f) ntimes = dimsizes(times) lat = f[0]->XLAT(0,:,:) lon = f[0]->XLONG(0,:,:) do it = 0,ntimes-1,1 ; TIME LOOP ; print("Working on time: " + it + ") = " + times(it)) u = wrf_user_getvar(f,"ua",it) ; u averaged to mass points v = wrf_user_getvar(f,"va",it) ; v averaged to mass points ; printVarSummary(u) ; printMinMax(u,0) ; printMinMax(v,0) loc = wrf_user_ll_to_ij(f,36.85693,2.53115,True) mx = loc(0) - 1 ny = loc(1) - 1 lat1 = lat(ny,mx) ; the is the nearest grid point lon1 = lon(ny,mx) ; print("lat1/lon1 = " + lat1 + "/" + lon1) res = True res@tiMainString = "WRF: All Times: grid point ["+sprintf("%5.2f",lat1)+" , "+sprintf("%5.2f",lon1) +"]" wspd1= ndtooned( sqrt(u(5,ny,mx)^2 + v(5,ny,mx)^2) ) print("Working on time: " + times(it) + " wind_speed="+wspd1) end do end