Package: webgeocalc
In december 2018,JPL/NAIFannounced anexperimentalAPI RESTful interfacefor their newWebGeoCalc server(which make online SPICE calculations).DocumentationandJavaScript examplesare already available.This package provides a Python interface to make SPICE
calculations through this API.Note the userWebGeoCalcis not design to handle heavy calculation.
If you need to make intensive queries, useSpiceypyorSpiceMinerpackage with locally hosted kernels.InstallWithpip:$pipinstallwebgeocalcUsage>>>fromwebgeocalcimportAPI>>>API.url'https://wgc2.jpl.nasa.gov:8443/webgeocalc/api'>>>API.kernel_sets()# /kernel-sets[<KernelSetDetails>SolarSystemKernels(id:1),...<KernelSetDetails>CassiniHuygens(id:5),...<KernelSetDetails>SPICEClass--BinaryPCKLessonKernels(Earth)(id:39)]>>>API.bodies(5)# /kernel-sets/{kernelSetId}/bodies[<BodyData>CASSINI(id:-82),...<BodyData>SOLARSYSTEMBARYCENTER(id:0)]>>>API.frames('Cassini Huygens')# /kernel-sets/{kernelSetId}/frames[<FrameData>CASSINI_SATURN_SKR4N_LOCK(id:-82982),...<FrameData>ITRF93(id:13000)]>>>API.instruments('Cassini Huygens')# /kernel-set/{kernelSetId}/instruments[<InstrumentData>CASSINI_CIRS_RAD(id:-82898),...<InstrumentData>CASSINI_SRU-A(id:-82001)]Prepare calculation payload:>>>fromwebgeocalcimportCalculation>>>calc=Calculation(kernels='Cassini Huygens',times='2012-10-19T08:24:00.000',calculation_type='STATE_VECTOR',target='CASSINI',observer='SATURN',reference_frame='IAU_SATURN',aberration_correction='NONE',state_representation='PLANETOGRAPHIC',)>>>calc.payload{'kernels':[{'type':'KERNEL_SET','id':5}],'times':['2012-10-19T08:24:00.000'],'calculationType':'STATE_VECTOR','target':'CASSINI','observer':'SATURN','referenceFrame':'IAU_SATURN','aberrationCorrection':'NONE','stateRepresentation':'PLANETOGRAPHIC','timeSystem':'UTC','timeFormat':'CALENDAR'}Run calculation:>>>calc.run()[Calculationsubmitted]Status:LOADING_KERNELS(id:19fd1c05-3bfe-47c7-bd16-28612249ae89)[Calculationupdate]Status:COMPLETE(id:19fd1c05-3bfe-47c7-bd16-28612249ae89){'DATE':'2012-10-19 08:24:00.000000 UTC','LONGITUDE':46.18900522,'LATITUDE':21.26337134,'ALTITUDE':694259.8921163,'D_LONGITUDE_DT':0.00888655,'D_LATITUDE_DT':-0.00031533,'D_ALTITUDE_DT':4.77080305,'SPEED':109.34997994,'TIME_AT_TARGET':'2012-10-19 08:24:00.000000 UTC','LIGHT_TIME':2.51438831}>>>fromwebgeocalcimportAngularSeparationMore details can be found in thedocsand in theJupyter Notebooks.Command Line Interface (cli)The webgeocalc API can be call directly from the command line interface:$wgc-kernels--all-SolarSystemKernels:(id:1)...-CassiniHuygens:(id:5)...-SPICEClass--BinaryPCKLessonKernels(Earth):(id:39)$wgc-instruments'Cassini Huygens'--nameISS-CASSINI_ISS_WAC_RAD:(id:-82369)-CASSINI_ISS_NAC_RAD:(id:-82368)-CASSINI_ISS_WAC:(id:-82361)-CASSINI_ISS_NAC:(id:-82360)$wgc-state-vector--kernels5\--times2012-10-19T09:00:00\--targetCASSINI\--observerSATURN\--reference_frameIAU_SATURNAPIstatus:[Calculationsubmit]Status:COMPLETE(id:041bf912-178f-4450-b787-12a49c8a3101)Results:DATE:>2012-10-1909:00:00.000000UTCDISTANCE:>764142.63776247SPEED:>111.54765899X:>298292.85744169Y:>-651606.58468976Z:>265224.81187627D_X_DT:>-98.8032491D_Y_DT:>-51.73211296D_Z_DT:>-2.1416539TIME_AT_TARGET:>2012-10-1908:59:57.451094UTCLIGHT_TIME:>2.54890548More examples can be found inhere.Local development and testingSetup:`bash pip install-e. pip install-rtests/requirements.txt-rdocs/requirements.txt `Linter:`bash flake8 setup.py docs/conf.py tests/ webgeocalc/ pylint webgeocalc/tests/*.py`Pytest:`bash pytest--cov=webgeocalc/tests/ pytest--nbval-laxexamples/ `Docs:`bashsphinx-builddocs docs/_build--color-W-bhtmlsphinx-builddocs docs/_build--color-W-bdoctest`DisclaimerThis project is not supported or endorsed by either JPL, NAIF or NASA.
The code is provided“as is”, use at your own risk.