def test_get_faciesfraction_some_wells(testpath, tmp_path):
    """Import some wells and get the facies fractions per zone, for
    wells < 70 degrees inclination.
    """

    wlist = [
        Well(wpath, zonelogname="Zonelog")
        for wpath in glob.glob(str(testpath / WFILES2))
    ]

    mypoints = Points()
    facname = "Facies"
    fcode = [1]

    mypoints.dfrac_from_wells(wlist,
                              facname,
                              fcode,
                              zonelist=None,
                              incl_limit=70)

    # rename column
    mypoints.zname = "FACFRAC"

    myquery = 'WELLNAME == "OP_1" and ZONE == 1'
    usedf = mypoints.dataframe.query(myquery)

    assert abs(usedf[mypoints.zname].values[0] - 0.86957) < 0.001

    mypoints.to_file(
        tmp_path / "ffrac_per_zone.rmsasc",
        fformat="rms_attr",
        attributes=["WELLNAME", "ZONE"],
        pfilter={"ZONE": [1]},
    )
def test_get_faciesfraction_some_wells():
    """Import some wells and get the facies fractions per zone, for
    wells < 70 degrees inclination.
    """

    wlist = []
    for w in sorted(glob.glob(str(WFILES2))):
        wlist.append(Well(w, zonelogname="Zonelog"))
        logger.info("Imported well {}".format(w))

    mypoints = Points()
    facname = "Facies"
    fcode = [1]

    nwell = mypoints.dfrac_from_wells(
        wlist, facname, fcode, zonelist=None, incl_limit=70
    )

    # rename column
    mypoints.zname = "FACFRAC"

    logger.info("Number of wells is %s, DATAFRAME:\n, %s", nwell, mypoints.dataframe)

    myquery = 'WELLNAME == "OP_1" and ZONE == 1'
    usedf = mypoints.dataframe.query(myquery)

    assert abs(usedf[mypoints.zname].values[0] - 0.86957) < 0.001

    mypoints.to_file(
        "TMP/ffrac_per_zone.rmsasc",
        fformat="rms_attr",
        attributes=["WELLNAME", "ZONE"],
        pfilter={"ZONE": [1]},
    )
def test_get_faciesfraction_some_wells():
    """Import some wells and get the facies fractions per zone, for
    wells < 70 degrees inclination.
    """

    wlist = []
    for w in sorted(glob.glob(wfiles2)):
        wlist.append(Well(w, zonelogname='Zonelog'))
        logger.info('Imported well {}'.format(w))

    mypoints = Points()
    facname = 'Facies'
    fcode = [1]

    nwell = mypoints.dfrac_from_wells(wlist,
                                      facname,
                                      fcode,
                                      zonelist=None,
                                      incl_limit=70)

    # rename column
    mypoints.zname = 'FACFRAC'

    logger.info('Number of wells is %s, DATAFRAME:\n, %s', nwell,
                mypoints.dataframe)

    myquery = 'WELLNAME == "OP_1" and ZONE == 1'
    usedf = mypoints.dataframe.query(myquery)

    assert abs(usedf[mypoints.zname].values[0] - 0.86957) < 0.001

    mypoints.to_file('TMP/ffrac_per_zone.rmsasc',
                     fformat='rms_attr',
                     attributes=['WELLNAME', 'ZONE'],
                     pfilter={'ZONE': [1]})