; docformat = 'rst' ; ; NAME: ; SoSySSE ; PURPOSE: ; Compute the dimensions of the Solar System provided a Scale ;+ ; :Description: ; Compute the dimensions of the Solar System provided a Scale ; ; :Categories: ; Ephemeris, VO ; ; :Params: ; body: in, required, type=string ; The reference body for scaling, e.g., 'p:4' ; ; :Returns: ; ; :Keywords: ; orbit: in, optional, type=float ; The desired length of the orbit of the reference body. ; diameter: in, optional, type=float ; The desired size of the diameter of the reference body. ; language: in, optional, type=string, default=en ; Define the language set to use for naming conventions (en|fr) ; verbose: in, optional, type=boolean, default=0 ; If set, display the planets orbit and diameter to scale ; ; :Examples: ; IDL> a=SoSySSe('p:3',diameter=1, orbit=1,/verbose) ; IDL> a=SoSySSe('Jupiter',diameter=1, orbit=10,/verbose) ; IDL> a=SoSySSe('Mercure', orbit=1, language='fr', /verbose) ; ; :Uses: ; readcol ; ; :Author: ; B.Carry (OCA) ; ; :History: ; Change History:: ; Original Version written for fun in May 2016, B. Carry (OCA) ;- function SoSySSe, body, orbit=orbit, diameter=diameter, language=language, verbose=verbose ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; COMPILE_OPT hidden, idl2 !Quiet=1 ;--I.1-- Validate Input Parameters ----------------------------------------------------------- ;--I.1.1-- Target is Provided if not keyword_set(body) then begin message, /ioError, 'Syntax: scales = SoSySSe( body [, orbit=, diameter=])' return, -1 endif ;--I.1.2-- At least one scale is provided if not keyword_set(orbit) and not keyword_set(diameter) then begin message, /ioError, 'Specify at least one dimension: orbit or diameter' endif ;--I.2-- Target Type ------------------------------------------------------------------------- split = strSplit( body, ':', /Extract, count=nbField ) if nbField eq 1 then begin type= 'p' id = strTrim(body,2) endif else begin type= strLowCase(split[0]) id = strTrim(split[1],2) endelse ;--I.3-- AstroData Directory ----------------------------------------------------------------- astrodata= '/astrodata/' dirEproc = astroData+'Catalog/EPROC/' ;--I.4-- Planet Properties ------------------------------------------------------------------- pDiamFile = 'planets.dat' pOrbFile = 'planets.orbits' ;--I.5-- Laguage Selection ------------------------------------------------------------------- if not keyword_set(language) then language='en' ;--I.X-- Useful Constants -------------------------------------------------------------------- AUtoKM = 149597870.700d ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Read Planet Parameters -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--II.1-- Diameters of Planets --------------------------------------------------------------- readcol, dirEproc+pDiamFile, pId, pName, pRad, pMag, format='(I,A,F,F)', /Silent ;--II.2-- Orbital Elements of Planets -------------------------------------------------------- readcol, dirEproc+pOrbFile, oId, oName, oA, oE, oI, oP, oN, format='(I,A,F,F,F,F,F)', /Silent ;--II.3-- Create Planet Structure ------------------------------------------------------------ empty={id:0, name:'', radius:0., absMag:0., $ a:0., e:0., i:0., node:0., arg:0.} planet = replicate( empty, 8 ) ;--II.4-- Fill Planet Structure -------------------------------------------------------------- planet.id = pId ;-Number 1-8 planet.name = pName ;-Name planet.radius = pRad ;-Radius - km planet.absMag = pMag ;-Absolute Magnitude planet.a = oA ;-Semi-major axis - au planet.e = oE ;-Eccentricity - planet.i = oI ;-Inclination - deg planet.node = oN ;-Longitude of Ascending Node - deg planet.arg = oP ;-Longitude of Perihelion - deg ;--II.5-- French Names ----------------------------------------------------------------------- if strCmp( language, 'fr' ) then $ planet.name = ['Mercure', 'VĂ©nus','Terre','Mars','Jupiter','Saturne','Uranus','Neptune'] case type of ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- III -- Selected Body is a Planet -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; 'p': begin ;--III.1-- Body Selected by Number ------------------------------------------------------ if valid_num(id) then begin index = where( planet.id eq id ) endif else begin index = where( strCmp( planet.name, id ) ) endelse ;--III.2-- Error if no Match ------------------------------------------------------------ if index[0] eq -1 then begin message, /ioError, 'Unknown planet: '+id return, -2 endif ;--III.3-- Set Scales ------------------------------------------------------------------- if keyword_set(orbit) then oScale = orbit / planet[index].a if keyword_set(diameter) then dScale = diameter / (2 * planet[index].radius) ;--III.4-- Set Missing Scale if needed -------------------------------------------------- if not keyword_set(dScale) then dScale = oScale / AUtoKM if not keyword_set(oScale) then oScale = dScale * AUtoKM end ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- IV -- Selected Body is a Small Body -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; 'a': print, 'A CODER!!!' 'c': print, 'A CODER!!!' 's': print, 'A CODER!!!' else: begin message, /ioError, 'Unknown body type: '+type return, -3 end endcase ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- V -- Return the Solar System To Scale -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--V.1-- Set Dimensions to Scale ------------------------------------------------------------- planet.a *= oScale planet.radius *= dScale if keyword_set(verbose) then $ forprint, planet.name, planet.a, 2*planet.radius, textout=2, format='(A-10,1x,F15,1x,F15)' ;--V.2-- Return the Dimensions --------------------------------------------------------------- return, planet end