02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Template Catalog<br />

Unit Conversion<br />

PetrelUnitSystem has methods to convert Petrel UI data values to the current storage<br />

unit system. The methods may use templates or unit measurements to perform the<br />

conversion. The <strong>Ocean</strong> API expects all data that is given to it, such as data for a created<br />

well log, to to be in storage units. The <strong>Ocean</strong> API returns all data in storage units. It is the<br />

developer’s responsibility to do any unit conversion necessary to display the data in the UI<br />

unit system. The unit conversion methods help simplify this task.<br />

...<br />

double dval_UI = ...;<br />

float fval_UI = ...;<br />

// Find the template for the density log<br />

Itemplate DensityTemplate =<br />

PetrelUnitSystem.TemplateGroupLogTypes.Density;<br />

// Convert from UI to storage unit system using the template.<br />

double dval = PetrelUnitSystem.ConvertFromUI(DensityTemplate,<br />

dval_UI);<br />

float fval = PetrelUnitSystem.ConvertFromUI(DensityTemplate,<br />

fval_UI);<br />

// Get the unit measurement for our template.<br />

IUnitMeasurement um = DensityTemplate.UnitMeasurement;<br />

// Convert from UI to storage unit system using unit measurement<br />

dval = PetrelUnitSystem.ConvertFromUI(um, dval_UI);<br />

fval = PetrelUnitSystem.ConvertFromUI(um, fval_UI);<br />

...<br />

5-258 <strong>Ocean</strong> Application Development Framework 2008.1<br />

<strong>Schlumberger</strong> Private

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!