Skip to content

Possible bug with get_bounds_dim_name #442

@huard

Description

@huard

This change in 0.8.1 seems problematic.

If the returned list has more than one item, it will raise a ValueError:

File /opt/conda/envs/birdy/lib/python3.9/site-packages/cf_xarray/accessor.py:2276, in CFDatasetAccessor.get_bounds_dim_name(self, key)
   2263 def get_bounds_dim_name(self, key: Hashable) -> Hashable:
   2264     """
   2265     Get bounds dim name for variable corresponding to key.
   2266 
   (...)
   2274     str
   2275     """
-> 2276     (crd_name,) = apply_mapper(_get_all, self._obj, key, error=False, default=[key])
   2277     variables = self._obj._variables
   2278     crd = variables[crd_name]

ValueError: too many values to unpack (expected 1) 

In my particular case, the returned value is ['lon_bounds', 'lon'].

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions