; docformat = 'rst' ; ; NAME: ; PDS_TRIAD_GETCATALOG ; PURPOSE: ; Return the content of the TRIAD catalog (from PDS) for a specific ; target or simply dump the catalog into a structure ; ;+ ; :Description: ; Return the concent of the TRIAD catalog (from PDS) for a specific ; target or simply dump the catalog into a structure ; ; :Categories: ; Database, PDS, 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 IMPS ; catalog, or an error code (-2 file not found, -1 target not found). ; Structure fields are:: ; .NUM: IAU number ; .DES: IAU official designation ; .pV: Visible geometric albedo ; val: value ; unc: uncertainty ; .D: Diameter in km ; val: value ; unc: uncertainty ; .QUALITY: Quality code for the observations:: ; 1 - Fragmentary data ; 2 - Reliable, confirmed observations ; 3 - Results that could hardly be improved ; ; :Keywords: ; PDS: in, optional, type=string ; Path to the PDS 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:: ; [Repositery from PDS] ; triad = PATH_TO_YOUR_PDS_TRIAD_FILE ; DUMP: in, optional, type=boolean, default=0 ; Set this keyword to return the whole PDS file ; VERBOSE: in, optional, type=boolean, default=0 ; Trigger dialog with user ; ; :Examples: ; Search IMPS database for Ceres and Pallas, or dump the whole catalog:: ; IDL> print, pds_iras_getcatalog(1) ; IDL> print, pds_iras_getcatalog('Pallas') ; IDL> print, pds_iras_getcatalog(/DUMP) ; IDL> print, pds_iras_getcatalog('*') ; ; :Uses: ; initIdl, READFMT, astNameFormat ; ; :Author: ; B.Carry (IMCCE) ; ; :History: ; Change History:: ; Original Version written in November 2010, B. Carry (ESA) ; 2013 Nov. - B.Carry (IMCCE) - Allow '*' input to retrieve the whole catalog ; 2013 Nov. - B.Carry (IMCCE) - ;- function PDS_TRIAD_getCatalog, ID, PDS=PDS, 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(PDS) then begin if not keyword_set(CONFIG) then begin config = initidl(/CATALOG) endif PDS = config.pds.triad endif ;--I.2-- Output Structure Definition -------------------------------------------- empty={num:0L, des:' ', src:' ', $ pV:{val:0., unc:0.}, D:{val:0., unc:0.}, QUALITY:0} dbFile='triadradiom.tab' pds += dbFile ;--I.3-- Check Existance of the File -------------------------------------------- if not file_exist(PDS) then begin message, /INFO, 'PDS file not found: '+strtrim(PDS,2) return, -2 endif ;--I.4-- Dump mode Exception ---------------------------------------------------- if keyword_set(DUMP) then ID='*' ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Read PDS File -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; readfmt, pds, '(I6,1x,F6.1,1x,F5.3,1x,I1,1x,A80)', $ pdsNUM, pdsD, pdsPV, pdsQ, pdsSRC, /SILENT pdsNUM = round(pdsNUM) nbPDS = n_elements(pdsNUM) ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- 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 num = ID $ else num = designation(ID) ;--III.3-- Line Selection -------------------------------------------------------- ;--III.3.1-- Complete Dump of the PDS Archive if keyword_set(dump) or strcmp(ID,'*',1) then begin sel=indgen(nbPDS) nbSel=nbPDS ;--III.3.2-- Only a Specified Target endif else begin sel=where( num eq pdsNUM, 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= pdsNUM(sel(kSel)) result(kSel).des= designation(pdsNUM(sel(kSel))) result(kSel).QUALITY = pdsQ(sel(kSel)) result(kSel).pV = {val: pdsPV(sel(kSel)), unc: 0.20*pdsPV(sel(kSel))} result(kSel).D = {val: pdsD(sel(kSel)), unc: 0.10*pdsD(sel(kSel))} endfor ;--IV.3-- Return the Result ------------------------------------------------------ return, result end