adios_db.models.oil.cleanup package

cleanup modules

all cleanup classes are registered here

so far:
  • compute density from API

possible things to cleanup:

  • normalizing units for various things

  • putting distillation cuts in order

Submodules

adios_db.models.oil.cleanup.add_labels module

Add labels to a record – for those that we can use some automatic criteria for

For a given product type:

some labels can be determined from API and/or Viscosity ranges.

The criteria follows the ASTM (and others) standards, where we can find them.

adios_db.models.oil.cleanup.add_labels.add_labels_to_oil(oil)

add labels to the passed in oil.

this adds labels, but does not remove any existing ones

Parameters:

oil (Oil object) – the oil object to add labels to

adios_db.models.oil.cleanup.add_labels.get_suggested_labels(oil)

get the labels suggested for this oil

Parameters:

oil (Oil object) – the oil object to get the labels for

Returns:

sorted list of all labels that match the criteria

adios_db.models.oil.cleanup.add_labels.get_sulfur_labels(oil)

the low sulfur labels are their own thing

adios_db.models.oil.cleanup.add_labels.is_label(oil, label)

adios_db.models.oil.cleanup.cleanup module

classes for options to clean up Records

class adios_db.models.oil.cleanup.cleanup.Cleanup(oil)

Bases: object

ID = None
cleanup(oil, do_it=False)

run this particular cleanup option

Parameters:
  • oil – an Oil object to act on

  • do_it=False – flag to tell the cleanup to do its thing. If False, the method returns a message. If True, the action is taken, and the Oil object is altered.

Returns:

a message of what could be done, or what was done.

adios_db.models.oil.cleanup.density module

cleanups that work with density

class adios_db.models.oil.cleanup.density.FixAPI(oil)

Bases: Cleanup

adds (or replaces) the API value, from the density measurements

ID = '001'
check()

checks to see if there is something to fix

returns: flag, msg

if nothing is needed, flag is None if something can be cleaned up, flag is True if something is wrong, but can not be cleaned up, flag is False

fixme: – maybe cleanup and validation should be better integrated?

check_for_valid_api()

Check is the API value is already valid

cleanup()

run this particular cleanup option

Parameters:

oil – an Oil object to act on

# :param do_it=False: flag to tell the cleanup to do its thing. # If False, the method returns a message. If True, # the action is taken, and the Oil object is altered.

Returns:

a message of what could be done, or what was done.

find_density_at_60F()

Returns the density (in kg/m3)

It will interpolate and extrapolate as needed

adios_db.models.oil.cleanup.distillation module

cleanups that work with distillation data

There could be more, but for now, it sets the unit_type for the cuts.

class adios_db.models.oil.cleanup.distillation.FixCutUnitType(oil)

Bases: Cleanup

sets the unit type for the cut fractions, based on the distillation type

ID = '002'
check()

checks to see if there is something to fix

returns: flag, msg

if nothing is needed, flag is None if something can be cleaned up, flag is True if something is wrong, but can not be cleaned up, flag is False

fixme: – maybe cleanup and validation should be better integrated?

cleanup()

run this particular cleanup option

mapping = {'mass fraction': 'massfraction', 'volume fraction': 'volumefraction', None: 'concentration'}

adios_db.models.oil.cleanup.metadata module