-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running ALE on HRSC #424
Comments
HRSC wasn't matching well with ISIS for ephemeris data so we've disabled it from load(s) until it lines up better. For right now you need to manually specify the driver to generate an ISD. Here's the modified version of your code, you will need to set ISISROOT and ISISDATA for the kernel expansion to work correctly:
|
I had to get an extra kernel but I am still getting an error. I tried to debug but didn't get very far.
|
Hm, probably missing a text kernel. The function According to the stack trace through, there might need to be a specialization for CCD center for HRSC as HRSC uses a |
@thareUSGS #425 got the driver running, let me know if those changes work for you. |
@Kelvinrr not sure how to get the new code setup to run. For example do I still need to "you will need to set ISISROOT and ISISDATA for the kernel expansion to work correctly"
I did try both, hoping I setup the environment correct and I still get 'No Such Driver for Label' (from the first methods) or from Jesse's I get:
So I created my own ISIS3DATA area with that file and I get errors like
which makes me think my environment is not ordered correctly? which is:
Any tips would be appreciated. |
@thareUSGS You should be running the same code that Jesse posted. That error about the missing SCLK is so odd, we definitely do not have that SCLK kernel in our data area, but we have others. After updating the driver and testing output, I had to re-spiceinit the cubes because I encountered the same error. Were these spiceinit-ed by someone outside USGS Astro? I imagine they must of used a different SCLK that we do not have when they first spiceinit-ed the cubes? |
In my experiments MexHrscPds3NaifSpiceDriver is working correctly, but MexHrscIsisLabelNaifSpiceDriver is not. The issue seems to come from the fact that the latter's implementation of the line_scan_rate() function does not scale the ephemeris times as expected later by the functions which do time look up. I used the latest ale code from GitHub when looking at this. I still get a few pixel of disagreement at some locations between the ISIS and CSM models for the h4235_0001_s22 dataset. Not fully sure if it is because anything I do. It would be nice if at some point this is evaluated in knoten. |
With this new report on MexHrscIsisLabelNaifSpiceDriver I will re-open this issue and hope we can get some testing in place (e.g. knoten). |
I'd like to continue this issue. The latest ALE driver seems not to work for MEx SRC images (but working for HRSC images). >>> import ale
>>> ale.__version__
'0.10.0'
# ALE works well for HRSC versions 2 and 3
# HRSC Version 2
>>> test_cub = "h0010_0000_nd2.cub"
>>> kernels = ale.util.generate_kernels_from_cube(test_cub, expand=True)
>>> isd_str = ale.loads(test_cub, formatter="usgscsm", props={"kernels": kernels}, verbose=False)
# No error follows
# HRSC Version 3
>>> test_cub = "h0010_0000_nd3.cub"
>>> kernels = ale.util.generate_kernels_from_cube(test_cub, expand=True)
>>> isd_str = ale.loads(test_cub, formatter="usgscsm", props={"kernels": kernels}, verbose=False)
# No error follows
# ALE does not work for SRC versions 2 and 3
# SRC Version 2
>>> test_cub = "h0010_0023_sr2.cub"
>>> kernels = ale.util.generate_kernels_from_cube(test_cub, expand=True)
>>> isd_str = ale.loads(test_cub, formatter="usgscsm", props={"kernels": kernels}, verbose=False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/hemmi/miniforge3/envs/isis830/lib/python3.11/site-packages/ale/drivers/__init__.py", line 190, in loads
res = load(label, props, formatter, verbose, only_isis_spice, only_naif_spice)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hemmi/miniforge3/envs/isis830/lib/python3.11/site-packages/ale/drivers/__init__.py", line 165, in load
raise Exception('No Such Driver for Label')
Exception: No Such Driver for Label
# SRC Version 3
>>> test_cub = "h0010_0023_sr3.cub"
>>> kernels = ale.util.generate_kernels_from_cube(test_cub, expand=True)
>>> isd_str = ale.loads(test_cub, formatter="usgscsm", props={"kernels": kernels}, verbose=False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/hemmi/miniforge3/envs/isis830/lib/python3.11/site-packages/ale/drivers/__init__.py", line 190, in loads
res = load(label, props, formatter, verbose, only_isis_spice, only_naif_spice)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hemmi/miniforge3/envs/isis830/lib/python3.11/site-packages/ale/drivers/__init__.py", line 165, in load
raise Exception('No Such Driver for Label')
Exception: No Such Driver for Label I also found the class of MEx SRC driver: ale/ale/drivers/mex_drivers.py Line 710 in 5605b49
|
Here's the MEx HRSC/SRC driver's part of the output by running >>> test_cub = "h0010_0023_sr3.cub"
>>> kernels = ale.util.generate_kernels_from_cube(test_cub, expand=True)
>>> isd_str = ale.loads(test_cub, formatter="usgscsm", props={"kernels": kernels}, verbose=True)
(above omitted)
Trying <class 'ale.drivers.mex_drivers.MexHrscIsisLabelNaifSpiceDriver'>
Failed: Instrument ID is wrong.
Traceback (most recent call last):
File "/home/hemmi/miniforge3/envs/isis830/lib/python3.11/site-packages/ale/drivers/__init__.py", line 154, in load
res.instrument_id
File "/home/hemmi/miniforge3/envs/isis830/lib/python3.11/site-packages/ale/drivers/mex_drivers.py", line 509, in instrument_id
raise Exception ("Instrument ID is wrong.")
Exception: Instrument ID is wrong.
Trying <class 'ale.drivers.mex_drivers.MexHrscPds3NaifSpiceDriver'>
Failed: 'INSTRUMENT_ID'
Traceback (most recent call last):
File "/home/hemmi/miniforge3/envs/isis830/lib/python3.11/site-packages/ale/drivers/__init__.py", line 154, in load
res.instrument_id
File "/home/hemmi/miniforge3/envs/isis830/lib/python3.11/site-packages/ale/drivers/mex_drivers.py", line 157, in instrument_id
if(super().instrument_id != "HRSC"):
^^^^^^^^^^^^^^^^^^^^^
File "/home/hemmi/miniforge3/envs/isis830/lib/python3.11/site-packages/ale/base/label_pds3.py", line 33, in instrument_id
return self.label['INSTRUMENT_ID']
~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/home/hemmi/miniforge3/envs/isis830/lib/python3.11/site-packages/pvl/collections.py", line 175, in __getitem__
return dict_getitem(self, key)[0]
^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'INSTRUMENT_ID'
Trying <class 'ale.drivers.mex_drivers.MexSrcPds3NaifSpiceDriver'>
Failed: 'INSTRUMENT_ID'
Traceback (most recent call last):
File "/home/hemmi/miniforge3/envs/isis830/lib/python3.11/site-packages/ale/drivers/__init__.py", line 154, in load
res.instrument_id
File "/home/hemmi/miniforge3/envs/isis830/lib/python3.11/site-packages/ale/drivers/mex_drivers.py", line 741, in instrument_id
if(super().instrument_id != "HRSC"):
^^^^^^^^^^^^^^^^^^^^^
File "/home/hemmi/miniforge3/envs/isis830/lib/python3.11/site-packages/ale/base/label_pds3.py", line 33, in instrument_id
return self.label['INSTRUMENT_ID']
~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/home/hemmi/miniforge3/envs/isis830/lib/python3.11/site-packages/pvl/collections.py", line 175, in __getitem__
return dict_getitem(self, key)[0]
^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'INSTRUMENT_ID' As shown above, I guess the cause of mis-loading MEx SRC images comes from the lack of So I changed my approach to handle it with the only available MEx SRC PDS driver, >>> test_cub = "h0010_0023_sr3.cub"
>>> kernels = ale.util.generate_kernels_from_cube(test_cub, expand=True)
>>> test_img = "H0010_0023_SR3.IMG"
>>> isd_str = ale.loads(test_img, formatter="usgscsm", props={"kernels": kernels}, verbose=False)
# No error follows! Such kind of approach is one way to handle SRC images by ale. >>> test_cub = "h0010_0023_sr3.cub"
>>> kernels = ale.util.generate_kernels_from_cube(test_cub, expand=True)
>>> test_img = "H0010_0023_SR3.IMG"
>>> isd_str = ale.loads(test_img, formatter="usgscsm", props={"kernels": kernels}, verbose=True)
(above omitted)
Trying <class 'ale.drivers.mex_drivers.MexSrcPds3NaifSpiceDriver'>
Success with: <ale.drivers.mex_drivers.MexSrcPds3NaifSpiceDriver object at 0x7f76c0a81b10>
ISD:
{
"image_lines": 1008,
"image_samples": 1008,
"name_platform": "MARS EXPRESS",
"name_sensor": "HIGH RESOLUTION STEREO CAMERA",
"radii": {
"semimajor": 3396.19,
"semiminor": 3376.2,
"unit": "km"
},
"sensor_position": {
"positions": [
[
-18844.753986017393,
3633823.0503813834,
-597500.9754221125
]
],
"velocities": [
[
-10.71064361516294,
491.35109654426736,
4432.028878037572
]
],
"unit": "m"
},
"sun_position": {
"positions": [
[
112430957429.882,
186383062053.64615,
-45622369102.37898
]
],
"velocities": [
[
13193868.679184968,
-7954072.810385375,
8725.201637798975
]
],
"unit": "m"
},
"sensor_orientation": {
"quaternions": [
[
-0.44845594151481766,
0.46624440263648237,
-0.5325759899777893,
-0.5457712345199095
]
]
},
"detector_sample_summing": 1,
"detector_line_summing": 1,
"focal_length_model": {
"focal_length": 984.76
},
"detector_center": {
"line": 512.0,
"sample": 512.0
},
"starting_detector_line": 0,
"starting_detector_sample": 0,
"focal2pixel_lines": [
0.0,
0.0,
111.111111111111
],
"focal2pixel_samples": [
0.0,
111.111111111111,
0.0
],
"optical_distortion": {
"radial": {
"coefficients": [
0.0,
0.0,
0.0
]
}
},
"reference_height": {
"maxheight": 1000,
"minheight": -1000,
"unit": "m"
},
"name_model": "USGS_ASTRO_FRAME_SENSOR_MODEL",
"center_ephemeris_time": 127015396.64734519
} BTW, do you think this is the only wayaround to process SRC images with SPICE kernels by ale, at least for the moment? |
I found another issue about the above example of loading an original img file with kernels taken via its cube.
The catlab says like:
The difference b/w the two ephemeris times is ~46 sec. ale >>> isd_str = ale.loads(test_img, formatter="ale", props={"kernels": kernels}, verbose=False)
>>> print(isd_str)
{
"isis_camera_version": 1,
"image_lines": 1008,
"image_samples": 1008,
"name_platform": "MARS EXPRESS",
"name_sensor": "HIGH RESOLUTION STEREO CAMERA",
"reference_height": {
"maxheight": 1000,
"minheight": -1000,
"unit": "m"
},
"name_model": "USGS_ASTRO_FRAME_SENSOR_MODEL",
"center_ephemeris_time": 127015396.64734519,
"radii": {
"semimajor": 3396.19,
"semiminor": 3376.2,
"unit": "km"
},
"body_rotation": {
"time_dependent_frames": [
10014,
1
],
"ck_table_start_time": 127015396.64734519,
"ck_table_end_time": 127015396.64734519,
"ck_table_original_size": 1,
"ephemeris_times": [
127015396.64734519
],
"quaternions": [
[
0.04598506398809,
0.2246409766576803,
-0.22545165605830253,
0.9468861369123871
]
],
"angular_velocities": [
[
3.162434532527514e-05,
-2.8798992833710347e-05,
5.652258189188276e-05
]
],
"reference_frame": 1
},
"instrument_pointing": {
"time_dependent_frames": [
-41001,
1
],
"ck_table_start_time": 127015396.64734519,
"ck_table_end_time": 127015396.64734519,
"ck_table_original_size": 1,
"ephemeris_times": [
127015396.64734519
],
"quaternions": [
[
0.1749106389908213,
0.15528890661602537,
0.4437283631709852,
0.8650992796017232
]
],
"angular_velocities": [
[
-0.00106162784061926,
-0.0002641893261326531,
0.0005171708451557637
]
],
"reference_frame": 1,
"constant_frames": [
-41220,
-41200,
-41000,
-41001
],
"constant_rotation": [
0.0006632249171651949,
0.9999987020873514,
-0.0014683175140289342,
-0.9999995539429968,
0.0006622366189151796,
-0.0006734660111232121,
-0.0006724927633971734,
0.001468763518515065,
0.9999986952427538
]
},
"naif_keywords": {
"BODY499_RADII": [
3396.19,
3396.19,
3376.2
],
"BODY_FRAME_CODE": 10014,
"BODY_CODE": 499,
"INS-41220_PIXEL_SIZE": [
9.0,
9.0
],
"INS-41220_FOV_CROSS_ANGLE": 0.27,
"INS-41220_BORESIGHT_SAMPLE": 512.5,
"INS-41220_FOV_REF_ANGLE": 0.27,
"INS-41220_TRANSX": [
0.0,
0.009,
0.0
],
"INS-41220_TRANSY": [
0.0,
0.0,
0.009
],
"FRAME_-41220_CLASS_ID": -41220.0,
"INS-41220_PIXEL_LINES": 1024.0,
"INS-41220_CCD_CENTER": [
512.5,
512.5
],
"INS-41220_PLATFORM_ID": -41000.0,
"TKFRAME_-41220_RELATIVE": "MEX_HRSC_BASE",
"INS-41220_ITRANSL": [
0.0,
0.0,
111.111111111111
],
"INS-41220_ITRANSS": [
0.0,
111.111111111111,
0.0
],
"INS-41220_BORESIGHT": [
0.0,
0.0,
984.76
],
"INS-41220_FOV_ANGULAR_SIZE": [
0.0094,
0.0094
],
"INS-41220_FOV_CLASS_SPEC": "ANGLES",
"INS-41220_IFOV": 9.14e-06,
"INS-41220_FOV_REF_VECTOR": [
1.0,
0.0,
0.0
],
"FRAME_-41220_CLASS": 4.0,
"INS-41220_FOV_SHAPE": "RECTANGLE",
"INS-41220_PIXEL_SAMPLES": 1024.0,
"INS-41220_CK_REFERENCE_ID": 1.0,
"INS-41220_PIXEL_PITCH": 0.009,
"INS-41220_BORESIGHT_LINE": 512.5,
"INS-41220_FOCAL_LENGTH": 984.76,
"INS-41220_FOV_ANGLE_UNITS": "DEGREES",
"INS-41220_F/RATIO": 9.2,
"INS-41220_FOV_FRAME": "MEX_HRSC_SRC",
"FRAME_-41220_NAME": "MEX_HRSC_SRC",
"TKFRAME_-41220_ANGLES": [
-0.084154,
-0.038531,
90.038
],
"INS-41220_CK_FRAME_ID": -41001.0,
"FRAME_-41220_CENTER": -41200.0,
"TKFRAME_-41220_AXES": [
1.0,
2.0,
3.0
],
"TKFRAME_-41220_SPEC": "ANGLES",
"TKFRAME_-41220_UNITS": "DEGREES",
"BODY499_POLE_DEC": [
52.8865,
-0.0609,
0.0
],
"BODY499_POLE_RA": [
317.68143,
-0.1061,
0.0
],
"BODY499_PM": [
176.63,
350.89198226,
0.0
]
},
"detector_sample_summing": 1,
"detector_line_summing": 1,
"focal_length_model": {
"focal_length": 984.76
},
"detector_center": {
"line": 512.0,
"sample": 512.0
},
"focal2pixel_lines": [
0.0,
0.0,
111.111111111111
],
"focal2pixel_samples": [
0.0,
111.111111111111,
0.0
],
"optical_distortion": {
"radial": {
"coefficients": [
0.0,
0.0,
0.0
]
}
},
"starting_detector_line": 0,
"starting_detector_sample": 0,
"instrument_position": {
"spk_table_start_time": 127015396.64734519,
"spk_table_end_time": 127015396.64734519,
"spk_table_original_size": 1,
"ephemeris_times": [
127015396.64734519
],
"positions": [
[
-301.33667654827565,
-3002.7406414312904,
-2110.634347661829
]
],
"velocities": [
[
2.2104769081410343,
-2.1882970971365943,
3.2062624534366946
]
],
"reference_frame": 1
},
"sun_position": {
"spk_table_start_time": 127015396.64734519,
"spk_table_end_time": 127015396.64734519,
"spk_table_original_size": 1,
"ephemeris_times": [
127015396.64734519
],
"positions": [
[
-123610491.75355302,
-169290951.16735008,
-74308725.95399317
]
],
"velocities": [
[
19.2183285857141,
-13.9337871854119,
-6.91036204155162
]
],
"reference_frame": 1
}
} catlab
|
I see ALE running on PDS IMG and ISIS cubes in example, but I get the same not supported error. Confused. I refreshed ALE install just in case but no luck.
ISIS 8bit cubes here and PDS3 IMGs located here:
/scratch/thare/SOCET_GXP/test_models_GXP/HRSC/Gale_Crater_orbit_h4235/stereo_images
here is how I am running ALE
The text was updated successfully, but these errors were encountered: