I want to export a well log from a Slb.Ocean.Petrel.DomainObject.Well.WellLog
to an external file, but the the measured depth I get is in meters even if the project is set up to use feet.
I can convert the well log samples with the converter I get from:
var converter = PetrelUnitSystem.GetConverterToUI(wellLog.WellLogVersion.UnitMeasurement);
How do I get a converter for the measured depth?
Hallgrim,
You can get a converter from the invariant Ocean unit to the Petrel display unit:
IUnitConverter convertToDisplayMD = PetrelUnitSystem.GetConverterToUI(Domain.MD);
Here is an example using it:
double valueToConvert = 3;
IUnit displayMD = PetrelUnitSystem.GetDisplayUnit(Domain.MD.Template);
IUnit oceanMD = PetrelUnitSystem.GetInvariantUnit(Domain.MD.Template);
PetrelLogger.InfoOutputWindow("converting " + valueToConvert.ToString() +
" from: the Ocean unit for measured depth " + oceanMD.Symbol +
" to: " + displayMD.Symbol + " = " + convertToDisplayMD.Convert(valueToConvert));
The output in the Petrel Message log will be:
"converting 3 from: the Ocean unit for measured depth m to: ft = 9.84251968503937"
, for a project having measured depth in feet.