;+ ; NAME: ; oc_mkstar ; ; PURPOSE: ; Returns an array of star structures. ; ; DESCRIPTION: ; Construct an array of star structures from argumant lists ; ; CALLING SEQUENCE: ; star = oc_mkstar(ra, dec, nstar) ; ; INPUTS: ; ra - J2000 right ascension in radians (scalar or array) ; dec - J2000 declination in radians (scalar or array) ; ra and dec are the same length (nstar) ; KEYWORDS ; idcat - catalog for id. String or array of length nstar. Default 'none' ; id - id. String or array of length nstar. Default 'none' ; poscat - catalog for ra, dec, raerr, decerr, radot, decdot, ; radoterr, decdoterr. String or array of length nstar. ; Default 'none' ; raerr - error in ra * cos(dec). Radians. Scalar or array of ; length nstar. Default -999 ; decerr - error in dec. Radians. Scalar or array of ; length nstar. Default -999 ; radot - proper motion in ra*cos(dec), radian/s. Scalar or array ; of length nstar. Default -999 ; decdot - proper motion in dec, radian/s. Scalar or array ; of length nstar. Default -999 ; radoterr - error in radot. Radian/s. Scalar or array of length ; nstar. Default -999. ; decdoterr - error in decdot. Radian/s. Scalar or array of length ; nstar. Default -999. ; magcat - catalog for magname, mag, magerr. String. Scalar or array ; of length nmag. Default 'none' ; magname - name (eg filter) for mag, magerr. String. Array ; of length nmag. Default 'none' ; mag - magnitudes. Array of size [nstar, nmag]. Default -999. ; magerr - error in mag. Array of size [nstar, nmag]. Default -999. ; SpTcat - catalog for SpT. String or array of length ; nstar. Default 'non' ; SpT - spectral type. String or array of length nstar. Default '' ; notecat - catalogs for notes. String or array of length ; nstar. Default 'none' ; note - Notes. String or array of length ; nstar. Default '' ; mkstar - Structure or array of structures of length nstar. ; User-defined information ; OUTPUTS: ; nstar - number of stars in array ; star - returns an array of star structures, optionally ; with star.mkstar structures ; ; ; REVISON HISTORY: ; 2005 Dec 29 Leslie A Young, SwRI ;- function oc_mkstar_defarr, name, n, default, key=key, verbose=verbose, $ err=err, magprint=magprint COMPILE_OPT, HIDDEN if keyword_set(key) then begin case n_elements(key) of 1: key_ = replicate(key, n) n: key_ = key else: begin if keyword_set(verbose) then begin if not keyword_set(magprint) then begin print, 'oc_mkstar: '+name+$ ' must be same length as ra and dec' endif else begin print, 'oc_mkstar: '+name+$ ' must be same length as magname' endelse endif err = 1 end endcase endif else begin key_ = replicate(default, n) endelse return, key_ end function oc_mkstar, ra, dec, nstar, $ verbose=verbose, idcat=idcat, id=id, $ poscat=poscat, raerr=raerr, decerr=decerr, $ radot=radot, decdot=decdot, radoterr=radoterr,decdoterr=decdoterr,$ magcat=magcat, magname=magname,mag=mag,magerr=magerr,$ SpTcat=SpTcat, SpT=SpT, $ notecat=notecat, note=note,$ mkstar=mkstar nstar = 0 ; set it now to the value of return on error n = n_elements(ra) if n_elements(dec) ne n then begin if keyword_set(verbose) then begin print, 'oc_mkstar: ra and dec must be the same length' endif return, -1 end err = 0 ; ID keywords ------------------------------------- idcat_ = oc_mkstar_defarr('idcat', n, 'none', $ key=idcat, verbose=verbose, err=err) id_ = oc_mkstar_defarr('id', n, 'none', $ key=id, verbose=verbose, err=err) ; position keywords ------------------------------------- poscat_ = oc_mkstar_defarr('poscat', n, 'none', $ key=poscat, verbose=verbose, err=err) raerr_ = oc_mkstar_defarr('raerr', n, -999., $ key=raerr, verbose=verbose, err=err) decerr_ = oc_mkstar_defarr('decerr', n, -999., $ key=decerr, verbose=verbose, err=err) radot_ = oc_mkstar_defarr('radot', n, -999., $ key=radot, verbose=verbose, err=err) decdot_ = oc_mkstar_defarr('decdot', n, -999., $ key=decdot, verbose=verbose, err=err) radoterr_ = oc_mkstar_defarr('radoterr', n, -999., $ key=radoterr, verbose=verbose, err=err) decdoterr_ = oc_mkstar_defarr('decdoterr', n, -999., $ key=decdoterr, verbose=verbose, err=err) ; spectral type keywords ------------------------------------- SpTcat_ = oc_mkstar_defarr('SpTcat', n, 'none, $ key=SpTcat, verbose=verbose, err=err) SpT_ = oc_mkstar_defarr('SpT', n, '', $ key=SpT, verbose=verbose, err=err) ; magnitude keywords ------------------------------------- if keyword_set(magname) then m = n_elements(magname) magcat_ = oc_mkstar_defarr('magcat', m, 'none', $ key=magcat, verbose=verbose, err=err, /mag) if ; notes keywords ------------------------------------- notecat_ = oc_mkstar_defarr('notecat', n, 'none', $ key=notecat, verbose=verbose, err=err) note_ = oc_mkstar_defarr('note', n, '', $ key=note, verbose=verbose, err=err) end