[file_handler] add unit and label to descriptors

This commit is contained in:
Jan Grewe 2021-01-21 08:42:43 +01:00
parent 87ce01cbe1
commit b9af87d6b6

View File

@ -201,6 +201,8 @@ class FileHandler(metaclass=Singleton):
itd.value = "%s %s entries" % (str(e.shape), e.dtype)
itd.best_xdim = self.guess_best_xdim(e)
itd.suggested_plotter = self.suggested_plotter(e)
itd.unit = e.unit
itd.label = e.label
elif entity_type == NodeType.Tag:
point_or_segment = "segment" if e.extent else "point"
start = str(e.position)
@ -261,9 +263,19 @@ class FileHandler(metaclass=Singleton):
for i, d in enumerate(da.dimensions):
dim_name = "%i. dim: %s" % (i+1, d.label if hasattr(d, "label") else "")
dim_type= "%s %s" % (d.dimension_type, "dimension")
dimensions.append(ItemDescriptor(dim_name, type=dim_type, entity_type=NodeType.Dimension, block_id=block_id))
unit = d.unit if hasattr(d, "unit") else None
label = d.label if hasattr(d, "label") else None
dimensions.append(ItemDescriptor(dim_name, type=dim_type, entity_type=NodeType.Dimension, block_id=block_id, unit=unit, label=label))
return dimensions
def request_axis(self, block_id, array_id, index, count, start=0):
da = self._entity_buffer.get(array_id)
if da is None:
b = self.get_block(block_id)
da = b.data_arrays[array_id]
dim = da.dimensions[index]
return np.asarray(dim.axis(count, start))
def request_data_frames(self, block_id):
if self._nix_file.version[1] >= 2:
b = self.get_block(block_id)