Skip to content

Commit b547ad6

Browse files
committed
more robust handling that still accepts unitless empty string
1 parent 96dd39c commit b547ad6

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CHANGES.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
0.4.1 (unreleased)
77
------------------
88

9-
* Fixes CDIPS support by handling units stored as empty strings. [#122]
9+
* Fixes CDIPS support by handling columns filled with strings with empty units. [#122]
1010

1111
0.4.0 (06-11-2024)
1212
------------------

lcviz/utils.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,14 @@ def to_object(self, data_or_subset):
281281

282282
if len(values) and isinstance(values[0], Time):
283283
values = Time(values.base)
284-
elif hasattr(component, 'units') and component.units not in ("None", ""):
285-
values = u.Quantity(values, component.units)
284+
elif hasattr(component, 'units') and component.units != "None":
285+
try:
286+
values = u.Quantity(values, component.units)
287+
except TypeError:
288+
if component.units != "":
289+
raise
290+
# values could have been an array of strings with units ""
291+
values = values
286292

287293
if component_id.label not in names:
288294
columns.append(values)

0 commit comments

Comments
 (0)