; docformat = 'rst' ; ; NAME: ; sdssReadTaxonomy ; PURPOSE: ; Read the DeMeo-Carry taxonomy based on Sloan Digital Sky Survey Moving Object Catalog. ; ;+ ; :Description: ; Read the DeMeo-Carry taxonomy based on Sloan Digital Sky Survey Moving Object Catalog. ; ; :Categories: ; Database, Asteroid, Colors ; ; :Params: ; file: in, required, type=string ; Path to a local version of the DeMeo-Carry taxonomy. ; ; :Keywords: ; ; :Returns: A structure. ; ; :Examples: ; ; :Uses: ; initIDL ; ; :Author: ; B.Carry (OCA) ; ; :History: ; Change History:: ; Written in November 2015, B. Carry (OCA) ; 2016 June - B. Carry (OCA) - Added perihelion/aphelion computation ; 2017 Feb. - B. Carry (OCA) - Added CSV format option ;- function sdssReadTaxonomy, file, csv=csv ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; COMPILE_OPT hidden, idl2 ;--I.1-- Set Input SDSS MOC File ------------------------------------------------------ ;--I.1.1-- SDSS MOC Provided as Argument if not keyword_set(file) then begin message, /ioErro, 'Syntax error: taxo = sdssReadTaxonomy( file )' return, -1 endif ;--I.2-- Test if File Exist ----------------------------------------------------------- if not file_test(file,/read) then begin message, 'DeMeo-Carry taxonomy file not found: '+file return, -2 endif ;--I.3-- Output Structure ------------------------------------------------------------- empty = {ssoNum:'', ssoName:'', class:'', $ refl: {u:0., g:0., r:0., i:0., z:0.}, $ unc: {u:0., g:0., r:0., i:0., z:0.}, $ taxo: {sl:0., zi:0.}, a:0.d, e:0.d, i:0.d, H:0., p:0., q:0., $ tot: intarr(3), status: 0} ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Read Columns from DeMeo-Carry Taxonomy -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--II.1-- Read Taxonomy File ----------------------------------------------------------- if keyword_set(CSV) then begin readcol, file, delimiter=',', $ format='(I6,A15,A3,'+$ 'F8.5,F8.5,F8.5,F8.5,F8.5,'+$ 'F8.5,F8.5,F8.5,F8.5,F8.5,'+$ 'F8.5,F8.5,F9.5,F8.6,F6.2,'+$ 'F5.2,I2,I2,I2,I1)', $ num, desig, class, $ rU, uU, rG, uG, rR, uR, rI, uI, rZ, uZ, $ sl, zi, a, e, i,hmag, tot1, tot2, tot3, stat, $ /SILENT endif else begin readfmt, file, $ 'I6,1x,A15,1x,A3,3x,'+$ 'F8.5,1x,F8.5,1x,F8.5,1x,F8.5,1x,F8.5,1x,'+$ 'F8.5,1x,F8.5,1x,F8.5,1x,F8.5,1x,F8.5,4x,'+$ 'F8.5,1x,F8.5,3x,F9.5,2x,F8.6,2x,F6.2,1x,'+$ '34x,'+$ 'F5.2,3x,I2,1x,I2,1x,I2,3x,I1', $ num, desig, class, $ rU, uU, rG, uG, rR, uR, rI, uI, rZ, uZ, $ sl, zi, a, e, i,hmag, tot1, tot2, tot3, stat, $ /SILENT endelse ;--II.2-- Build Output Structure ------------------------------------------------------- nbSSO=n_elements(num) taxo=replicate(empty,nbSSO) ;--II.3-- Store Data into a Structure -------------------------------------------------- taxo[*].ssoNum = num ;-SSO IAU Number taxo[*].ssoName = strTrim(desig,2) ;-SSO designation taxo[*].class = strTrim(class,2) ;-Taxonomic class taxo[*].refl.u = rU ;-Reflectance U taxo[*].refl.g = rG ;-Reflectance G taxo[*].refl.r = rR ;-Reflectance R taxo[*].refl.i = rI ;-Reflectance I taxo[*].refl.z = rZ ;-Reflectance Z taxo[*].unc.u = uU ;-Uncertainty U taxo[*].unc.g = uG ;-Uncertainty G taxo[*].unc.r = uR ;-Uncertainty R taxo[*].unc.i = uI ;-Uncertainty I taxo[*].unc.z = uZ ;-Uncertainty Z taxo[*].taxo.sl = sl ;-Slope and color taxo[*].taxo.zi = zi ;-Slope and color taxo[*].a = a ;-Semi-major axis taxo[*].e = e ;-Eccentricity taxo[*].i =i ;-Inclination taxo[*].H = hmag ;-Absolute magnitude taxo[*].p = a*(1-e) ;-Perihelion taxo[*].q = a*(1+e) ;-Aphelion taxo[*].e = e ;-Eccentricity taxo[*].tot = transpose([[tot1],[tot2],[tot3]]) ;-Number of observations taxo[*].status = stat ;-Status Flag return, taxo end