diff --git a/python/felis/tap.py b/python/felis/tap.py index d7e91e26..efb116ba 100644 --- a/python/felis/tap.py +++ b/python/felis/tap.py @@ -407,7 +407,9 @@ def visit_column(self, column_obj: datamodel.Column, table_obj: Table) -> Tap11B felis_type = FelisType.felis_type(felis_datatype.value) column.datatype = column_obj.votable_datatype or felis_type.votable_name - column.arraysize = column_obj.votable_arraysize or column_obj.length + column.arraysize = column_obj.votable_arraysize or ( + column_obj.length if (column_obj.length is not None and column_obj.length > 1) else None + ) if (felis_type.is_timestamp or column_obj.datatype == "text") and column.arraysize is None: column.arraysize = "*" @@ -419,7 +421,7 @@ def _is_int(s: str) -> bool: return False # Handle the deprecated size attribute - arraysize = column_obj.votable_arraysize + arraysize = column.arraysize if arraysize is not None and arraysize != "": if isinstance(arraysize, int): column.size = arraysize @@ -427,8 +429,9 @@ def _is_int(s: str) -> bool: column.size = int(arraysize) elif bool(re.match(r"^[0-9]+\*$", arraysize)): column.size = int(arraysize.replace("*", "")) - if column.size is not None: - logger.debug(f"Set size to {column.size} for {column.column_name} from arraysize {arraysize}") + + if column.size is not None: + logger.debug(f"Set size to {column.size} for {column.column_name} with arraysize {arraysize}") column.xtype = column_obj.votable_xtype column.description = column_obj.description