Skip to content

[BUG] Traceback when re-importing exported catalog search results #4000

@rosteen

Description

@rosteen

Jdaviz component

Other (explain in Description below)

Description

Testing deconfigged table/catalog workflows, I ran into this error when trying to import the ecsv file I had exported from catalog search results:

UnitsError                                Traceback (most recent call last)
File [~/opt/anaconda3/envs/viz_dev/lib/python3.14/site-packages/ipyvue/VueTemplateWidget.py:60](http://localhost:8888/lab/tree/testing/~/opt/anaconda3/envs/viz_dev/lib/python3.14/site-packages/ipyvue/VueTemplateWidget.py#line=59), in Events._handle_event(self, _, content, buffers)
     58     getattr(self, "vue_" + event)(data, buffers)
     59 else:
---> 60     getattr(self, "vue_" + event)(data)

File [~/projects/jdaviz/jdaviz/core/loaders/importers/importer.py:134](http://localhost:8888/lab/tree/testing/~/projects/jdaviz/jdaviz/core/loaders/importers/importer.py#line=133), in BaseImporter.vue_import_clicked(self, *args, **kwargs)
    133 def vue_import_clicked(self, *args, **kwargs):
--> 134     self._resolver.load()

File [~/projects/jdaviz/jdaviz/core/loaders/resolvers/resolver.py:887](http://localhost:8888/lab/tree/testing/~/projects/jdaviz/jdaviz/core/loaders/resolvers/resolver.py#line=886), in BaseResolver.load(self)
    883 def load(self):
    884     """
    885     Import into jdaviz with all selected options.
    886     """
--> 887     return self.importer()

File [~/projects/jdaviz/jdaviz/core/template_mixin.py:569](http://localhost:8888/lab/tree/testing/~/projects/jdaviz/jdaviz/core/template_mixin.py#line=568), in with_spinner.<locals>.decorator.<locals>.wrapper(self, *args, **kwargs)
    567 setattr(self, spinner_traitlet, truthy)
    568 try:
--> 569     ret_ = meth(self, *args, **kwargs)
    570 finally:
    571     setattr(self, spinner_traitlet, False if truthy is True else '')

File [~/projects/jdaviz/jdaviz/core/loaders/importers/importer.py:360](http://localhost:8888/lab/tree/testing/~/projects/jdaviz/jdaviz/core/loaders/importers/importer.py#line=359), in BaseImporterToDataCollection.__call__(self)
    356     raise ValueError(self.viewer_label_invalid_msg)
    357 # NOTE: if data hashing performance becomes an issue for importers that
    358 # don't overwrite __call__, we can pass the pre-computed hash from
    359 # self.data_hashes as a kwarg here
--> 360 self.add_to_data_collection(self.output)

File [~/projects/jdaviz/jdaviz/core/loaders/importers/catalog/catalog.py:307](http://localhost:8888/lab/tree/testing/~/projects/jdaviz/jdaviz/core/loaders/importers/catalog/catalog.py#line=306), in CatalogImporter.output(self)
    305 if isinstance(ra[0], str):
    306     try:
--> 307         ra = SkyCoord(ra, ra).ra  # dummy value 'ra' twice, just to parse string
    308     except (ValueError, u.UnitTypeError):
    309         raise ValueError("Could not parse RA column as string coordinates.")

File [~/projects/astropy/astropy/coordinates/sky_coordinate.py:228](http://localhost:8888/lab/tree/testing/~/projects/astropy/astropy/coordinates/sky_coordinate.py#line=227), in SkyCoord.__init__(self, copy, *args, **kwargs)
    224 # Parse the args and kwargs to assemble a sanitized and validated
    225 # kwargs dict for initializing attributes for this object and for
    226 # creating the internal self._sky_coord_frame object
    227 args = list(args)  # Make it mutable
--> 228 skycoord_kwargs, components, info = _parse_coordinate_data(
    229     frame_cls(**frame_kwargs), args, kwargs
    230 )
    232 # In the above two parsing functions, these kwargs were identified
    233 # as valid frame attributes for *some* frame, but not the frame that
    234 # this SkyCoord will have. We keep these attributes as special
    235 # skycoord frame attributes:
    236 for attr in skycoord_kwargs:
    237     # Setting it will also validate it.

File [~/projects/astropy/astropy/coordinates/sky_coordinate_parsers.py:270](http://localhost:8888/lab/tree/testing/~/projects/astropy/astropy/coordinates/sky_coordinate_parsers.py#line=269), in _parse_coordinate_data(frame, args, kwargs)
    266     for arg, (frame_attr_name, repr_attr_name), unit in zip(
    267         args, frame.representation_component_names.items(), units
    268     ):
    269         attr_class = frame.representation_type.attr_classes[repr_attr_name]
--> 270         _components[frame_attr_name] = attr_class(arg, unit=unit)
    272 elif len(args) == 1:
    273     # One arg which must be a coordinate.  In this case coord_kwargs
    274     # will contain keys like 'ra', 'dec', 'distance' along with any
    275     # frame attributes like equinox or obstime which were explicitly
    276     # specified in the coordinate object (i.e. non-default).
    277     _skycoord_kwargs, _components = _parse_coordinate_arg(args[0], frame, units)

File [~/projects/astropy/astropy/coordinates/angles/core.py:712](http://localhost:8888/lab/tree/testing/~/projects/astropy/astropy/coordinates/angles/core.py#line=711), in Longitude.__new__(cls, angle, unit, wrap_angle, **kwargs)
    706 if isinstance(angle, Latitude) or (
    707     isinstance(angle, str) and angle.endswith(("N", "S"))
    708 ):
    709     raise TypeError(
    710         "A Longitude angle cannot be created from a Latitude angle."
    711     )
--> 712 self = super().__new__(cls, angle, unit=unit, **kwargs)
    713 if wrap_angle is None:
    714     wrap_angle = getattr(angle, "wrap_angle", self._default_wrap_angle)

File [~/projects/astropy/astropy/coordinates/angles/core.py:181](http://localhost:8888/lab/tree/testing/~/projects/astropy/astropy/coordinates/angles/core.py#line=180), in Angle.__new__(cls, angle, unit, dtype, copy, **kwargs)
    179 elif isinstance(angle, np.ndarray):
    180     if angle.dtype.kind in "SUVO":
--> 181         angle = [cls(x, unit, copy=None) for x in angle]
    183 elif hasattr(angle, "__array__") and (
    184     not hasattr(angle, "dtype") or angle.dtype.kind not in "SUVO"
    185 ):
    186     angle = np.asarray(angle)

File [~/projects/astropy/astropy/coordinates/angles/core.py:712](http://localhost:8888/lab/tree/testing/~/projects/astropy/astropy/coordinates/angles/core.py#line=711), in Longitude.__new__(cls, angle, unit, wrap_angle, **kwargs)
    706 if isinstance(angle, Latitude) or (
    707     isinstance(angle, str) and angle.endswith(("N", "S"))
    708 ):
    709     raise TypeError(
    710         "A Longitude angle cannot be created from a Latitude angle."
    711     )
--> 712 self = super().__new__(cls, angle, unit=unit, **kwargs)
    713 if wrap_angle is None:
    714     wrap_angle = getattr(angle, "wrap_angle", self._default_wrap_angle)

File [~/projects/astropy/astropy/coordinates/angles/core.py:160](http://localhost:8888/lab/tree/testing/~/projects/astropy/astropy/coordinates/angles/core.py#line=159), in Angle.__new__(cls, angle, unit, dtype, copy, **kwargs)
    151     raise TypeError(
    152         "Creating an Angle with a tuple of degrees (or hours), minutes, and seconds "
    153         "is no longer supported, as it has ambiguous behavior when the degree "
   (...)    156         "will be interpreted simply as a sequence with the given unit."
    157     )
    159 if isinstance(angle, str):
--> 160     angle, angle_unit = formats.parse_angle(angle, unit)
    161     if angle_unit is None:
    162         angle_unit = unit

File [~/projects/astropy/astropy/coordinates/angles/formats.py:358](http://localhost:8888/lab/tree/testing/~/projects/astropy/astropy/coordinates/angles/formats.py#line=357), in parse_angle(angle, unit, debug)
    327 def parse_angle(angle, unit=None, debug=False):
    328     """
    329     Parses an input string value into an angle value.
    330 
   (...)    356         string.
    357     """
--> 358     return _AngleParser().parse(angle, unit, debug=debug)

File [~/projects/astropy/astropy/coordinates/angles/formats.py:289](http://localhost:8888/lab/tree/testing/~/projects/astropy/astropy/coordinates/angles/formats.py#line=288), in _AngleParser.parse(self, angle, unit, debug)
    284     raise ValueError(
    285         f"{str(e) or 'syntax error'} parsing angle {angle!r}"
    286     ) from e
    288 if unit is None and found_unit is None:
--> 289     raise u.UnitsError("No unit specified")
    291 return found_angle, found_unit

UnitsError: No unit specified

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpluginLabel for plugins common to multiple configurations

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions