Skip to content

Commit

Permalink
Only use long_name if it is a string (#5646)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Mar 9, 2023
1 parent 8d3a745 commit 03f7870
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions holoviews/core/data/xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def retrieve_unit_and_label(dim):
unit = coord.attrs.get('units') if dim.unit is None else dim.unit
if isinstance(unit, tuple):
unit = unit[0]
if 'long_name' in coord.attrs:
if isinstance(coord.attrs.get("long_name"), str):
spec = (dim.name, coord.attrs['long_name'])
else:
spec = (dim.name, dim.label)
Expand All @@ -104,7 +104,7 @@ def retrieve_unit_and_label(dim):
vdim.unit = data.attrs.get('units')
vdim.nodata = data.attrs.get('NODATA')
label = data.attrs.get('long_name')
if 'long_name' in data.attrs:
if isinstance(label, str):
vdim.label = label
elif len(vdim_param.default) == 1:
vdim = vdim_param.default[0]
Expand Down

0 comments on commit 03f7870

Please sign in to comment.