From d1c52be265e82e6f9ce25116799a466935e7a181 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Fri, 28 Jun 2024 15:49:16 -0400 Subject: [PATCH] Backport PR #122: fix CDIPS parsing support (column filled with strings) --- CHANGES.rst | 2 ++ lcviz/utils.py | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 48ed04c..337ea9d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,8 @@ 0.4.1 (unreleased) ------------------ +* Fixes CDIPS support by handling columns filled with strings with empty units. [#122] + 0.4.0 (06-11-2024) ------------------ diff --git a/lcviz/utils.py b/lcviz/utils.py index 549b6b3..27245da 100644 --- a/lcviz/utils.py +++ b/lcviz/utils.py @@ -282,7 +282,13 @@ def to_object(self, data_or_subset): if len(values) and isinstance(values[0], Time): values = Time(values.base) elif hasattr(component, 'units') and component.units != "None": - values = u.Quantity(values, component.units) + try: + values = u.Quantity(values, component.units) + except TypeError: + if component.units != "": + raise + # values could have been an array of strings with units "" + values = values if component_id.label not in names: columns.append(values)