Пример #1
0
def test_frac_recovered_exception():
    full_oil = get_full_oil()

    full_oil.metadata.product_type = "Condensate"
    full_oil.sub_samples[0].distillation_data.fraction_recovered.value = 5
    with pytest.raises(ValueError):
        data = make_gnome_oil(full_oil)
Пример #2
0
def test_metadata():
    """
    does it get the basic metadata right?
    """
    data = make_gnome_oil(FullOil)

    # print(FullOil.metadata)

    assert data['name'] == FullOil.metadata.name
    # The API might change
    # assert data['api'] == FullOil.metadata.API
    assert data['adios_oil_id'] == "EC02234"
Пример #3
0
def test_no_cuts_exception():
    sparse_oil = get_sparse_oil()

    sparse_oil.metadata.product_type = "Condensate"
    with pytest.raises(ValueError):
        data = make_gnome_oil(sparse_oil)
Пример #4
0
def test_max_water_emulsion_estimated():
    data = make_gnome_oil(SparseOil)

    assert isclose(data['emulsion_water_fraction_max'], 0.843579, rel_tol=1e-4)
Пример #5
0
def test_max_water_emulsion():
    data = make_gnome_oil(FullOil)

    assert data['emulsion_water_fraction_max'] == 0.39787
Пример #6
0
def test_kvis():
    data = make_gnome_oil(FullOil)

    assert list(data['kvis']) == [0.0013831552964208198, 0.0003782720532607051]
    assert list(data['kvis_ref_temps']) == [273.15, 288.15]
    assert list(data['kvis_weathering']) == [0.0, 0.0]
Пример #7
0
def test_densities():
    data = make_gnome_oil(FullOil)

    assert list(data['densities']) == [939.88, 925.26]
    assert list(data['density_ref_temps']) == [273.15, 288.15]
    assert list(data['density_weathering']) == [0.0, 0.0]
Пример #8
0
def test_physical_properties():
    data = make_gnome_oil(FullOil)

    assert isclose(data['pour_point'], 248.15)
Пример #9
0
def test_solubility():
    data = make_gnome_oil(FullOil)

    assert data['solubility'] == 0
#!/usr/bin/env python
"""
script to see which oils are suitable for gnome
"""

import sys

import adios_db.scripting as dbs
from adios_db.computation.gnome_oil import make_gnome_oil

data_dir = sys.argv[1]

#outfile = open("gnome_oil_info.csv", 'w', encoding="utf-8")
#outfile.write('Name, ID, "Product Type"\n')

# Make gnome_oil from all of the records
for oil, path in dbs.get_all_records(data_dir):
    print(oil.metadata.name)
    fresh = oil.sub_samples[0]
    try:
        go = make_gnome_oil(oil)
    except Exception as err:
        print("failed to make gnome oil ", err, oil.metadata.name, oil.oil_id,
              oil.metadata.product_type)

    #outfile.write(f'"{oil.metadata.name}", {oil.oil_id}, {len(kvis)}, {len(dvis)}\n')