; docformat = 'rst' ; ; NAME: ; sdssWriteMOC ; PURPOSE: ; Write an IDL structure version of the Sloan Digital Sky Survey ; Moving Object Catalog on disk. ; ;+ ; :Description: ; Write an IDL structure version of the Sloan Digital Sky Survey ; Moving Object Catalog on disk. ; ; :Categories: ; Database, Asteroid, Colors ; ; :Params: ; MOC: in, required, type=structure ; An IDL structure of the SDSS MOC ; dump: in, optional, type=string ; Path to a local version of the SDSS MOC ; ; :Keywords: ; release: in, optional, type=integer, default=4 ; The release number, ADR3 and ADR4 are supported. ; ; :Examples: ; ; :Uses: ; ; :Author: ; B.Carry (OCA) ; ; :History: ; Change History:: ; Written in October 2015, B. Carry (OCA) ;- pro sdssWriteMOC, moc, dump, release=release ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; COMPILE_OPT hidden, idl2 ;--I.1-- Set Input SDSS MOC File ------------------------------------------------------ if n_params() lt 2 then begin message, /IOERROR, 'Syntax error: sdssWriteMOC, moc, dump [,release]' return endif ;--I.2-- Check SDSS MOC Release Version ----------------------------------------------- if not keyword_set(release) then release=4 ;--I.3-- Check Validity of Input MOC Structure ---------------------------------------- ;TBD ;--I.4-- Open dump file for writing --------------------------------------------------- ;--I.4.1-- Number of Entries nbMOC = n_elements(moc) ;--I.4.2-- Open File openw, idIn, dump, /Get_Lun ;--I.5-- Define Line Format ----------------------------------------------------------- ;--I.5.1-- SDSS Identification fmt1='A6,I6,I2,I5,I6,F9.3,F9.3' ;--I.5.2-- Astrometry fmt2='2x,D13.5,F11.6,F+11.6,F11.6,F11.6,F12.6,1x,F+8.4,F7.4,F+8.4,F7.4,+F8.4,+F8.4' ;--I.5.3-- Photometry fmt3='1x,F6.2,F5.2,F6.2,F5.2,F6.2,F5.2,F6.2,F5.2,F6.2,F5.2,F6.2,F5.2,1x,F6.2,F6.2' ;--I.5.4-- Identification fmt4='I2,I8,1x,A-20,I3,I3,1x,I08' ;--I.5.5-- Matching Information fmt5='1x,F11.6,F11.6,F6.2,1x,F8.3,F8.3,F6.2' ;--I.5.6-- Osculating Elements fmt6='2x,A-20,F6.2,F5.2,I6,D14.6,D13.8,F11.8,F11.6,F11.6,F11.6,F11.6' ;--I.5.7-- Proper Elements fmt7='2x,A-20,D13.8,F11.8,F11.6' ;--I.5.8-- Flags fmt8='1x,A128' ;--I.5.9-- Build Format String case release of 3: fmt='('+fmt1+','+fmt2+','+fmt3+','+fmt4+','+fmt5+','+fmt6+','+fmt7+')' 4: fmt='('+fmt1+','+fmt2+','+fmt3+','+fmt4+','+fmt5+','+fmt6+','+fmt7+','+fmt8+')' else: begin message, /IOERROR, 'Only 3rd and 4th releases are supported!' return end endcase ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Write Columns from SDSS MOC 3rd Release ----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; if release eq 3 then begin print, 'sdssWriteMOC: to be coded' endif ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- III -- Write Columns from SDSS MOC 4th Release ----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; if release eq 4 then begin for kM=0, nbMOC-1 do printf, idIn, moc[kM].mocID, moc[kM].run, moc[kM].col, $ moc[kM].field, moc[kM].object, moc[kM].rowc, moc[kM].colc, $ moc[kM].mjd, moc[kM].ra, moc[kM].dec, moc[kM].lambda, moc[kM].beta, moc[kM].phi, $ moc[kM].vMu, moc[kM].uMu, moc[kM].vNu, moc[kM].uNu, moc[kM].vLambda, moc[kM].vBeta, $ moc[kM].colU, moc[kM].errU, moc[kM].colG, moc[kM].errG, $ moc[kM].colR, moc[kM].errR, moc[kM].colI, moc[kM].errI, $ moc[kM].colZ, moc[kM].errZ, moc[kM].colA, moc[kM].errA, $ moc[kM].colV, moc[kM].colB, $ moc[kM].idFlag, moc[kM].ssoNum, moc[kM].ssoName, moc[kM].kDetect, moc[kM].nbDetect, $ moc[kM].ssoFlags, $ moc[kM].RAc, moc[kM].DECc, moc[kM].Vmag, moc[kM].dGeo, moc[kM].dSun, moc[kM].phase, $ moc[kM].oscId, moc[kM].H, moc[kM].G, moc[kM].arc, moc[kM].epoch, $ moc[kM].a, moc[kM].e, moc[kM].i, moc[kM].aNode, moc[kM].lPeri, moc[kM].M, $ moc[kM].propId, moc[kM].ap, moc[kM].ep, moc[kM].ip, moc[kM].flags, $ format=fmt endif close, idIn free_lun, idIn end