Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get units of parameters #171

Open
erlendviggen opened this issue Oct 8, 2019 · 5 comments
Open

Get units of parameters #171

erlendviggen opened this issue Oct 8, 2019 · 5 comments

Comments

@erlendviggen
Copy link

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!

@ErlendHaa
Copy link
Contributor

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

@eimerej
Copy link

eimerej commented Oct 15, 2020

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

@ErlendHaa
Copy link
Contributor

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'

@erlendviggen
Copy link
Author

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.

@AchyuthB
Copy link

This works for me

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants