Trivial initialization of NumericalRecord does not work
Describe the bug
Based on the docstring and typing information for a NumericalRecord it should be possible to initialize
an object like
ert.data.NumericalRecord(data=[1,2,3], index=("a", "b", "c"))
but this ends in an error:
Traceback (most recent call last):
File "test_numdirect.py", line 6, in <module>
NumericalRecord(data=[1,2,3], index=("a", "b", "c"))
File "/work/projects/ert/ert/data/record/_record.py", line 165, in __init__
self._validate_index(data, index)
File "/work/projects/ert/ert/data/record/_record.py", line 191, in _validate_index
f"inconsistent index {norm_record_index} vs {index}"
ert.data.record._record.RecordValidationError: inconsistent index (0, 1, 2) vs ('a', 'b', 'c')
This is due to the index validation code that always infers the index from the data arg.
A consequence of this is f.ex that code in _stats.py that knows both the data and the index need to construct a dictionary as a temporary object in order to initialize a record.
Tests indicate that it is an intention to make this fail:
NumericalRecord(data=[1,2,3], index=(0,1,5))
which means that the role of the index argument in the API is not to give the user explicit control over the index of the data.
I would suggest to remove the index argument as it's quite redundant since the index is always built; i.e. inferred from the data as described :top:.
Closing this as NumericalRecord has been removed as part of removing all remnants of ert3