- 积分
- 1385
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-4-10
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2020-10-11 16:48:55
|
显示全部楼层
fu = addfile("/home/wangfeiha/data/uwnd.mon.mean.nc","r")
fv = addfile("/home/wangfeiha/data/vwnd.mon.mean.nc","r")
fq = addfile("/home/wangfeiha/data/shum.mon.mean.nc","r")
fp = addfile("/home/wangfeiha/data/pres.mon.mean.nc", "r")
time = fu->time
YYYYMM=cd_calendar(time, -1)
it_s=196101
it_e=201912
rec_s=ind(it_s.eq.YYYYMM)
rec_e=ind(it_e.eq.YYYYMM)
u = fu->uwnd(rec_s:rec_e,0:7,:,:);m/s
v = fv->vwnd(rec_s:rec_e,0:7,:,:)
q = fq->shum(rec_s:rec_e,:,:,:) ;g/kg
ps= fp->pres(rec_s:rec_e,:,:)
p = fq->level
ptop = 300
g = 9.80665 ; m/s2
ptop = ptop*100
ptop@units = "Pa"
plev = q&level ; hPa
plev = plev*100 ; [100000,...,30000] Pa [kg/(m-s2)]
plev@units = "Pa"
;---Change [kg/kg] to [g/kg]; not necessary: but common units for q
q = q*1000
q@units = "g/kg"
;---Divergence function [used later] requires S->N grid order
u = u(:,:,::-1,:)
v = v(:,:,::-1,:)
q = q(:,:,::-1,:)
ps =ps(:, ::-1,:)
;---Layer thickness: ; Pa=>[kg/(m-s2)], (time,level,lat,lon)
;---Mass weighting: (dp/g) => [Pa/(m/s2)] => (Pa-s2)/m => [kg/(m-s2)][s2/m] => (kg/m2)
;---Reference: http://www.cgd.ucar.edu/cas/catalog/newbudgets/
dp = dpres_plevel_Wrap(plev, ps, ptop, 0) ; Pa; layar thickness
dpg = dp/g
dpg@long_name = "Layer Mass Weighting"
dpg@units = "kg/m2" ; dp/g, Pa/(m s-2), reduce to kg m-2
;---Moisture flux components at each pressure level
uq = u*q ; (:,:,:,:)
uq@long_name = "Zonal Moisture Flux [uq]"
uq@units = "["+u@units+"]["+q@units+"]" ; [m/s][g/kg]
copy_VarCoords(u,uq) ; (time,level,lat,lon)
vq = v*q ; (:,:,:,:)
vq@long_name = "Meridional Moisture Flux [vq]"
vq@units = "["+v@units+"]["+q@units+"]"
copy_VarCoords(v,vq) ; (time,level,lat,lon)
;---Divergence of moisture flux: uv2dvF => global 'fixed' rectilinear grid
duvq = uv2dvF_Wrap(uq, vq) ; (time,level,lat,lon)
duvq@long_name = "Divergence of Moisture Flux"
duvq@units = "g/(kg-s)" ; (1/m)*[(m/s)(g/kg)] => [g/(kg-s)]
;---Integrated mass weighted moisture flux components
uq_dpg = uq*dpg ; mass weighted 'uq'; [m/s][g/kg][kg/m2]=>[m/s][g/kg]
iuq = dim_sum_n(uq_dpg, 1)
iuq@long_name = "Integrated Zonal UQ [uq*dpg]"
iuq@LONG_NAME = "Sum: Mass Weighted Integrated Zonal Moisture Flux [uq*dpg]"
iuq@units = "[m/s][g/kg]"
copy_VarCoords(u(:,0,:,:), iuq); (time,lat,lon)
delete(uq_dpg)
vq_dpg = vq*dpg ; mass weighted 'vq'; [m/s][g/kg][kg/m2]=>[m/s][g/kg]
ivq = dim_sum_n(vq_dpg, 1)
ivq@long_name = "Integrated Meridional VQ [vq*dpg]"
ivq@LONG_NAME = "Sum: Mass Weighted Integrated Meridional Moisture Flux [vq*dpg]"
ivq@units = "[m/s][g/kg]"
copy_VarCoords(v(:,0,:,:), ivq); (time,lat,lon)
delete(vq_dpg)
;---Mass weighted integration [sum] of the divergence of moisture flux
duvq_dpg = duvq*dpg ; [g/(kg-s)][kg/m2] => [g/(m2-s)]
iduvq = dim_sum_n(duvq_dpg, 1)
iduvq@long_name = "Integrated Mass Wgt MFC"
iduvq@LONG_NAME = "Integrated Mass Weighted Moisture Flux Convergence"
iduvq@units = "g/(m2-s)"
copy_VarCoords(u(:,0,:,:), iduvq) ; (time,lat,lon)
delete(duvq_dpg)
VIMFC = iduvq ; keep meta data
VIMFC = -VIMFC ; Note the preceding -1 [negative precedes integration]
VIMFC@long_name = "VIMFC"
ncdf = addfile("/home/wangfeiha/data/new/integrated_vapor_flux_1961-2019.nc","c") |
|