;+ ; NAME: ; oc_convertid_pos_2mass ; ; PURPOSE: (one line) ; Convert from a position into its 2MASS ID. ; ; DESCRIPTION: ; 2MASS stars are intended to be identified by a standard ID; e.g., ; 01500687+7211468 (Jhhmmssss+-ddmmsss[ABC]). This routine converts ; from a position, into an ID. This routine is not used by any of the oc_* ; routines, but could be a useful utility. ; ; Note that some 2MASS stars are named in unpredictable ways. For instance, ; ; HBT_ID 2MASS ID Dec ; 23571523+0022164 23571523+0022165 0_22_16.500 ; ^^^ ; dec_s = 16.499971 -- this is rounded up to 16.5 . About 1 in 100 stars are ; rounded up. ; ; But yet: ; ; 23571456+0038153 23571455+0038152 0_38_15.299 ; ^^^ ; dec_s = 15.298829 -- this is rounded down to 15.2. 99 in 100 stars are ; rounded down (i.e., truncated). ; ; ; CATEGORY: ; Occultation ; ; CALLING SEQUENCE: ; result = oc_convertid_pos_2mass( ra, dec ) ; ; INPUTS: ; RA -- Array of RA's. Radians. ; Dec -- Array of Dec's. Radians. ; ; OPTIONAL INPUT PARAMETERS: ; None ; ; KEYWORD INPUT PARAMETERS: ; /VERBOSE -- Print error messages to screen for incorrect ID's. ; /ROUND -- Round RA/DEC instead of truncate. 56.88 -> 56.9. ; /TRUNC -- Truncate RA/DEC. 56.88 -> 56.8. Usually correct. ; ; KEYWORD OUTPUT PARAMETERS: ; None ; ; OUTPUTS: ; Returns a list of ID's constructed from the RA and DEC given. ; These may not be actual stars in the catalog, but their ID's will ; be in the proper format. ; ; COMMON BLOCKS: ; ; SIDE EFFECTS: ; None ; ; RESTRICTIONS: ; None. Does not require access to 2MASS catalog. ; ; EXAMPLE: ; print, oc_convertid_pos_2mass( [343.2, 15d]*d2r, [-15,30]*d2r) ; ; MODIFICATION HISTORY: ; Created 24-May-2006 by Henry Throop, SwRI. Based on convertid_ucac2.pro. ;- function oc_convertid_pos_2mass, RA, DEC, ROUND=round, TRUNC=trunc EMPTY = -999d if not(keyword_set(ROUND)) and not(keyword_set(TRUNC)) then TRUNC=1 num = sizex(ra) ids_out = strarr(num) for i = 0, num-1 do begin ; Check to make sure it's not EMPTY -- if so, act accordingly if (ra[i] eq EMPTY) or (dec[i] eq EMPTY) then begin id = '' end $ else begin radtohms, ra[i], ra_h, ra_m, ra_s radtodms, dec[i], dec_sign, dec_d, dec_m, dec_s if keyword_set(TRUNC) then ra_s = ip(ra_s*100)/100d id1 = string(ra_h, ra_m, ra_s, format = '(I2, I2, F5.2)') id1 = str_replace(id1, ' ', '0', /all) id1 = str_replace(id1, '.', '', /all) if (dec_sign eq -1d) then dec_sign = '-' $ else if (dec_sign eq 1d) then dec_sign = '+' if keyword_set(TRUNC) then dec_s = ip(dec_s*10)/10d id2 = string(dec_sign, dec_d, dec_m, dec_s, $ format = '(A1, I2, I2, F4.1)') id2 = str_replace(id2, ' ', '0', /all) id2 = str_replace(id2, '.', '', /all) id = id1 + id2 end ids_out[i] = id end return, ids_out end ;;;;;;;;;; pro other ra = 50*d2r dec = -79*d2r colors radius = 0.1*d2r ids = oc_search_pos_single_2mass(ra, dec, radius, nstar) stars = oc_getstar_2mass(ids) ids2 = oc_convertid_pos_2mass(stars.ra, stars.dec) stop end