;+
; Project     : SOHO - CDS     
;                   
; Name        : CDSXY2LR()
;               
; Purpose     : Calculates CDS OPS values for given solar (X,Y) position.
;               
; Explanation : Wrapper for the GET_OPS_POS routine.
;               
; Use         : IDL> print,cdsxy2lr(xpos,ypos)
;    
; Inputs      : xpos - solar_X value in arcsecs from sun centre.
;               ypos - solar_Y value in arcsecs from sun centre.
;
;                      Both may be either scalar or arrays.
;               
; Opt. Inputs : None
;               
; Outputs     : Function returns OPSL/R values in an array (n,2) where
;               n is the number of input positions.  If n=1 then a simple
;               2-element array is returned.
;               
; Opt. Outputs: None
;               
; Keywords    : None
;
; Calls       : GET_OPS_POS
;
; Common      : None
;               
; Restrictions: None
;               
; Side effects: None
;               
; Category    : Operations
;               
; Prev. Hist. : None
;
; Written     : C D Pike, RAL, 28-Jun-96
;               
; Modified    : 
;
; Version     : Version 1, 28-Jun-96
;-          
  
function cdsxy2lr,x,y

;
;  on line help
;
if n_params() eq 0 then begin
   print,'Use:   IDL> print,cdsxy2lr(x,y)
   print,' '
   return,[0,0]
endif

;
;  assess input
;
nx = n_elements(x)
ny = n_elements(y)
if nx ne ny then begin
   print,'X & Y must have same dimensions.'
   return,[0,0]
endif

;
;  cycle through inputs
;
l = intarr(nx)
r = intarr(ny)
for i=0,nx-1 do begin
   get_ops_pos,x(i),y(i),ll,rr
   l(i) = ll
   r(i) = rr
endfor

return,reform([[l],[r]])

end
