コード例 #1
0
def CallFilterWellsByArea():
    """Interface Package Description"""
    interface = {"CorpIDList": list, "Area": str}

    pkg, success, msg = InitializePayload(request, interface)

    ret_well_list = []
    if success:
        CorpIDList = pkg['CorpIDList']
        Area = pkg['Area']

        AreaObj = m.AreaAggregation('', [Area], [], [])
        rows, success, msg = AreaObj.ReadTable()

        #Create area_well_list
        area_well_list = []
        for row in rows:
            area_well_list.append(row.CorpID)

        for corpID in CorpIDList:
            if corpID in area_well_list:
                ret_well_list.append(corpID)

    output = ConfigureOutput(ret_well_list, success, msg)
    return output
コード例 #2
0
def GetFullWellList(well_list):
    from Model import ModelLayer as m
    import pandas as pd

    #Check each item to see if an entry exists as an Area table and return a complete list
    new_list = []
    for well in well_list:
        AreaObj = m.AreaAggregation('', [well], [], [])
        Rows, Success, Message = AreaObj.ReadTable()
        if len(Rows) > 0:
            Rows = pd.DataFrame([vars(s) for s in Rows])
            new_wells = Rows['CorpID'].unique()
            if len(list(new_wells)) == 0:
                print('No wells in Area: ' + well)
            new_list.extend(list(new_wells))
        else:
            new_list.append(well)

    return new_list
コード例 #3
0
def CallGetAreaDetails():
    """Interface Package Description"""
    interface = {"AggregateName": str, "WellNames": list, "CorpIDs": list}

    pkg, success, msg = InitializePayload(request, interface)

    rows = []
    if success:
        AggregateName = pkg['AggregateName']
        WellNames = pkg['WellNames']
        CorpIDs = pkg['CorpIDs']

        AggregateObj = m.AreaAggregation('', [AggregateName], WellNames,
                                         CorpIDs)
        rows, success, msg = AggregateObj.ReadTable()

    output = ConfigureOutput(rows, success, msg)

    return output
コード例 #4
0
def CallDeleteArea():
    """Interface Package Description"""
    interface = {"AreaName": str, "WellList": list}

    pkg, success, msg = InitializePayload(request, interface)

    if success:
        AreaName = pkg['AreaName']
        WellList = pkg['WellList']
        AreaRowsObj = m.AreaAggregation('', [AreaName], WellList, [])
        rows, success, msg = AreaRowsObj.ReadTable()
        for row in rows:
            success, msg = row.Delete()

        if success:
            DBObj = row.DBObj
            DBObj.Command('commit')

    output = ConfigureOutput('', success, msg)
    return output