Skip to content

ISD to Kernel feature#694

Open
chkim-usgs wants to merge 5 commits intoDOI-USGS:mainfrom
chkim-usgs:isd_to_kern
Open

ISD to Kernel feature#694
chkim-usgs wants to merge 5 commits intoDOI-USGS:mainfrom
chkim-usgs:isd_to_kern

Conversation

@chkim-usgs
Copy link
Copy Markdown
Contributor

@chkim-usgs chkim-usgs commented Apr 1, 2026

Addresses #602

Associated with this SpiceQL PR so make sure to build and install that locally before trying out isd_to_kernel.

**Looks like the tests are failing because they are relying on a SpiceQL version that has the changes mentioned above. Once a SpiceQL release is out, I will re-run the pipeline.

You can use ISDs in ALE's tests/pytest/data/isds/ to test CK and SPK creation.

Check out the help first:

isd_to_kernel -h

Here are some examples:

# Create a CK from HIRISE ISD
# Will output hirise_isd.bc and add user comment
isd_to_kernel -f hirise_isd.json -k ck -c "This is a test comment."

# Create an SPK from CTX ISD
# Outputs to inputted outfile name
isd_to_kernel -f ctx_isd.json -k spk -o ctx_custom.bsp

# Create a text kernel w/ verbose on
isd_to_kernel -o test.ti -k ik -d {"KEYWORD1": "VALUE1"} -v

*Note: It's possible that some CK/SPK generation may fail because their frame name is not included in the aliasMap in SpiceQL so that has to be updated first then you can test again.

You can check out the binary kernels with NAIFs toolkit ckbrief and brief and comment headers with commnt.

Run tests:

pytest tests/pytests/test_isd_to_kernel.py

Licensing

This project is mostly composed of free and unencumbered software released into the public domain, and we are unlikely to accept contributions that are not also released into the public domain. Somewhere near the top of each file should have these words:

This work is free and unencumbered software released into the public domain. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain.

  • I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

Comment on lines +16 to +25
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"-f", "--isd_file",
type=Path,
help="Input ISD (Image Support Data) JSON file to extract kernel information from."
)
parser.add_argument(
"-k", "--kernel_type",
default=None,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

early on we walked about using click, no need to change now but any reason you went with an arparse script?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Kept it consistent with how isd_generate is formatted. I can update to use click, should be straightforward.

Comment on lines +78 to +84
reference_frame_map = {
1: "J2000",
2: "B1950",
3: "FK4",
4: "DE-118",
5: "DE-96",
6: "DE-102",
Copy link
Copy Markdown
Collaborator

@Kelvinrr Kelvinrr Apr 1, 2026

Choose a reason for hiding this comment

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

cspice should be able to get these without furnishing anything, why are we maintaining our own?

Comment on lines +103 to +124
class KernelType(Enum):
"""
An enumeration representing supported SPICE kernel types and their
associated file extensions.

This class serves as the central authority for mapping kernel names
(e.g., 'SPK', 'CK') to their standard NAIF file extensions and provides
utility methods for distinguishing between binary and text-based kernels.
"""
SPK = ".bsp"
CK = ".bc"
FK = ".tf"
IK = ".ti"
LSK = ".tls"
MK = ".tm"
PCK = ".tpc"
SCLK = ".tsc"

@classmethod
def get_ext(cls, kernel_type: str) -> str:
"""
Retrieves the file extension for a given kernel type string.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

some of this is partially already in SpiceQL. It would be better to augment that than reproduce here.

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