Unverified Commit bc50c79a authored by Austin Sanders's avatar Austin Sanders Committed by GitHub
Browse files

Added apollo metric driver, tests, and data (#533)



* Added apollo metric driver, tests, and data

* Changed ephemeris stop time to use driver start instead of naif

* Updated changelog

* Update CHANGELOG.md

* Added missing xsps for testing

* Moved apollo changelog entry

* Moved changelog entry

---------

Co-authored-by: default avataracpaquette <acpaquette@usgs.gov>
Co-authored-by: default avataracpaquette <acp263@nau.edu>
parent 775ff216
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ release.
-->

## [Unreleased]
### Added
- Apollo Metric drivers, tests, and data [#533](https://github.com/DOI-USGS/ale/pull/533)

## [0.10.0] - 2024-01-08 

@@ -87,6 +89,9 @@ release.
- Chandrayaan1_mrffr IsisLabelNaifSpice driver, tests and test data [#519](https://github.com/DOI-USGS/ale/pull/519)
- MGS MOC Narrow Angle IsisLabelNaifSpice driver, tests, and test data [#517](https://github.com/DOI-USGS/ale/pull/517)
- Hayabusa NIRS IsisLabelNaifSpice driver, tests and test data [#532](https://github.com/DOI-USGS/ale/pull/532)
<<<<<<< HEAD



=======
>>>>>>> 2c73f7da6ab8efbe056fff9c160e4458fec2f982
+138 −0
Original line number Diff line number Diff line
import spiceypy as spice
import pvl

from ale.base import Driver
from ale.base.data_naif import NaifSpice
from ale.base.label_isis import IsisLabel
from ale.base.type_distortion import NoDistortion
from ale.base.type_sensor import Framer

class ApolloMetricIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoDistortion, Driver):

    @property
    def instrument_id(self):
        """
        Returns the instrument id for chandrayaan moon mineralogy mapper
        
        Returns
        -------
        : str
          Frame Reference for chandrayaan moon mineralogy mapper
        """
        inst_id_lookup = {
            "METRIC" : "APOLLO_METRIC"
        }
        return inst_id_lookup[super().instrument_id] 
    
    @property
    def ikid(self):
        """
        Returns the ikid/frame code from the ISIS label. This is attached
        via chan1m3 on ingestion into an ISIS cube
        
        Returns
        -------
        : int
          ikid for chandrayaan moon mineralogy mapper
        """
        return self.label['IsisCube']['Kernels']['NaifFrameCode']
    
    @property
    def sensor_model_version(self):
        """
        The ISIS Sensor model number for Chandrayaan1M3 in ISIS. This is likely just 1
        
        Returns
        -------
        : int
          ISIS sensor model version
        """
        return 1

    @property
    def sensor_name(self):
        """
        Returns
        -------
        : String
          The name of the sensor
        """
        return self.instrument_id

    @property
    def exposure_duration(self):
        """
        The exposure duration of the image, in seconds

        Returns
        -------
        : float
          Exposure duration in seconds
        """
        exposure_duration = self.label['IsisCube']['Code']['ExposureDuration']
        # Check for units on the PVL keyword
        if isinstance(exposure_duration, pvl.collections.Quantity):
            units = exposure_duration.units
            if "ms" in units.lower() or 'milliseconds' in units.lower():
                exposure_duration = exposure_duration.value * 0.001
            else:
                # if not milliseconds, the units are probably seconds
                exposure_duration = exposure_duration.value
        else:
            # if no units are available, assume the exposure duration is given in milliseconds
            exposure_duration = exposure_duration * 0.001
        return exposure_duration

    @property
    def ephemeris_start_time(self):
        """
        The spacecraft clock start count, frequently used to determine the start time
        of the image.

        Returns
        -------
        : str
          Spacecraft clock start count
        """
        return spice.str2et(self.utc_start_time.strftime("%Y-%m-%d %H:%M:%S.%f"))

    @property
    def ephemeris_stop_time(self):
        """
        The spacecraft clock start count, frequently used to determine the start time
        of the image.

        Returns
        -------
        : str
          Spacecraft clock start count
        """
        return self.ephemeris_start_time + self.exposure_duration

    @property
    def detector_center_line(self):
        """
        The center of the CCD in detector pixels
        Expects ikid to be defined. this should be the integer Naif ID code for
        the instrument.

        Returns
        -------
        list :
            The center of the CCD formatted as line, sample
        """
        return float(spice.gdpool('INS{}_BORESIGHT'.format(self.ikid), 0, 3)[0])

    @property
    def detector_center_sample(self):
        """
        The center of the CCD in detector pixels
        Expects ikid to be defined. this should be the integer Naif ID code for
        the instrument.

        Returns
        -------
        list :
            The center of the CCD formatted as line, sample
        """
        return float(spice.gdpool('INS{}_BORESIGHT'.format(self.ikid), 0, 3)[1])
+270 −0
Original line number Diff line number Diff line
DAFETF NAIF DAF ENCODED TRANSFER FILE
'DAF/SPK '
'2'
'6'
'SPKMERGE                                                    '
BEGIN_ARRAY 1 45
'DE-0421LE-0421                          '
'-35746A8E0CFD8C^8'
'-3574699D24CC66^8'
'12D'
'3'
'1'
'2'
45
'-357297C^8'
'2A3^5'
'-D501E37381BCB8^4'
'292EE52ACDDB7C^5'
'BB9420F67B881^3'
'-5B25A3BDF49614^3'
'-2CD765E2C41D^2'
'289B26F3B07084^1'
'50C552FC50733^0'
'38B75477575668^-1'
'-391E2A5514C7C8^-2'
'-8DC376423C5468^-3'
'-4C716689372C3^-4'
'820B4C80B090A^-5'
'1197BE4A1B8CDA^-5'
'-4D14EE2B1A2D84^5'
'-44C20D6B1FA46^4'
'43371806895CE^4'
'188D1F7EE95274^3'
'-433D6EF580E1B4^2'
'-3B64AB7EBA8332^1'
'-85D963C718784^-1'
'46076B5A223D4C^-1'
'5E8CF0197F355C^-2'
'11DADEA128D453^-5'
'-890277D1FCDE68^-4'
'-A334B77AFAE96^-5'
'1E2F24DBA2DF7B^-6'
'-288EF06318B40A^5'
'D0FED1E8E40BF^3'
'2361C7B4D5EF1A^4'
'5EAC99CDE72FA4^2'
'-25D8C80E9656B4^2'
'-1B839967A0543B^1'
'1A869D6F947736^-1'
'2821C74CFC52BC^-1'
'2C5B331B068AD2^-2'
'-A63EE721EFED4^-4'
'-4BFC9B4B3E4BE^-4'
'-4A4118C6CB1C18^-5'
'2433196E3DE9CE^-6'
'-35753AC^8'
'546^5'
'29^2'
'1^1'
END_ARRAY 1 45
BEGIN_ARRAY 2 39
'DE-0421LE-0421                          '
'-35746A8E0CFD8C^8'
'-3574699D24CC66^8'
'A'
'0'
'1'
'2'
39
'-357A80C^8'
'A8C^5'
'4E2CDDEA97623^5'
'-18B1D3EE3E581F^4'
'-7DBD57CFC7F47^1'
'-2F0E88AFA0A074^-1'
'FBFDB499DE466^-3'
'822C78B9C53968^-3'
'2BEBDEFBA69CA4^-4'
'-5009CAA1A2A47C^-5'
'8FF18F5643D338^-6'
'-24424E7A98A83C^-6'
'B32F84175C9028^-8'
'87DCDF22A6C9A^5'
'7E039F8DABC194^3'
'-115F002E3AFC09^2'
'-863820F9F9E9A^-1'
'-6775F721DA56DC^-2'
'-31EA2B025070D8^-3'
'8E87A681E15C28^-4'
'-3EDFDAB289EBB6^-5'
'58D7A046587D54^-6'
'-3582F34B1B1EE2^-6'
'-1139B589F4DF3F^-7'
'39DC8AFE7E4C56^5'
'3E4D75996D001^3'
'-7391C27D804B9C^1'
'-326409CEF7A7A8^-1'
'-2BE097AD54771A^-2'
'-26B3AFF02CD0BA^-3'
'45545C09A7C314^-4'
'-1999F5F82FAB53^-5'
'20E2BCEB05F15A^-6'
'-14FD885C1732C6^-6'
'-948B5EC4E9B1E8^-8'
'-35850CC^8'
'1518^6'
'23^2'
'1^1'
END_ARRAY 2 39
BEGIN_ARRAY 3 45
'DE-0421LE-0421                          '
'-35746A8E0CFD8C^8'
'-3574699D24CC66^8'
'3'
'0'
'1'
'2'
45
'-357A80C^8'
'A8C^5'
'52622DF9FB08C8^7'
'FC892802D5EB78^6'
'-5F4C2BBBE7521C^5'
'-316EF0D73F954A^4'
'8459BFFCB0EBE8^2'
'29A037D0DE7B58^1'
'-1F194BA8241A^-1'
'-44E719AF3FAFEC^-3'
'-286CB5D4A69076^-3'
'-126430FAAB3B81^-4'
'-87279866F89CB8^-7'
'-1E4E46266C159F^-5'
'966FD70156029^-6'
'-6C46577EE1E54^7'
'A2A11CDBBA06A8^6'
'7E4E0CEA427D2C^5'
'-1E8DF7351A09CD^4'
'-BEEFFB33C7F93^2'
'154D1EF33B9E18^1'
'58D28063EC74FC^-1'
'-C8A0B282158728^-3'
'11170CFD9FA7F^-3'
'4945AEFB9C93AC^-4'
'-76245BB3E9FCA^-5'
'2F4FEE62D1E2C6^-5'
'39C17B00B145B2^-6'
'-2EF456E3452AEE^7'
'4686486B28169^6'
'36C4C5A436300A^5'
'-D3FEFE3C2EBB98^3'
'-52CBAA30D4CBEC^2'
'93D809C7BDC7C8^0'
'26F4A5DD82D566^-1'
'-6466F1788812E4^-3'
'22B1BDC81FF1DC^-4'
'26A0A4D0400A82^-4'
'-2796F465452CF2^-5'
'12EBD0E6A706FF^-5'
'31249A0B999548^-6'
'-35850CC^8'
'1518^6'
'29^2'
'1^1'
END_ARRAY 3 45
BEGIN_ARRAY 4 72
'APOLLO 15                               '
'-35746A8E0CFD8C^8'
'-3574699D24CC66^8'
'-393'
'12D'
'2'
'9'
72
'-50C9CB5FCA6AF4^3'
'-2C728C2BD7F51E^3'
'-463CCCE2B719DC^3'
'-1050D0678C0054^1'
'112C471B478423^1'
'AB14A90470A808^0'
'-52876457E8F52^3'
'-2A9D896DED4364^3'
'-4518C6B957A504^3'
'-1050D0678C0054^1'
'112C471B478423^1'
'AB14A90470A808^0'
'-5444FD50077F5^3'
'-28C886B00291AA^3'
'-43F4C08FF83028^3'
'-10C47113689291^1'
'10F61F5BE5D9E4^1'
'A55AFAF859429^0'
'-5600743FF33518^3'
'-26FEF7C80841EE^3'
'-42DAE3B00870E8^3'
'-1050CE9F34E40D^1'
'112C464487EF4D^1'
'AB14B167EC786^0'
'-57B7A9C007C26C^3'
'-2527208FF83028^3'
'-41B1F54003255^3'
'-FD8AB5D107C4F^0'
'1160E85D4C0B71^1'
'B0D03A3F96EEC8^0'
'-59655C1000FF04^3'
'-2345E3D003B8F2^3'
'-407CC97FF65A64^3'
'-F5D3CBC48F10A8^0'
'11935A4FD7AEA8^1'
'B67CB202462B6^0'
'-5AFFFD8FFE0F64^3'
'-216622F009E8B8^3'
'-3F426C5004FB12^3'
'-EE14F55A8A901^0'
'11C2800D009983^1'
'BBF9A9A4A99818^0'
'-5C912970062258^3'
'-1F7CC920048246^3'
'-3DFBA5980A4D6^3'
'-E6207AC9CAB9D^0'
'11EF760F50D5DB^1'
'C167E76FE641E8^0'
'-5E1473700474D8^3'
'-1D8EF1A7FDE06B^3'
'-3CABC95FFB125A^3'
'-DE0B6F9FCB0C^0'
'1219B9E5697BC5^1'
'C6B85DA9FF4268^0'
'-5F8887F00911F8^3'
'-1B9E7013F9B208^3'
'-3B541F0FFB1FC6^3'
'-D5DD8DE53070E^0'
'124128BF3BEA92^1'
'CBE6489ED542C^0'
'-35746A8F3157AA^8'
'-35746A73E1B9F8^8'
'-35746A58921C44^8'
'-35746A3DC3432E^8'
'-35746A2273A57C^8'
'-35746A06EAF142^8'
'-357469EBC3C64^8'
'-357469D05905BE^8'
'-357469B4F0D496^8'
'-35746999A0B3D2^8'
'1^1'
'A^1'
END_ARRAY 4 72
TOTAL_ARRAYS 4
 ~NAIF/SPC BEGIN COMMENTS~
; AS15-M-1450.isis_0.bsp LOG FILE

; Created 2023-07-20/14:18:21.00.
;
; BEGIN SPKMERGE COMMANDS

LEAPSECONDS_KERNEL = naif0012.tls

SPK_KERNEL = AS15-M-1450.isis_0.bsp
SOURCE_SPK_KERNEL = de421.bsp
    INCLUDE_COMMENTS = NO
    BODIES           = 3, 10, 301
    BEGIN_TIME       = 1971 AUG 01 14:47:36.766
    END_TIME         = 1971 AUG 01 14:51:37.673
SOURCE_SPK_KERNEL = AS15_M_REV35_v2.bsp
    INCLUDE_COMMENTS = NO
    BODIES           = -915
    BEGIN_TIME       = 1971 AUG 01 14:47:36.766
    END_TIME         = 1971 AUG 01 14:51:37.673

; END SPKMERGE COMMANDS
 ~NAIF/SPC END COMMENTS~
+277 −0
Original line number Diff line number Diff line
DAFETF NAIF DAF ENCODED TRANSFER FILE
'DAF/SPK '
'2'
'6'
'SPKMERGE                                                    '
BEGIN_ARRAY 1 45
'DE-0421LE-0421                          '
'-3574689309680E^8'
'-357467A309681^8'
'12D'
'3'
'1'
'2'
45
'-357297C^8'
'2A3^5'
'-D501E37381BCB8^4'
'292EE52ACDDB7C^5'
'BB9420F67B881^3'
'-5B25A3BDF49614^3'
'-2CD765E2C41D^2'
'289B26F3B07084^1'
'50C552FC50733^0'
'38B75477575668^-1'
'-391E2A5514C7C8^-2'
'-8DC376423C5468^-3'
'-4C716689372C3^-4'
'820B4C80B090A^-5'
'1197BE4A1B8CDA^-5'
'-4D14EE2B1A2D84^5'
'-44C20D6B1FA46^4'
'43371806895CE^4'
'188D1F7EE95274^3'
'-433D6EF580E1B4^2'
'-3B64AB7EBA8332^1'
'-85D963C718784^-1'
'46076B5A223D4C^-1'
'5E8CF0197F355C^-2'
'11DADEA128D453^-5'
'-890277D1FCDE68^-4'
'-A334B77AFAE96^-5'
'1E2F24DBA2DF7B^-6'
'-288EF06318B40A^5'
'D0FED1E8E40BF^3'
'2361C7B4D5EF1A^4'
'5EAC99CDE72FA4^2'
'-25D8C80E9656B4^2'
'-1B839967A0543B^1'
'1A869D6F947736^-1'
'2821C74CFC52BC^-1'
'2C5B331B068AD2^-2'
'-A63EE721EFED4^-4'
'-4BFC9B4B3E4BE^-4'
'-4A4118C6CB1C18^-5'
'2433196E3DE9CE^-6'
'-35753AC^8'
'546^5'
'29^2'
'1^1'
END_ARRAY 1 45
BEGIN_ARRAY 2 39
'DE-0421LE-0421                          '
'-3574689309680E^8'
'-357467A309681^8'
'A'
'0'
'1'
'2'
39
'-357A80C^8'
'A8C^5'
'4E2CDDEA97623^5'
'-18B1D3EE3E581F^4'
'-7DBD57CFC7F47^1'
'-2F0E88AFA0A074^-1'
'FBFDB499DE466^-3'
'822C78B9C53968^-3'
'2BEBDEFBA69CA4^-4'
'-5009CAA1A2A47C^-5'
'8FF18F5643D338^-6'
'-24424E7A98A83C^-6'
'B32F84175C9028^-8'
'87DCDF22A6C9A^5'
'7E039F8DABC194^3'
'-115F002E3AFC09^2'
'-863820F9F9E9A^-1'
'-6775F721DA56DC^-2'
'-31EA2B025070D8^-3'
'8E87A681E15C28^-4'
'-3EDFDAB289EBB6^-5'
'58D7A046587D54^-6'
'-3582F34B1B1EE2^-6'
'-1139B589F4DF3F^-7'
'39DC8AFE7E4C56^5'
'3E4D75996D001^3'
'-7391C27D804B9C^1'
'-326409CEF7A7A8^-1'
'-2BE097AD54771A^-2'
'-26B3AFF02CD0BA^-3'
'45545C09A7C314^-4'
'-1999F5F82FAB53^-5'
'20E2BCEB05F15A^-6'
'-14FD885C1732C6^-6'
'-948B5EC4E9B1E8^-8'
'-35850CC^8'
'1518^6'
'23^2'
'1^1'
END_ARRAY 2 39
BEGIN_ARRAY 3 45
'DE-0421LE-0421                          '
'-3574689309680E^8'
'-357467A309681^8'
'3'
'0'
'1'
'2'
45
'-357A80C^8'
'A8C^5'
'52622DF9FB08C8^7'
'FC892802D5EB78^6'
'-5F4C2BBBE7521C^5'
'-316EF0D73F954A^4'
'8459BFFCB0EBE8^2'
'29A037D0DE7B58^1'
'-1F194BA8241A^-1'
'-44E719AF3FAFEC^-3'
'-286CB5D4A69076^-3'
'-126430FAAB3B81^-4'
'-87279866F89CB8^-7'
'-1E4E46266C159F^-5'
'966FD70156029^-6'
'-6C46577EE1E54^7'
'A2A11CDBBA06A8^6'
'7E4E0CEA427D2C^5'
'-1E8DF7351A09CD^4'
'-BEEFFB33C7F93^2'
'154D1EF33B9E18^1'
'58D28063EC74FC^-1'
'-C8A0B282158728^-3'
'11170CFD9FA7F^-3'
'4945AEFB9C93AC^-4'
'-76245BB3E9FCA^-5'
'2F4FEE62D1E2C6^-5'
'39C17B00B145B2^-6'
'-2EF456E3452AEE^7'
'4686486B28169^6'
'36C4C5A436300A^5'
'-D3FEFE3C2EBB98^3'
'-52CBAA30D4CBEC^2'
'93D809C7BDC7C8^0'
'26F4A5DD82D566^-1'
'-6466F1788812E4^-3'
'22B1BDC81FF1DC^-4'
'26A0A4D0400A82^-4'
'-2796F465452CF2^-5'
'12EBD0E6A706FF^-5'
'31249A0B999548^-6'
'-35850CC^8'
'1518^6'
'29^2'
'1^1'
END_ARRAY 3 45
BEGIN_ARRAY 4 79
'APOLLO 15                               '
'-3574689309680E^8'
'-357467A309681^8'
'-393'
'12D'
'2'
'9'
79
'-6A0FC25FF6E09C^3'
'-9922DD9F82E7A8^2'
'-2DCC5D7FF2FF66^3'
'-87613B843A8CC^0'
'13289B7A4469BC^1'
'F4DAE239459BE8^0'
'-6AEF0E7FF583A4^3'
'-7863FC8F32378C^2'
'-2C270F680247D8^3'
'-7E3962215D47D8^0'
'133455574A69B1^1'
'F8B941D58D65B^0'
'-6BBE7F0FFB1FC8^3'
'-579A93FFFCA5^2'
'-2A7BA2F009E8B8^3'
'-7501B6B96510FC^0'
'133D3B5F519F2F^1'
'FC72085B185488^0'
'-6C7E619FF8586C^3'
'-36BA3997D1427E^2'
'-28C975E7FE817A^3'
'-6BB6B7B791D224^0'
'1343510830502A^1'
'10006A1DAB0BB2^1'
'-6D2E5F11226734^3'
'-15D23443D46B27^2'
'-27114FFFF29406^3'
'-625CAAFBC1ACE^0'
'134692C1384414^1'
'103755A1F3046F^1'
'-6DCE46900749A^3'
'B18A78946653F^1'
'-2553726FF484A2^3'
'-58F4ED7D467CBC^0'
'1347006F918853^1'
'106BDBA0A52696^1'
'-6E5DEBCFFD02F4^3'
'2BF61D9F4D37C2^2'
'-2390BC9008F72^3'
'-4F8424BD4EAA88^0'
'13449BC0BB4692^1'
'109DE3E0E58885^1'
'-6EDDC27001F09C^3'
'4CE4314F2D64BC^2'
'-21C7904FF4341A^3'
'-4601A6C92D051C^0'
'133F61AA3F034B^1'
'10CD9B43BDC4F2^1'
'-6F4D290FF97248^3'
'6DBB3AFFB04EE8^2'
'-1FFA11B808F06A^3'
'-3C78DADD30C81E^0'
'13375719C248E5^1'
'10FAC79702E664^1'
'-6FAC40D009983^3'
'8E82229F6738F8^2'
'-1E27E314013EC4^3'
'-32E7C2F258779^0'
'132C7C5FCCEF32^1'
'11257412F75389^1'
'-6FFAFC9FF92F2C^3'
'AF341BDF599748^2'
'-1C51490405483E^3'
'-294FBDAD7518B^0'
'131ED344B61276^1'
'114D9ABD8607EC^1'
'-357468A39B120A^8'
'-357468884AF144^8'
'-3574686D00B3D4^8'
'-35746851AE03B4^8'
'-357468365B951C^8'
'-3574681B09680E^8'
'-357467FFC0F55E^8'
'-357467E4654F7A^8'
'-357467C91363F6^8'
'-357467ADC17872^8'
'-357467926F8CEC^8'
'1^1'
'B^1'
END_ARRAY 4 79
TOTAL_ARRAYS 4
 ~NAIF/SPC BEGIN COMMENTS~
; AS15-M-1450.isis_1.bsp LOG FILE

; Created 2023-07-20/14:18:27.00.
;
; BEGIN SPKMERGE COMMANDS

LEAPSECONDS_KERNEL = naif0012.tls

SPK_KERNEL = AS15-M-1450.isis_1.bsp
SOURCE_SPK_KERNEL = de421.bsp
    INCLUDE_COMMENTS = NO
    BODIES           = 3, 10, 301
    BEGIN_TIME       = 1971 AUG 01 14:56:03.780
    END_TIME         = 1971 AUG 01 15:00:03.780
SOURCE_SPK_KERNEL = AS15_M_REV35_v2.bsp
    INCLUDE_COMMENTS = NO
    BODIES           = -915
    BEGIN_TIME       = 1971 AUG 01 14:56:03.780
    END_TIME         = 1971 AUG 01 15:00:03.780

; END SPKMERGE COMMANDS
 ~NAIF/SPC END COMMENTS~
+462 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading