Skip to content

Commit 5ddccc4

Browse files
committed
Handle the episode number incase the value is alphabetic; assign episode number to 0
1 parent 3cb4f96 commit 5ddccc4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pystac_monty/sources/pdc.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ def __init__(self, pdc_data_src: PDCDataSource):
6363
self.exposure_detail = json.loads(f.read())
6464

6565
self.uuid = self.config_data.get("uuid", None)
66-
self.episode_number = int(float(self.config_data.get("exposure_timestamp", 0)))
66+
# Note: We might need to handle this differently if the exposure_timestamp
67+
# is other than numeric (e.g. alphabetic)
68+
# For now, we have assigned 0 to the episode_number
69+
try:
70+
self.episode_number = int(float(self.config_data.get("exposure_timestamp", 0)))
71+
except ValueError:
72+
self.episode_number = 0
6773
if "geojson_file_path" in self.config_data and os.path.exists(self.config_data["geojson_file_path"]):
6874
with open(self.config_data["geojson_file_path"], "r", encoding="utf-8") as f:
6975
self.geojson_data = json.loads(f.read())

0 commit comments

Comments
 (0)