Package: cesium-script
cesium-scriptSource Code:https://juigitlab.esac.esa.int/core-system/uplink/auxiliary-tools/cesium-script.gitCollection of scripts and utils to generate inputs for the Cesium based JUICE SOC toolhttps://juicesoc.esac.esa.int/cesium/Installationpipinstallcesium-scriptDevelopmentClone this repositoryRequirements:PoetryPython 3.9+Create a virtual environment and install the dependenciespoetryinstallActivate the virtual environmentpoetryshellTestingpytestDocumentationThe documentation is automatically generated from the content of thedocs directoryand from the docstrings
of the public signatures of the source code.Pre-commitPre-commit hooks run all the auto-formatters (e.g.black,isort), linters (e.g.mypy,flake8), and other quality
checks to make sure the changeset is in good shape before a commit/push happens.You can install the hooks with (runs for each commit):pre-commitinstallOr if you want them to run only for each push:pre-commitinstall-tpre-pushOr if you want e.g. want to run all checks manually for all files:pre-commitrun--all-filesBuildpoetrybuildPublishing to JUICE NEXUS repositorySetting up the remote JUICE SOC private repository (First time only)poetryconfigrepositories.packagrhttps://scidockreg.esac.esa.int/repository/pypi-juice-releases/
poetryconfighttp-basic.packagr<user>Publishingpoetrypublish-rpackagrPackage UsageCommand line stand-alone applicationThe python package provides two command line tools as entry point for the basic functionality.Contextual informationusage:generate_scene[-h]-mkMETAKERNEL-bBODY-stSTART_UTC-etEND_UTC-sSTEP

CreatesaCZMLfilecontainingthecontextualinformationoftheS/C(positionandattitude)optionalarguments:-h,--helpshowthishelpmessageandexit-mkMETAKERNEL,--metakernelMETAKERNELthepathtometakernel-bBODY,--bodyBODYCentralbodyname.eg:Europa-stSTART_UTC,--start_utcSTART_UTCScenestartusingUTCscaleandISOformat(e.g.2032-07-02T14:22:25Z)-etEND_UTC,--end_utcEND_UTCSceneendusingUTCscaleandISOformat(e.g.2032-07-02T19:32:17Z)-sSTEP,--stepSTEPStepsizeforSPICEcalculationsinseconds.Optional-Thetoolwilldecidethestepsize.-cCK_KERNELS[CK_KERNELS...],--ck_kernelsCK_KERNELS[CK_KERNELS...]listofadditionalckkernelse.g.$generate_scene-mk~/juice_repo/juice_crema_5_1_150lb_v420_20221220_001.tm-st2032-07-02T14:22:25Z-et2032-07-02T19:32:17Z-s5-bEuropa2023-05-1110:20:36,947[INFO]CZMLgenerated2023-05-1110:20:37,945[INFO]jui_eur_20320702T1422_20320702T1932.czmlgeneratedQuick-look coverageusage:ql_coverage[-h]-mkMETAKERNEL-bBODY[-cCK_KERNELS[CK_KERNELS...]]-fFILE[-s]Createageojsonfile(s)loadablebyagivenJUICECesiumscenariowiththefeaturescontainingthegeometryofthefootprintsofaninstrumenttimeline.

optionalarguments:-h,--helpshowthishelpmessageandexit-mkMETAKERNEL,--metakernelMETAKERNELthepathtometakernel-bBODY,--bodyBODYCentralbodyname.eg:Europa-cCK_KERNELS[CK_KERNELS...],--ck_kernelsCK_KERNELS[CK_KERNELS...]listofadditionalckkernels-fFILE,--fileFILEPathtotheCSVfile-s,--splitGeneratefilessplitbyinstrument(default:false)-bsBASE_STEP,--base_stepBASE_STEPDefinesthesamplestepusedfortheshapecalculations,thedefaultis5secondsthatistherecommendedforon-the-flyrepresentationsasitsvalueaffectslinearlytotheperformancetime!The tool uses as input a csv file with five fields separated using commas.Observation nameStart of the observation, UTC date expressed using the year-month-day ISO formatEnd of the observation, UTC date expressed using the year-month-day ISO formatCadence flag, see next section for detailsField of view of the instrumentCadence flagThe cadence flag is a flexible mechanism to indicate the snapshots that will produced/accumulated per entry.
The values allowed for the field are:emptyor an integer.If the values is0, a unique feature with theinstantaneousfield of view projection atstart timewill be producedIf the value (v) is>0, eachv secondsa unique feature with theunionof the field of view projections corresponding to that v second period will be produced. It will be repeated till the end of the observation.If the value (v) is<0, eachabs(v) secondsa feature with thesnapshotof the field of view projections corresponding to that instant will be produced. It will be repeated till the end of the observation.If the field isemptya unique feature theunionof the field of view projections corresponding to the whole observation period will be produced.e.g.sample2.csvJANUS_001,2032-07-02T15:00:00Z,2032-07-02T16:00:00Z,0,JANUS
JANUS_002,2032-07-02T15:00:00Z,2032-07-02T16:00:00Z,120,JANUS
JANUS_003,2032-07-02T15:00:00Z,2032-07-02T16:00:00Z,-120,JANUS
JANUS_004,2032-07-02T15:00:00Z,2032-07-02T16:00:00Z,,JANUSJANUS_001 will produce a unique feature of the JANUS FOV projection at 2032-07-02T15:00:00Z.
JANUS_002 will produce 30 features of the JANUS accumulated FOV projections each 2 minutes
JANUS_003 will produce 30 features of the instantaneous JANUS FOV projection each 2 minutes
JANUS_004 will produce a unique feature with the union of FOV projections for the whole observationql_coverage-mk~/juice_repo/juice_crema_5_1_150lb_v420_20221220_001.tm-fsample2.csv-beuropa2023-05-3116:35:48,377[INFO]Processing2032-07-02T15:00:00Z2032-07-02T16:40:00ZJANUS2023-05-3116:36:01,885[INFO]Added50features(S)2023-05-3116:36:01,966[INFO]jui_eur_20320702T1500_20320702T1640_all.geojsongeneratedIntegration with Jupyter NotebooksThe cesium_script package can be used as part of Jupyter Notebook scriptingHow to install the cesium_script in my Jupyter environment?Go toFile > New > Notebookto create a new notebook and in the first cell, type:%pipinstall--upgradecesium_scriptExecute the cell with⇧ Shift+↵ Enterand you should get the latest version of thecesium_script.You can double check which version was install with the command:%pipshowcesium_scriptA quick Jupyter notebook samplesPre-requiste: A valid ESAC SPICE service local metakernel covering the Jupiter Tour ()Contextual informationfromcesium_script.czml.sceneimportgenerate_czmlimportspiceypyasspsp.kclear()sp.furnsh('<HERE_PATH_TO _METAKERNEL>')czml=generate_czml('2032-07-02T14:22:25Z','2032-07-02T16:22:25Z',60,'Europa')withopen('sample.czml','w+')asczml_file:czml.dump(czml_file,indent=2)Quick-Look Coveragefromcesium_script.geojson.observationsimportcreate_configuration,process_observation,dump_filemetakernel='/Users/randres/juice_repo/juice_crema_5_1_150lb_23_1_v423_20230309_001.tm'conf=create_configuration([metakernel],'europa')features=process_observation(conf,'2032-07-02T15:00:00Z','2032-07-02T16:30:00Z','JANUS',120)dump_file(features,'flyby_janus.geojson')print('done')Embedded Cesium Viewer - Display on-the-fly generated GEOJSON dataimportIPythonfromcesium_script.jupyter.connectorimportsend_geojson_contentimportgeojsonfromgeojsonimportFeatureCollectionfromgeojsonimportFeature,Point,LineString,Polygonbody='ganymede'cesium_app_url='https://juicesoc.esac.esa.int'features=[]features.append(Feature(geometry=Point((206.56,33.33,0)),properties={"Site":"Abydos Facula"}))features.append(Feature(geometry=LineString([(8.919,44.4074),(18.923,44.4075)]),properties={"Line":"A line"}))features.append(Feature(geometry=Polygon([[(2.38,57.322),(8.43,57.322),(8.194,20.28),(2.38,20.28),(2.38,57.322)]]),properties={"polygon":"A polygon"}))feature_collection=FeatureCollection(features)feature_collection['crs']={"type":"name","properties":{"name":"urn:ogc:def:crs:EPSG::104916"}}viewer_url=send_geojson_content(body,geojson.dumps(feature_collection),cesium_app_url)IPython.display.IFrame(viewer_url,width=800,height=600)Embedded Cesium Viewer - Display on-the-fly generated CZML dataimportIPythonfromcesium_script.jupyter.connectorimportsend_czml_contentfromcesium_script.czml.sceneimportgenerate_czmlimportspiceypyasspbody='europa'cesium_app_url='https://juicesoc.esac.esa.int'sp.kclear()metakernel='juice_crema_5_1_150lb_23_1_v423_20230309_001.tm'sp.furnsh(metakernel)czml=generate_czml('2032-07-02T14:22:25Z','2032-07-02T16:22:25Z',60,'Europa')viewer_url=send_czml_content(body,czml.dumps(),cesium_app_url)IPython.display.IFrame(viewer_url,width=1000,height=900)Checking the resultsOnce the CZML has been generated, it can be loaded as an input of thehttps://juicesoc.esac.esa.int/cesium/tool.Select the central body from the top/left selectorOpen the dataset load area clicking the left central chevronClick the "Load Data" buttonUpload the file using either the browse or drag&drop optionsThis project was generated using thewolt-python-package-cookiecuttertemplate.