Conversation
There was a problem hiding this comment.
Pull request overview
Adds a small Python-based pipeline under generate-moon-assets/ to generate OpenSpace .asset files for Saturn’s minor/provisional moons, backed by a lookup table of moon properties.
Changes:
- Added
generatemoonassets.pyto generate RenderableGlobe, RenderableTrailOrbit, and RenderableLabel nodes for batches of provisional moons. - Added
lookuptable.pyexporting asaturn_moonsdictionary with group/period/diameter data. - Added
generate-moon-assets/README.mddocumenting scripts, usage, and dependencies.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| generate-moon-assets/generatemoonassets.py | New generator script that writes OpenSpace asset files for batches of provisional Saturn moons. |
| generate-moon-assets/lookuptable.py | New data module providing moon grouping and basic physical/orbital properties used by the generator. |
| generate-moon-assets/README.md | New documentation describing the scripts and how to run them. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def may2023(kernel, nBodies): | ||
| return f""" | ||
| asset.meta = {{ | ||
| Name = "Saturn Spice Kernels ({kernel} - May 2023 Discoveries)", | ||
| Description = [[{nBodies} newly discovered satellites [65094-65098], 65100-65157] | ||
| based on the SAT453 solution from R. Jacobson (JPL).]], | ||
| Author = "OpenSpace Team", | ||
| URL = "https://naif.jpl.nasa.gov/pub/naif/pds/wgc/kernels/spk/", | ||
| License = "NASA" | ||
| }} | ||
| """ | ||
|
|
||
| def march2025(kernel, nBodies): | ||
| return f""" | ||
| asset.meta = {{ | ||
| Name = \"Saturn Spice Kernels ({kernel} - March 2025 Discoveries)\", | ||
| Description = [[SPICE kernels for {nBodies} Saturn moons discovered and announced March 2025. | ||
| (M. Brozović & R. A. Jacobson, JPL, Apr 2025)]], | ||
| Author = "OpenSpace Team", | ||
| URL = "https://naif.jpl.nasa.gov/pub/naif/pds/wgc/kernels/spk/", | ||
| License = "NASA" | ||
| }} | ||
| """ |
There was a problem hiding this comment.
The asset metadata Name/Description strings refer to "Saturn Spice Kernels", but this script generates scene graph nodes (RenderableGlobe/Trail/Label) rather than kernel assets. This is misleading in OpenSpace’s asset browser; update the meta name/description to describe the generated moon nodes (and, if desired, mention which kernel asset they reference).
| ids = dict(re.findall(r"(\w+)\s*=\s*(\d+)", id_block)) | ||
|
|
There was a problem hiding this comment.
The ID blocks encode a mapping from designation -> numeric SPICE ID, but the numeric IDs are never used (only ids.keys() is consumed). This makes the large mapping easy to get out of sync with the kernel asset without any effect. Either switch the generated SpiceTranslation.Target to use the numeric ID from this table, or validate that the required IDs exist in the referenced {kernel}.ID table before writing the asset.
| ids = dict(re.findall(r"(\w+)\s*=\s*(\d+)", id_block)) | |
| ids = {name: int(spice_id) for name, spice_id in re.findall(r"(\w+)\s*=\s*(\d+)", id_block)} | |
| def get_spice_id(name): | |
| try: | |
| return ids[name] | |
| except KeyError as err: | |
| raise KeyError(f"Missing SPICE ID mapping for {name}") from err |
| kernel = "kernels454" if len(ids.keys()) <= 63 else "kernels455" | ||
| nBodies = str(len(ids.keys())) |
There was a problem hiding this comment.
Kernel/metadata selection is based on len(ids.keys()) <= 63 and also uses ids.keys().__len__() later. This is brittle and harder to read than necessary; prefer len(ids) and select kernel/metadata explicitly based on the chosen ID block (or a named constant), so adding/removing IDs doesn’t accidentally flip kernels/metadata.
| print("Full asset file generated: " + filename) | ||
| print("Generated bodies for:" + nBodies + " moons") |
There was a problem hiding this comment.
The script writes two files (<name>-1.asset and <name>-2.asset), but the final log says "Full asset file generated: " and omits the suffixes. This is confusing for users and makes it look like a single file was produced; update the message(s) to reflect the actual output filenames (and add a missing space in "Generated bodies for:").
| print("Full asset file generated: " + filename) | |
| print("Generated bodies for:" + nBodies + " moons") | |
| print("Full asset files generated: " + filename + "-1.asset and " + filename + "-2.asset") | |
| print("Generated bodies for: " + nBodies + " moons") |
| | `id_block2` | 65094 -- 65157 | `kernels454` (SAT453) | May 2023 discoveries | | ||
| | `id_block` | 65158 -- 65285 | `kernels455` | March 2025 discoveries | | ||
|
|
||
| The active block (`id_block`, parsed on line 225) is split into two output files to keep asset sizes manageable (e.g. `march_2025_discoveries-1.asset` and `march_2025_discoveries-2.asset`). To switch batches, change line 225 to parse `id_block2` instead. |
There was a problem hiding this comment.
This README hard-codes a source line number ("parsed on line 225") as part of the usage instructions. Line numbers are very likely to drift and will make the docs inaccurate; describe the switch in terms of the ids = ... assignment (or the id_block/id_block2 variable names) rather than a specific line number.
| The active block (`id_block`, parsed on line 225) is split into two output files to keep asset sizes manageable (e.g. `march_2025_discoveries-1.asset` and `march_2025_discoveries-2.asset`). To switch batches, change line 225 to parse `id_block2` instead. | |
| The active block (`id_block`) is split into two output files to keep asset sizes manageable (e.g. `march_2025_discoveries-1.asset` and `march_2025_discoveries-2.asset`). To switch batches, update the `ids = ...` assignment so it parses `id_block2` instead of `id_block`. |
| # Note: Negative orbital periods indicate retrograde orbits. | ||
| # Diameter values are approximate for most irregular/provisional moons. | ||
|
|
There was a problem hiding this comment.
These notes about retrograde orbits / approximate diameters are duplicated (already stated at the top of the file). Removing the repeated block reduces noise and avoids divergence if one copy is updated later.
| # Note: Negative orbital periods indicate retrograde orbits. | |
| # Diameter values are approximate for most irregular/provisional moons. |
|
|
||
| group = get_group(name) | ||
| gui_name = format_gui_name(name) | ||
| path = f"/Solar System/Planets/Saturn/Minor Moons/{group} Group/{name}" |
There was a problem hiding this comment.
path is constructed as a full path including the moon name (.../{group} Group/{name}) and then used as GUI.Path. In this repo, other generators set GUI.Path to the folder only (e.g. gaiainterpolated/main.py:95 uses Path = "/Gaia"), otherwise nodes end up nested under an extra per-moon folder. Consider setting GUI.Path to the group folder (e.g. .../{group} Group) and rely on GUI.Name for the display name.
| path = f"/Solar System/Planets/Saturn/Minor Moons/{group} Group/{name}" | |
| path = f"/Solar System/Planets/Saturn/Minor Moons/{group} Group" |
No description provided.