function xyz2ned,param,loc if n_elements(loc) eq 3 then begin loc=xyz2latlon(loc) loc=loc[0:1] endif if n_elements(loc) eq 2 then begin T=dblarr(3,3) T[0,0]=-sin(loc[0])*cos(loc[1]) T[0,1]=-sin(loc[0])*sin(loc[1]) T[0,2]=cos(loc[0]) T[1,0]=-sin(loc[1]) T[1,1]=cos(loc[1]) T[1,2]=0 T[2,0]=-cos(loc[0])*cos(loc[1]) T[2,1]=-cos(loc[0])*sin(loc[1]) T[2,2]=-sin(loc[0]) T=invert(T,/double) dim=size(param) if (dim[0] eq 1) and (dim[1] eq 3) then begin output=T##param endif else begin if (dim[0] eq 2) and (dim[1] eq 3) and (dim[2] eq 3) then begin output=T##param##transpose(T) endif else output=0 endelse endif else output=0 return,output end