! modified for use of Seattle filenames

use acom3-cell-thickness.50s-20n.cdf ! from topog_acom3.1.dta.nc

use subdomain_notides-mean.50s-20n.cdf
use subdomain_notides-mean-w.50s-20n.cdf

! note that e435 (dhu/100 from original) is already on the (x,y) u grid
let delh = e435[d=acom3-cell-thickness.50s-20n,gz=v_30d[d=subdomain_notides-mean.50s-20n]@asn]

let u1 = missing(u_30d[d=subdomain_notides-mean.50s-20n]/100 , 0) ! convert to m/s
let v1 = missing(v_30d[d=subdomain_notides-mean.50s-20n]/100 , 0)

let ux = u1[x=@ddb]
let vy = v1[y=@ddb]

let uxbar = 0.5*(ux + ux[j=@shf:-1])
let vybar = 0.5*(vy + vy[i=@shf:-1])

let div = delh * (uxbar + vybar)
let vzint = div[k=1:36@rsum]
let vonw = vzint[gz=w_30d[d=subdomain_notides-mean-w.50s-20n]@asn]