[Developers] Units of measure and well logs
Bert Bril
Bert.Bril at opendtect.org
Mon Oct 16 17:56:07 CEST 2006
Hi all,
I just stumbled across a problem caused by units of measure, so I
thought it may be interesting to show how to tackle it.
We like to ignore units of measure as much as possible. When a well is
loaded, we try to get things in the right Z units only, and be done with
it then. Same with well logs: we get the values in as they are in the
LAS files (or as they are obtained from OW or GF), remember the unit of
measure label found there and then forget about it other than for
annotation purposes.
In some cases, we cannot get away with that strategy. For example,
velocities and densities just need to be known exactly to be able to do
inversion. That is why there is a repository for units of measure. It
has a part that is hard coded and it can be extended in various places
with ascii files, or, by adding units 'manually' in plugins. The default
set of rules to figure out the unit of measure is built from what we
used in GDI and will normally suffice.
The repository can be accessed from unitofmeasure.h in Basic. Here is
some example code:
const Well::Log& wll = wd.logs().getLog( density_log_nr );
const UnitOfMeasure* denunit = UoMR().get( wll.unitMeasLabel() );
TypeSet<float> densities_SI;
for ( int idx=0; idx<wll.size(); idx++ )
{
float val = wll.value( idx );
densities_SI += denunit ? denunit->internalValue(val) : val;
}
The above code suggests things are simple, and I think they indeed are.
If there is a unit label for the log, the UoMR() will try to find a
matching unit, you get a pointer to it and that's it.
/Bert
--
-- Bert Bril / OpendTect developer at dGB
-- Nijverheidstraat 11-2, 7511 JM Enschede, The Netherlands
-- mailto:Bert.Bril at opendtect.org , http://opendtect.org
-- Tel: +31 534315155 , Fax: +31 534315104
More information about the Developers
mailing list