pylupnt.CesiumScene¶
- class pylupnt.CesiumScene(body='MOON', name=None, epoch=None, multiplier=200.0, texture=True, wireframe=True, cesium_version='1.123', inertial_view=False)¶
Builds a CZML document and renders it as an interactive CesiumJS scene.
- Parameters:
body (str) – Central body,
"EARTH"or"MOON"(see :data:`BODY_PRESETS`).name (str, optional) – Scene title (shown in the Cesium info box / used as a default filename).
epoch (datetime or str, optional) – UTC reference epoch for the animation clock. Trajectory time offsets are measured from this instant. Defaults to 2000-01-01. The absolute date only labels the timeline; it does not affect the (body-fixed) geometry.
multiplier (float) – Initial animation speed (simulated seconds per real second).
texture (bool) – If
True(default) drape the body with LuPNT’s embedded surface image. If the texture is unavailable, Cesium falls back to the body’s light solid colour.wireframe (bool) – If
True(default) overlay a lat/lon graticule wireframe on the body. Built from polylines, it renders in every environment and reads clearly as a sphere.cesium_version (str) – CesiumJS version to load from the CDN.
- add_body_trajectory(name, pos_m, offsets_s=None, radius=None, color=(180, 180, 185), label=True, path=True, path_color=None, path_width=1.0, reference_frame='FIXED', texture=None, orientation_quat=None)¶
Add a moving spherical body, such as the Moon in an Earth-centred scene.
- add_link(satellite, station, color=(255, 255, 255, 130), width=1.0, dashed=True, dash_length=14, always_visible=True)¶
Add a dynamic line from a satellite entity to a station entity.
satelliteandstationare the names previously passed to :meth:`add_satellite` / :meth:`add_trajectory` and :meth:`add_station`.
- add_satellite(name, pos_m, offsets_s=None, color=None, full_orbit=True, label=False, width=1.5, pixel_size=7, dashed=False, dash_length=18, reference_frame='FIXED')¶
Add a moving satellite with a trailing (or full-orbit) path.
- Parameters:
name (str) – Entity name (shown on hover/click and as the optional label).
pos_m (array_like, shape (N, 3)) – Body-fixed Cartesian positions in metres (ECEF for Earth, MOON_PA for the Moon).
offsets_s (array_like, shape (N,), optional) – Seconds from the scene epoch for each sample. Defaults to
0, 1, ..., N-1.color (tuple, optional) –
(r, g, b[, a])bytes. Auto-assigned from a palette if omitted.full_orbit (bool) – If
Truethe whole sampled arc is always drawn (set the sample span to one orbital period to show a complete closed orbit); ifFalsea comet-like trail grows behind the satellite.label (bool) – Draw the satellite name next to its marker.
dashed (bool) – Draw the sampled trajectory path as a dashed line.
reference_frame (str) – CZML reference frame for
pos_m("FIXED"or"INERTIAL").
- add_station(name, pos_m=None, lat=None, lon=None, alt=0.0, color=(255, 255, 255), label=True, pixel_size=10, always_visible=False, label_offset=(12, 0))¶
Add a static surface station.
Provide either a body-fixed Cartesian position
pos_m(metres), or geodeticlat/lonin degrees (placed on a sphere of the body radius viapylupnt.lat_lon_alt_to_cart()).
- add_trajectory(name, t_tdb, rv, frame_in, **kwargs)¶
Add a satellite from an inertial (or any-frame) trajectory, converting to fixed.
Convenience wrapper that rotates
rvfromframe_ininto this scene’s body-fixed frame withpylupnt.convert_frame()and derives the time offsets fromt_tdb.- Parameters:
t_tdb (array_like, shape (N,)) – TDB seconds (LuPNT internal time) for each sample.
rv (array_like, shape (N, 6) or (N, 3)) – State (or position) in
frame_in.frame_in (Frame) – Input frame, e.g.
pnt.MOON_CIorpnt.ECI.
- property fixed_frame¶
The body-fixed
Framethis scene renders in (ECEF or MOON_PA).
- save(path)¶
Write the standalone HTML scene to
pathand return thePath.
- show(filename=None, out_dir=None, height=520)¶
Render inline in Jupyter and write a standalone
.htmlalongside.Returns an
IPython.display.IFrame. If your notebook front-end sandboxes iframes and the inline view is blank, open the saved.htmlin a browser.
- to_czml()¶
Return the scene as a list of CZML packets (document, body wireframe, entities).
The solid textured body is the Cesium globe itself (configured in :meth:`to_html`); a polyline wireframe of the body is added here as a robust always-visible outline. (A planet-sized ellipsoid entity at the frame origin does not render reliably even on real GPUs, which is why the body is the native globe plus this wireframe.)
- to_html()¶
Return a standalone HTML document (CesiumJS from CDN, texture embedded).
The body is rendered as the native Cesium globe: for the Moon the globe uses
Ellipsoid.MOON; the surface texture is draped via a single embedded imagery tile (no Cesium ion token). Globe lighting is disabled so the whole body is evenly visible.