[RFC] Default attributes for dataset in MC
The current MeasurementControl sets the attributes name
, long_name
and unit
in the dataset created.
The long_name
does not include the unit, which means that when such a dataset is plotted with the default xarray
plotting methods, the unit is not included. The dataset created in the Tutorial 1 is:
In [16]: dset
Out[16]:
<xarray.Dataset>
Dimensions: (dim_0: 50)
Dimensions without coordinates: dim_0
Data variables:
x0 (dim_0) float64 0.0 0.102 0.2041 0.3061 ... 4.694 4.796 4.898 5.0
y0 (dim_0) float64 0.8885 0.9502 0.682 ... -0.7422 -1.085 -0.9597
Attributes:
tuid: 20210209-225419-623-f2f4c7
name: Cosine test
2D-grid: False
In [17]: dset.x0.attrs
Out[17]: {'name': 't', 'long_name': 'Time', 'unit': 's'}
Plotting this with dset.plot.scatter('x0', 'y0')
results in a plot without the units.
I would propose to use defaults that result in adding the unit the the default axis labels. One option would be to set long_name
to Time [s]
.