Search code examples
oceanpetrel

Get the curret unit system in Petrel


I'm currently working on a plug-in in which I need to get the current unit system in petrel(i.e is in field or in metric system). How to get it?


Solution

  • To get the invariant unit (the unit data is stored in):

    var invUnit = PetrelUnitSystem.GetInvariantUnit(someTemplate);
    

    To get the unit the system/project is currently using:

    var dispUnit = PetrelUnitSystem.GetDisplayUnit(someTemplate);
    

    A converter to convert between them.

    var convInvDisp = PetrelUnitSystem.GetConverter(invUnit, dispUnit);
    
    var fahrenheit=convInvDisp.Convert(100);