`;--------------------------------WRFOUT D01
a = addfile(".nc","r")
u = wrf_user_getvar(a,"ua",-1)
v = wrf_user_getvar(a,"va",-1)
p = wrf_user_getvar(a,"pressure",-1) ;
z = wrf_user_getvar(a,"height",-1)
qvapor = wrf_user_getvar(a,"QVAPOR",-1) ; Qv
qv = qvapor*1000.
qv@units = "g/kg"
g = 9.80665 ; m/s2
g@units = "m/s2"
u_500 = wrf_user_intrp3d(u,p,"h",500.,0.,False)
v_500 = wrf_user_intrp3d(v,p,"h",500.,0.,False)
qv_500 = wrf_user_intrp3d(qv,p,"h",500.,0.,False)
spd = (u_500*u_500 + v_500*v_500)^(0.5)
spd@description = "Wind Speed"
spd@units = "m/s"
;单层水汽通量 flux = 比湿(g/kg)*风V(m/s)/g(m/s2)
flux_5 = qv_500*spd/g ;g*(s-1*hPa-1*cm-1)
flux_500 = flux_5*10 ;10-1*g*(s-1*hPa-1*cm-1)
avg_flux_500 =dim_avg_n_Wrap(flux_500,0)
avg_u =dim_avg_n(u_500,0)
avg_v =dim_avg_n(v_500,0)
copy_VarCoords(qv_500(0,:,:),avg_flux_500
copy_VarCoords(u_500(0,:,:),avg_u)
copy_VarCoords(v_500(0,:,:),avg_v)
delete([/flux_5,flux_500,spd,qv_500,u_500,v_500/])
;--------------换经纬度
lat2d = a->XLAT(0,:,:)
lon2d = a->XLONG(0,:,:)
lat1d = lat2d(:,0)
lon1d = lon2d(0,:)
grid_flux_500 = rcm2rgrid_Wrap(lat2d,lon2d,avg_flux_500,lat1d,lon1d,0)
grid_u = rcm2rgrid_Wrap(lat2d,lon2d,avg_u,lat1d,lon1d,0)
grid_v = rcm2rgrid_Wrap(lat2d,lon2d,avg_v,lat1d,lon1d,0)
delete([/avg_flux_500,avg_u,avg_v/])`
标签:WRF,wrf,通量,qv,------------,flux,user,avg,500
From: https://www.cnblogs.com/PREjelly/p/17917598.html