dlisio icon indicating copy to clipboard operation
dlisio copied to clipboard

Get units of parameters

Open erlendviggen opened this issue 6 years ago • 5 comments

A DLIS parameter may or may not have units. Unlike the Channel class, which has an attribute units that returns the channel's units as a string, the Parameter class has no attribute to return the units. Is there another way to find a parameter's units, or is this a feature that has not been developed yet?

Great library, by the way, and I look forward to seeing how it will develop further!

erlendviggen avatar Oct 08 '19 13:10 erlendviggen

Hi!

Is there another way to find a parameter's units, or is this a feature that has not been developed yet?

Unfortunately, it is not possible to get the unit of the parameter values at the moment. The dlis standard [1] defines an units-attribute for Channel-objects, but not for Parameters. However, the information about units is in the file, so we hope to be able to provide it in the future.

I'll leave this issue open until we can supply units for Parameter (and other types such as Measurement, Coefficient and Computation).

Great library, by the way, and I look forward to seeing how it will develop further!

Thank you! It is still under rapid development. We very much welcome any suggestions for improvements.

[1] http://w3.energistics.org/RP66/V1/Toc/main.html

ErlendHaa avatar Oct 08 '19 14:10 ErlendHaa

Hi, As we really need to get the parameters units, I implement 2 different way of getting them as a temporary solution. Just sharing it with you #299 and #300

eimerej avatar Oct 15 '20 10:10 eimerej

In release 0.2.6 attribute units, such as the units of parameter.values, are obtainable from python. Although we have yet to implement a good interface for it, they are now reachable through the more primitive attic. And are also printed in describe():

>>> param = f.object('PARAMETER', 'LCL')
>>> param.describe()
---------
Parameter
---------
name   : LCL
origin : 2
copy   : 0

Description : Logging Cable Length

Value(s) : 15347 [ft]

>>> param.attic['VALUES'].units
'ft'

ErlendHaa avatar Dec 17 '20 11:12 ErlendHaa

Excellent! This fixes the only major issue that I have found with dlisio. I look forward to you implementing a more straightforward interface for it as well, which should hopefully be a relatively simple step now that this is done.

erlendviggen avatar Dec 17 '20 17:12 erlendviggen

This works for me

for parameter in logical_file.parameters:
	units = parameter.attic['VALUES'].units

AchyuthB avatar Nov 10 '21 21:11 AchyuthB