mdsplus
mdsplus copied to clipboard
jTraverser2 fails to display VMS floating point numbers (DTYPE_F)
Affiliation MIT / PSFC
Version(s) Affected MDSplus Release: alpha_release_7.139.33
Platform Ubuntu 20
Describe the bug jTraverser2 fails to display VMS floating point numbers (DTYPE_F).
For example, when opening CMOD tree for a particular shot number, the node TSTART should contain the value -4. While instead, it contains the value 69.414721F-42, see screenshot below:
While, if the same node is accessed using Python:
>>> import MDSplus
>>> t=MDSplus.Tree('cmod', 1160909001)
>>> t.TSTART.data()
-4.0
>>>
To Reproduce Steps to reproduce the behavior:
- Start jTraverser2
- Open a CMOD shot.
- Hover over the node TSTART
- See the erroneous value being displayed
Expected behavior The node value shown by jTraverser should be a correct floating point number, in this case, -4.0
thisbius expected as non ieee floats have not been implemented yet.. one would have to convert them based on dtype before creating Float32Arrays or Float32 or implement a wrapping class e.g. FloatVMS* that handles those dtypes. same holds for other exotic float types.
Timo, we have been debugging (jTraverser2 and mdsplus-api) this issue for a while, and found that it stems from ByteBuffer being used to read the floats from their binary representation. We want to add a call to TDI's FT_FLOAT/FS_FLOAT, but couldn't figure out where to put it. Since you are more familiar with that API, can you take a crack at it?.
the conversion could be done during deserialization https://github.com/MDSplus/mdsplus/blob/0df72258c108db26df57160e483796c98d941d81/java/mdsplus-api/src/main/java/mds/data/descriptor/Descriptor_S.java#L19
here as an example for scalars the dtype is used to map to the appropriate java class. one could either convert here before passing the buffer to the Float32. or one could make a dedicated FFloat class that handles the conversion in getValue().
same could be done for the DFloat (same as FC, DC, G, and GC).
I will try to find some time to give the getValue() attempt a try.. I would implement the conversion in java though rather than relying on tdi if its not too complicated.