DOI-USGS / ale

Abstraction Layer for Ephemerides (ALE)
Other
13 stars 33 forks source link

Parsing of WAC data fails #456

Closed oleg-alexandrov closed 2 years ago

oleg-alexandrov commented 2 years ago

I tried to create a WAC ISD, using the latest ALE from GitHub. It fails in parsing PVL keywords. The keywords are there, but are not recognized.

Here's what the PVL object dumps:

PVLObject([ ('BODY_CODE', 301) ('INS-85621_FOCAL_LENGTH', 6.013) ('INS-85621_PIXEL_PITCH', 0.009) ... other text omitted.

But the code: self.naif_keywords.get('INS{}_FOCAL_LENGTH'.format(self.fikid), None)

can't parse the focal length from that.

I would also like a complete example of how to create a WAC ISD. Here's what I tried which lead to the above:

!/usr/bin/python

import os, sys import json import ale

prefix = sys.argv[1]

if prefix.endswith(".cub") or prefix.lower().endswith(".img") \ or prefix.endswith(".lbl"): prefix = os.path.splitext(prefix)[0]

cub_file = prefix + '.cub' print("Loading cub file: " + cub_file) kernels = ale.util.generate_kernels_from_cube(cub_file, expand = True)

usgscsm_str = ale.loads(cub_file, formatter = "ale", \ props={"kernels": kernels}, verbose = True)

csm_isd = prefix + '.json' print("Saving: " + csm_isd) with open(csm_isd, 'w') as isd_file: isd_file.write(usgscsm_str)

The input was M119923055ME.vis.even.cub, after spiceinit.

jessemapel commented 2 years ago

This is caused by the FIKID being incorrect. I have a fix for this already, I just haven't pushed it up yet because I also have some other tweaks to the distortion/sample transform that I'm working on.

jessemapel commented 2 years ago

Fixed in #457