Skip to content

Commit

Permalink
Do not modify mappings that may break fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonHeybrock committed May 1, 2023
1 parent 0141b82 commit dc29cbe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/scippnexus/v2/nxdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ class NXlog(NXdata):
"""

def __init__(self, attrs: Dict[str, Any], children: Dict[str, Union[Field, Group]]):
children = dict(children)
self._sublogs = []
self._sublog_children = {}
for name in children:
Expand Down Expand Up @@ -410,12 +411,13 @@ def _assemble_sublog(self,

def assemble(self,
dg: sc.DataGroup) -> Union[sc.DataGroup, sc.DataArray, sc.Dataset]:
self._time_to_datetime(dg)
dg = sc.DataGroup(dg)
sublogs = sc.DataGroup()
for name in self._sublogs:
# Somewhat arbitrary definition of which fields is the "value"
value_name = 'severity' if name == 'alarm' else None
sublogs[name] = self._assemble_sublog(dg, name, value_name=value_name)
self._time_to_datetime(dg)
out = super().assemble(dg)
return out if not sublogs else sc.DataGroup(value=out, **sublogs)

Expand Down

0 comments on commit dc29cbe

Please sign in to comment.