; docformat = 'rst' ; ; NAME: ; PDS_Taxonomy_getCatalog ; PURPOSE: ; Return the content of the Asteroid Taxonomy catalog (from PDS) for a specific ; target or simply dump the catalog into a structure ; ;+ ; :Description: ; Return the content of the Asteroid Taxonomy catalog (from PDS) for a specific ; target or simply dump the catalog into a structure. All taxonomic ; schemes are reported, and a single classification is provided, ; with the following preference: DeMeo > Bus > S3OS2 Bus > Xu > ; S3OS2 Tholen > Tholen ; ; The PDS Asteroid Taxonomy catalog (by C. Neese) list taxonomic ; classes of asteroids for different classification schemes. ; Reference: "Neese, C., Ed., Asteroid Taxonomy ; V6.0. EAR-A-5-DDR-TAXONOMY-V6.0. NASA Planetary Data System, 2010." ; ; :Categories: ; Database, PDS, Asteroid, Taxonomy ; ; :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 ; ; :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] ; taxonomy = PATH_TO_YOUR_PDS_TAXONOMY_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_taxonomy_getCatalog(1) ; IDL> print, pds_taxonomy_getCatalog('Pallas') ; IDL> print, pds_taxonomy_getCatalog(/DUMP) ; IDL> print, pds_taxonomy_getCatalog('*') ; ; :Uses: ; initIDL, READFMT, astNameFormat ; ; :Author: ; B.Carry (IMCCE) ; ; :History: ; Change History:: ; Original Version written in August 2014, B. Carry (IMCCE) ;- function PDS_taxonomy_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.taxo endif ;--I.2-- Output Structure Definition -------------------------------------------- tax={class:'', param:''} empty={num: 0L, des: '', scheme:'', taxo:'', $ Tholen:tax, Barucci:tax, Tedesco:tax, $ Howell:tax, Xu:tax, Bus:tax, $ S3OS2: {t:tax, b:tax}, DeMeo:tax} dbFile='taxonomy10.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, '(1x,F6,1x,A18,A10,1x,'+$ 'A6,1x,A3,1x,'+$ ;-Tholen 1984, 1989 'A2,1x,A2,1x,'+$ ;-Barucci 1987 'A3,1x,A2,1x,'+$ ;-Tedesco 1989 'A6,1x,A3,1x,'+$ ;-Howell 1994 'A3,1x,A3,1x,'+$ ;-Xu 1995 'A3,1x,A3,1x,'+$ ;-Bus & Binzel 2002 'A3,1x,A3,1x,'+$ ;-Lazzaro 2004 'A3)', $ pdsNUM, pdsName, pdsDesign, $ tholenClass, tholenParam, $ barucciClass, barucciParam, $ tedescoClass, tedescoParam, $ howellClass, howellParam, $ xuClass, xuParam, $ busClass, busParam, $ S3OS2TClass, S3OS2BClass, $ demeoClass, /SILENT pdsNUM = round(pdsNUM) nbPDS = n_elements(pdsNUM) pdsName = strtrim(pdsName,2) pdsDesign= strtrim(pdsDesign,2) ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- 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 if num ne 0 then sel=where( num eq pdsNUM, nbSel ) $ else sel=where( strcmp(ID,pdsName) or strcmp(ID,pdsDesign), 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 ;--IV.2.1-- Target Identifyer result(kSel).num= pdsNUM(sel(kSel)) result(kSel).des= pdsNAME(sel(kSel)) if strcmp(result(kSel).des,'-') then result(kSel).des=pdsDesign(sel(kSel)) ;--IV.2.2-- Individual Classifications result(kSel).Tholen.class= tholenClass(sel(kSel)) result(kSel).Tholen.param= tholenParam(sel(kSel)) result(kSel).Barucci.class= barucciClass(sel(kSel)) result(kSel).Barucci.param= barucciParam(sel(kSel)) result(kSel).Tedesco.class= tedescoClass(sel(kSel)) result(kSel).Tedesco.param= tedescoParam(sel(kSel)) result(kSel).Howell.class= howellClass(sel(kSel)) result(kSel).Howell.param= howellParam(sel(kSel)) result(kSel).Xu.class= xuClass(sel(kSel)) result(kSel).Xu.param= xuParam(sel(kSel)) result(kSel).Bus.class= busClass(sel(kSel)) result(kSel).Bus.param= busParam(sel(kSel)) result(kSel).S3OS2.t.class= S3OS2tClass(sel(kSel)) result(kSel).S3OS2.b.class= S3OS2bClass(sel(kSel)) result(kSel).DeMeo.class= demeoClass(sel(kSel)) ;--IV.2.3-- Prefered Classification ranked = [ result(kSel).demeo.class, $ result(kSel).bus.class, $ result(kSel).s3os2.b.class, $ result(kSel).xu.class, $ result(kSel).s3os2.t.class, $ result(kSel).tholen.class] names = ['DeMeo', $ 'Bus', $ 'S3OS2 Bus', $ 'Xu', $ 'S3OS2 Tholen', $ 'Tholen' ] p=where( strmid(ranked,0,1) ne '-') result(kSel).scheme = names(p(0)) result(kSel).taxo = ranked(p(0)) endfor ;--IV.3-- Return the Result ------------------------------------------------------ return, result end