Exemplo n.º 1
0
        async def sync_all():
            if not db.is_bound():
                await db.startup()

            loggers.config(level=20)

            for hole_direction in [HoleDirection.V]:
                if hole_direction == HoleDirection.H:
                    ids_path = IHSPath.well_h_ids
                else:
                    ids_path = IHSPath.well_v_ids

                areas = await IHSClient.get_areas(path=ids_path)
                areas = ["tx-upton", "tx-reagan", "tx-midland"]

                counts = []
                datasets = []

                batch_size = 100
                for area in areas:
                    logger.warning(f"running area: {area}")
                    api14s = await IHSClient.get_ids_by_area(path=ids_path,
                                                             area=area)

                    for chunk in util.chunks(api14s, n=batch_size):
                        for executor in [
                                WellExecutor, GeomExecutor, ProdExecutor
                        ]:
                            try:
                                count, dataset = executor(hole_direction).run(
                                    api14s=chunk)
                                counts.append(count)
                                datasets.append(dataset)
                            except Exception as e:
                                print(e)
Exemplo n.º 2
0
 async def test_driftwood_production():
     if not db.is_bound():
         await db.startup()
     pexec = ProdExecutor(HoleDirection.H)
     ds: DataSet = await pexec.download(api14s=deo_api14h)
     ps: ProdSet = await pexec.process(ds)
     await pexec.persist(ps)
Exemplo n.º 3
0
 async def test_driftwood_horizontals():
     if not db.is_bound():
         await db.startup()
     wexec = WellExecutor(HoleDirection.H)
     wellset = await wexec.download(api14s=deo_api14h)
     wellset_processed = await wexec.process(wellset)
     await wexec.persist(wellset_processed)
Exemplo n.º 4
0
 async def test_driftwood_geoms():
     if not db.is_bound():
         await db.startup()
     pexec = GeomExecutor(HoleDirection.H)
     ds: WellGeometrySet = await pexec.download(api14s=deo_api14h)
     # ds: WellGeometrySet = await pexec.download(api14s=["42461412110000"])
     ps: WellGeometrySet = await pexec.process(ds)
     await pexec.persist(ps)
Exemplo n.º 5
0
 async def test_well_vertical():
     if not db.is_bound():
         await db.startup()
     wexec = WellExecutor(HoleDirection.V)
     # results, errors = wexec.run_sync(api14s=api14s)
     api14s = await IHSClient.get_ids_by_area(path=IHSPath.well_v_ids,
                                              area="tx-upton")
     api14s = api14s[:25]
     wellset = await wexec.download(api14s=api14s)
     wellset_processed = await wexec.process(wellset)
     await wexec.persist(wellset_processed)
Exemplo n.º 6
0
 async def test_well_horizontals():
     if not db.is_bound():
         await db.startup()
     wexec = WellExecutor(HoleDirection.H)
     # results, errors = wexec.run_sync(api14s=api14s)
     api14s = await IHSClient.get_ids_by_area(path=IHSPath.well_h_ids,
                                              area="tx-upton")
     api14s = api14s[:100]
     ws = await wexec.download(api14s=api14s)
     # ws = await wexec.download(api10s=api10s)
     wsproc = await wexec.process(ws)
     await wexec.persist(wsproc)
Exemplo n.º 7
0
        async def test_geom_tiny_batch():
            if not db.is_bound():
                await db.startup()
            pexec = GeomExecutor(HoleDirection.H)

            for api14 in deo_api14h:
                try:
                    ds: WellGeometrySet = await pexec.download(api14s=[api14])
                    ps: WellGeometrySet = await pexec.process(ds)
                    await pexec.persist(ps)
                except Exception:
                    pass
Exemplo n.º 8
0
        async def test_well_vertical_tiny_batch():
            if not db.is_bound():
                await db.startup()
            wexec = WellExecutor(HoleDirection.V)

            wellsets = []
            for api14 in deo_api14v:
                try:
                    # api14 = "42461411280000"
                    wellset = await wexec.download(api14s=[api14])
                    wellset_processed = await wexec.process(wellset)
                    await wexec.persist(wellset_processed)
                except Exception:
                    wellsets.append(wellset_processed)
Exemplo n.º 9
0
        async def test_production_horizontal():
            if not db.is_bound():
                await db.startup()

            hole_dir = HoleDirection.H
            id_path = IHSPath.prod_h_ids

            pexec = ProdExecutor(hole_dir)
            entities = await IHSClient.get_ids_by_area(path=id_path,
                                                       area="tx-upton")
            entities = entities[:25]
            # entity12s = [x[:12] for x in entities]
            ds: DataSet = await pexec.download(entities=entities)
            ps: ProdSet = await pexec.process(ds)
            await pexec.persist(ps)
Exemplo n.º 10
0
        async def test_production_vertical():
            if not db.is_bound():
                await db.startup()

            api14s = await IHSClient.get_ids_by_area(path=IHSPath.well_v_ids,
                                                     area="tx-upton")
            api14s = api14s[:5]

            pexec = ProdExecutor(HoleDirection.V)
            entities = await IHSClient.get_ids_by_area(path=IHSPath.prod_v_ids,
                                                       area="tx-upton")
            entities = entities[:10]
            ds: DataSet = await pexec.download(api14s=api14s)
            ps: ProdSet = await pexec.process(ds)
            await pexec.persist(ps)
Exemplo n.º 11
0
    async def coro():
        from db import db

        if not db.is_bound():
            await db.startup()

        load_cols = (WellDepth.api14, WellDepth.name, WellDepth.value)
        md_tvd_from_db = (await WellDepth.query.where(
            WellDepth.api14.in_(api14s)
            & WellDepth.name.in_(["md", "tvd"])).gino.load(load_cols).all())

        md_tvd_from_db = pd.DataFrame.from_records(md_tvd_from_db).pivot(
            index=0, columns=1)
        md_tvd_from_db.columns = md_tvd_from_db.columns.droplevel(0)
        md_tvd_from_db.index.name = "api14"
        md_tvd_from_db.columns.name = ""
        md_tvd_from_db
Exemplo n.º 12
0
    async def async_wrapper():
        if not db.is_bound():
            await db.startup()

        async def test_well_horizontal_tiny_batch():
            if not db.is_bound():
                await db.startup()
            wexec = WellExecutor(HoleDirection.H)

            wellsets = []
            for api14 in deo_api14h:
                try:
                    # api14 = "42461411280000"
                    wellset = await wexec.download(api14s=[api14])
                    wellset_processed = await wexec.process(wellset)
                    await wexec.persist(wellset_processed)
                except Exception:
                    wellsets.append(wellset_processed)

        async def test_well_vertical_tiny_batch():
            if not db.is_bound():
                await db.startup()
            wexec = WellExecutor(HoleDirection.V)

            wellsets = []
            for api14 in deo_api14v:
                try:
                    # api14 = "42461411280000"
                    wellset = await wexec.download(api14s=[api14])
                    wellset_processed = await wexec.process(wellset)
                    await wexec.persist(wellset_processed)
                except Exception:
                    wellsets.append(wellset_processed)

        async def test_geom_tiny_batch():
            if not db.is_bound():
                await db.startup()
            pexec = GeomExecutor(HoleDirection.H)

            for api14 in deo_api14h:
                try:
                    ds: WellGeometrySet = await pexec.download(api14s=[api14])
                    ps: WellGeometrySet = await pexec.process(ds)
                    await pexec.persist(ps)
                except Exception:
                    pass

        async def test_driftwood_horizontals():
            if not db.is_bound():
                await db.startup()
            wexec = WellExecutor(HoleDirection.H)
            wellset = await wexec.download(api14s=deo_api14h)
            wellset_processed = await wexec.process(wellset)
            await wexec.persist(wellset_processed)

        async def test_driftwood_production():
            if not db.is_bound():
                await db.startup()
            pexec = ProdExecutor(HoleDirection.H)
            ds: DataSet = await pexec.download(api14s=deo_api14h)
            ps: ProdSet = await pexec.process(ds)
            await pexec.persist(ps)

        async def test_driftwood_geoms():
            if not db.is_bound():
                await db.startup()
            pexec = GeomExecutor(HoleDirection.H)
            ds: WellGeometrySet = await pexec.download(api14s=deo_api14h)
            # ds: WellGeometrySet = await pexec.download(api14s=["42461412110000"])
            ps: WellGeometrySet = await pexec.process(ds)
            await pexec.persist(ps)

        async def test_well_vertical():
            if not db.is_bound():
                await db.startup()
            wexec = WellExecutor(HoleDirection.V)
            # results, errors = wexec.run_sync(api14s=api14s)
            api14s = await IHSClient.get_ids_by_area(path=IHSPath.well_v_ids,
                                                     area="tx-upton")
            api14s = api14s[:25]
            wellset = await wexec.download(api14s=api14s)
            wellset_processed = await wexec.process(wellset)
            await wexec.persist(wellset_processed)

        async def test_production_vertical():
            if not db.is_bound():
                await db.startup()

            api14s = await IHSClient.get_ids_by_area(path=IHSPath.well_v_ids,
                                                     area="tx-upton")
            api14s = api14s[:5]

            pexec = ProdExecutor(HoleDirection.V)
            entities = await IHSClient.get_ids_by_area(path=IHSPath.prod_v_ids,
                                                       area="tx-upton")
            entities = entities[:10]
            ds: DataSet = await pexec.download(api14s=api14s)
            ps: ProdSet = await pexec.process(ds)
            await pexec.persist(ps)

        async def test_well_horizontals():
            if not db.is_bound():
                await db.startup()
            wexec = WellExecutor(HoleDirection.H)
            # results, errors = wexec.run_sync(api14s=api14s)
            api14s = await IHSClient.get_ids_by_area(path=IHSPath.well_h_ids,
                                                     area="tx-upton")
            api14s = api14s[:100]
            ws = await wexec.download(api14s=api14s)
            # ws = await wexec.download(api10s=api10s)
            wsproc = await wexec.process(ws)
            await wexec.persist(wsproc)

        async def test_production_horizontal():
            if not db.is_bound():
                await db.startup()

            hole_dir = HoleDirection.H
            id_path = IHSPath.prod_h_ids

            pexec = ProdExecutor(hole_dir)
            entities = await IHSClient.get_ids_by_area(path=id_path,
                                                       area="tx-upton")
            entities = entities[:25]
            # entity12s = [x[:12] for x in entities]
            ds: DataSet = await pexec.download(entities=entities)
            ps: ProdSet = await pexec.process(ds)
            await pexec.persist(ps)

        # async def test_wells_supplemental():
        #     wexec = WellExecutor(hole_direction)
        #     wellset = await wexec.download(api14s=api14s)
        #     geoms = await GeomExecutor(hole_direction).download(api14s=api14s)
        #     prod = await ProdExecutor(hole_direction).download(api14s=api14s)
        #     prod_headers = (
        #         prod.reset_index()
        #         .groupby("api14")
        #         .prod_date.max()
        #         .rename("last_prod_date")
        #         .to_frame()
        #     )
        #     wellset_processed = await wexec.process(
        #         wellset=wellset, geoms=geoms, prod_headers=prod_headers
        #     )
        #     await wexec.persist(wellset=wellset_processed)

        async def sync_all():
            if not db.is_bound():
                await db.startup()

            loggers.config(level=20)

            for hole_direction in [HoleDirection.V]:
                if hole_direction == HoleDirection.H:
                    ids_path = IHSPath.well_h_ids
                else:
                    ids_path = IHSPath.well_v_ids

                areas = await IHSClient.get_areas(path=ids_path)
                areas = ["tx-upton", "tx-reagan", "tx-midland"]

                counts = []
                datasets = []

                batch_size = 100
                for area in areas:
                    logger.warning(f"running area: {area}")
                    api14s = await IHSClient.get_ids_by_area(path=ids_path,
                                                             area=area)

                    for chunk in util.chunks(api14s, n=batch_size):
                        for executor in [
                                WellExecutor, GeomExecutor, ProdExecutor
                        ]:
                            try:
                                count, dataset = executor(hole_direction).run(
                                    api14s=chunk)
                                counts.append(count)
                                datasets.append(dataset)
                            except Exception as e:
                                print(e)