FUNCTION sign2d, x ; return the sign of an array sz=size(x,/dim) sgn=intarr(sz[0],sz[1]) ss=where(x gt 0, count) if count gt 0 then sgn[ss]=1 ss=where(x lt 0, count) if count gt 0 then sgn[ss]=-1 return,sgn END