Skip to content

Add moon scripts#14

Open
ylvaselling wants to merge 1 commit intomasterfrom
feature/add-moon-scripts
Open

Add moon scripts#14
ylvaselling wants to merge 1 commit intomasterfrom
feature/add-moon-scripts

Conversation

@ylvaselling
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py to generate RenderableGlobe, RenderableTrailOrbit, and RenderableLabel nodes for batches of provisional moons.
  • Added lookuptable.py exporting a saturn_moons dictionary with group/period/diameter data.
  • Added generate-moon-assets/README.md documenting 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.

Comment on lines +201 to +223
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"
}}
"""
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment on lines +225 to +226
ids = dict(re.findall(r"(\w+)\s*=\s*(\d+)", id_block))

Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
Comment on lines +335 to +336
kernel = "kernels454" if len(ids.keys()) <= 63 else "kernels455"
nBodies = str(len(ids.keys()))
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +390 to +391
print("Full asset file generated: " + filename)
print("Generated bodies for:" + nBodies + " moons")
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:").

Suggested change
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")

Copilot uses AI. Check for mistakes.
| `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.
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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`.

Copilot uses AI. Check for mistakes.
Comment on lines +290 to +292
# Note: Negative orbital periods indicate retrograde orbits.
# Diameter values are approximate for most irregular/provisional moons.

Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# Note: Negative orbital periods indicate retrograde orbits.
# Diameter values are approximate for most irregular/provisional moons.

Copilot uses AI. Check for mistakes.

group = get_group(name)
gui_name = format_gui_name(name)
path = f"/Solar System/Planets/Saturn/Minor Moons/{group} Group/{name}"
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
path = f"/Solar System/Planets/Saturn/Minor Moons/{group} Group/{name}"
path = f"/Solar System/Planets/Saturn/Minor Moons/{group} Group"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants