-
Christoph Fischer authoredChristoph Fischer authored
util.py 538 B
# calc dt and dt^2 (first and second derivative)
def calc_adv(cv, u, v):
dxcv = cv.differentiate(coord='lon') # optional: add edge_order=2. default is 1.
dycv = cv.differentiate(coord='lat') # optional: add edge_order=2. default is 1.
adv = -( u *dxcv) - ( v *dycv) # adv = u*d/dx(cv) + v*d/dy(cv)
dxadv = adv.differentiate(coord='lon')
dyadv = adv.differentiate(coord='lat')
advadv = ( u *dxadv) + ( v *dyadv) # to constrain adv to locations where there is a local min.
return (adv, advadv)