; docformat = 'rst' ; ; NAME: ; IRASRW_GETCATALOG ; PURPOSE: ; Return the content of the Ryan & Woordward (2010) version of the ; IRAS/MSX catalog for a specific target or simply dump the catalog into a structure ; ;+ ; :Description: ; Return the content of the Ryan & Woordward (2010) version of the ; IRAS/MSX catalog for a specific target or simply dump the catalog into a structure ; ; :Categories: ; Database, Asteroid, Diameter, Albedo ; ; :Params: ; ID: in, required, type=integer/string ; Target identifyer ('*', Name, Provisional designation, Number) ; ; :Returns: A structure containing the desired content of the IRAS ; catalog, or an error code (-2 file not found, -1 target not found). ; Structure fields are:: ; .NUM: IAU number ; .DES: IAU official designation ; .NEATM:: ; .N: Number of solutions averaged ; .pV: Visible geometric albedo ; val: value ; unc: uncertainty ; .D: Diameter in km ; val: value ; unc: uncertainty ; .eta: Beaming parameter: ; val: value ; unc: uncertainty ; .STM:: ; .N: Number of solutions averaged ; .pV: Visible geometric albedo ; val: value ; unc: uncertainty ; .D: Diameter in km ; val: value ; unc: uncertainty ; .src: Source of the value ; ; :Keywords: ; IRAS: in, optional, type=string ; Path to the Ryan & Wooward (2010) IRAS catalog file ; CONFIG: in, optional, type=string ; Path to the configuration file for catalogs, at the ; minimum this file should contain the 2 following lines to be used ; by current routine:: ; [Tables from Literature] ; iras2010 = PATH_TO_YOUR_IRAS_R&W_FILE ; DUMP: in, optional, type=boolean, default=0 ; Set this keyword to return the whole file ; VERBOSE: in, optional, type=boolean, default=0 ; Trigger dialog with user ; ; :Examples: ; Search Ryan & Woodward (2010) version of IRAS database for Ceres and Pallas:: ; IDL> print, irasRW_getCatalog(1) ; IDL> print, irasRW_getCatalog('Pallas') ; ; :Uses: ; initIDL, readfmt, astNameFormat, designation ; ; :Author: ; B.Carry (IMCCE) ; ; :History: ; Change History:: ; Written in May 2014, B. Carry (IMCCE) ;- function IRASRW_getCatalog, ID, IRAS=IRAS, CONFIG=CONFIG, DUMP=DUMP, VERBOSE=VERBOSE ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; COMPILE_OPT hidden ;--I.1-- Set IDL to Local Working Environment ----------------------------------- if not keyword_set(IRAS) then begin if not keyword_set(CONFIG) then begin config = initIDL(/CATALOG) endif IRAS = config.bib.iras endif ;--I.2-- Output Structure Definition -------------------------------------------- empty={num:0L, des:'', src:'', $ STM:{N:0, pV:{val: 0., unc:0.}, D:{val: 0., unc:0.}}, $ NEATM:{N:0, pV:{val: 0., unc:0.}, D:{val: 0., unc:0.}, eta:{val: 0., unc:0.}}} ;--I.3-- Check Existance of the File -------------------------------------------- if not file_test(IRAS) then begin if keyword_set(VERBOSE) then message, /INFO, 'IRAS file not found: '+strtrim(IRAS,2) return, -2 endif ;--I.4-- Dump mode Exception ---------------------------------------------------- if keyword_set(DUMP) then ID='*' ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Read the Whole IRAS file -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; readfmt, iras, '(I5,1x,A4,1x,I2,1x,F11.5,1x,F11.5,1x,F11.5,1x,F11.5,1x,I2,F7.5,1x,F7.5,1x,F9.5,1x,F8.5,1x,F7.5,1x,F7.5)', $ irasNum, irasSrc, sN, sPv, sDPv, sD, sDD, nN, nPv, nDPv, nD, nDD, nEta, nDEta, /silent nbIRAS = n_elements(irasNum) irasNum = round(irasNum) ; irasName= strtrim(irasName,2) ; irasDes = strtrim(irasDes ,2) ; voidName = where( strcmp(irasName, ''), nVoid) ; if nVoid gt 1 then irasName(voidName)= irasDes(voidName) ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- III -- Asteroid Designation Interpretation -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--III.1-- Identify Input Type --------------------------------------------------- trash = astnameformat(ID, TYPE=idType ) ;--III.2-- Set Asteroid IAU Number ----------------------------------------------- if idType eq 1 then begin num = round(float(ID)) des = designation(ID) endif else begin num = designation(ID) des = strtrim(ID,2) endelse ;--III.3-- Line Selection -------------------------------------------------------- ;--III.3.1-- Complete Dump of the IRAS catalog if keyword_set(dump) or strcmp(ID,'*',1) then begin sel=indgen(nbIRAS) nbSel=nbIRAS ;--III.3.2-- Only a Specified Target endif else begin sel=where( num eq irasNum, nbSel ) endelse ;--III.4-- Target not Found Exception ------------------------------------------- if nbSel eq 0 then begin if keyword_set(VERBOSE) then message, /INFO, 'Target not found: '+strtrim(string(ID,format='(A)'),2) return, -1 endif ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- IV -- Result Concatenation and Output -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--IV.1-- Create the Output Structure -------------------------------------------- if nbSel eq 1 then result = empty $ else result = replicate(empty,nbSel) ;--IV.2-- Fill the Structure ----------------------------------------------------- for kSel=0, nbSel-1 do begin result(kSel).num = irasNum(sel(kSel)) result(kSel).des = designation(irasNum(sel(kSel))) result(kSel).STM.N = sN(sel(kSel)) result(kSel).STM.pV = {val:sPV(sel(kSel)), unc:sDPV(sel(kSel)) } result(kSel).STM.D = {val:sD(sel(kSel)) , unc:sDD(sel(kSel)) } result(kSel).NEATM.N = nN(sel(kSel)) result(kSel).NEATM.pV = {val:nPV(sel(kSel)) , unc:nDPV(sel(kSel)) } result(kSel).NEATM.D = {val:nD(sel(kSel)) , unc:nDD(sel(kSel)) } result(kSel).NEATM.eta= {val:nEta(sel(kSel)), unc:nDEta(sel(kSel)) } endfor ;--IV.3-- Return the Result ------------------------------------------------------ return, result end