pro mk_starid,ra,dec,starid ; This routine makes a byte array starid(21,nstar) with standard-form ; star ID derived from the arrays ra(nstar) and dec(nstar). ; On input, ra is in decimal hours and dec in decimal degrees ; Form is 'KpJHHMMSS.ss+DDMMSS.s', as an obvious extension of SDSS names. ; On input, ra in in decimal hours and dec is in decimal degrees. ; constants nb=21 s0='KpJ' nstar=n_elements(ra) if(nstar eq 1) then begin ra=[ra] dec=[dec] endif ; make output array starid=bytarr(nb,nstar) ; make needed integer arrays hh=fix(ra) rr=ra-hh rmm=fix(60.*rr) rr=rr-rmm/60. rss=fix(rr*3600.) rr=rr-rss/3600. rhss=fix(rr*360000.) adec=abs(dec) dd=fix(adec) rr=adec-dd mm=fix(rr*60.) rr=rr-mm/60. ss=fix(rr*3600.) rr=rr-ss/3600. dss=fix(rr*36000.) sgn=strarr(nstar) s=where(dec ge 0.,ns) if(ns gt 0) then sgn(s)='+' s=where(dec lt 0.,ns) if(ns gt 0) then sgn(s)='-' f1='(i1)' f2='(i2)' for i=0,nstar-1 do begin s1=string(hh(i),format=f2)+string(rmm(i),format=f2)+string(rss(i),\$ format=f2)+'.'+string(rhss(i),format=f2) s2=sgn(i)+string(dd(i),format=f2)+string(mm(i),format=f2)+\$ string(ss(i),format=f2)+'.'+string(dss(i),format=f1) strid=s0+s1+s2 starid(*,i)=byte(strid) endfor s=where(starid eq 32,ns) if(ns gt 0) then starid(s)=48 end