From b6df0291e719f2118a2d64e00e8f44f5a113dc35 Mon Sep 17 00:00:00 2001
From: Oleg Alexandrov <oleg.alexandrov@gmail.com>
Date: Thu, 19 May 2022 13:55:25 -0700
Subject: [PATCH] Add the abilty to parse NumLinesOverlap from cub file

---
 ale/base/type_sensor.py     | 10 ++++++++++
 ale/drivers/lro_drivers.py  | 13 +++++++++++++
 ale/formatters/formatter.py |  1 +
 3 files changed, 24 insertions(+)

diff --git a/ale/base/type_sensor.py b/ale/base/type_sensor.py
index b490790..433c078 100644
--- a/ale/base/type_sensor.py
+++ b/ale/base/type_sensor.py
@@ -128,6 +128,16 @@ class PushFrame():
     def num_frames(self):
         return int(self.image_lines // self.framelet_height)
 
+    @property
+    def num_lines_overlap(self):
+        """
+        Returns
+        -------
+        : int
+          For PushFrame sensors, returns how many many lines of a framelet
+          overlap with neighboring framelets.
+        """
+        return 0
 
     @property
     def ephemeris_stop_time(self):
diff --git a/ale/drivers/lro_drivers.py b/ale/drivers/lro_drivers.py
index a4a9912..fdcc774 100644
--- a/ale/drivers/lro_drivers.py
+++ b/ale/drivers/lro_drivers.py
@@ -1188,6 +1188,19 @@ class LroLrocWacIsisLabelNaifSpiceDriver(PushFrame, IsisLabel, NaifSpice, Radial
         elif self.instrument_id == "LRO_LROCWAC_VIS":
             return 14
 
+    @property
+    def num_lines_overlap(self):
+        """
+        Returns
+        -------
+        : int
+          How many many lines of a framelet overlap with neighboring framelets.
+        """
+        try:
+            return self.label['IsisCube']['Instrument']['NumLinesOverlap']
+        except:
+            # May be missing, and then the default is 0
+            return 0
 
     @property
     def filter_number(self):
diff --git a/ale/formatters/formatter.py b/ale/formatters/formatter.py
index ba62ea2..ee40cf0 100644
--- a/ale/formatters/formatter.py
+++ b/ale/formatters/formatter.py
@@ -65,6 +65,7 @@ def to_isd(driver):
         meta_data['framelet_order_reversed'] = driver.framelet_order_reversed
         meta_data['framelets_flipped'] = driver.framelets_flipped
         meta_data['framelet_height'] = driver.framelet_height
+        meta_data['num_lines_overlap'] = driver.num_lines_overlap
 
     # SAR sensor model specifics
     if isinstance(driver, Radar):
-- 
GitLab