From 653f28760997c7346b9669573b7f27dacd657760 Mon Sep 17 00:00:00 2001 From: John Evans Date: Fri, 16 Feb 2024 09:51:58 -0700 Subject: [PATCH] fixed a few logging bugs --- default_config/transform_ecmc.yaml | 2 -- oip_ecmc_app/convert_access_to_parquet.py | 6 +++--- oip_ecmc_app/scrape_from_ecmc.py | 1 - oip_ecmc_app/transform_ecmc.py | 4 +--- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/default_config/transform_ecmc.yaml b/default_config/transform_ecmc.yaml index a4ba051..56e6f2c 100644 --- a/default_config/transform_ecmc.yaml +++ b/default_config/transform_ecmc.yaml @@ -22,8 +22,6 @@ production_columns_to_keep: - oil_prod - water_prod completions_columns_to_keep: - - name - - operator_num - facility_name - facility_num - well_name diff --git a/oip_ecmc_app/convert_access_to_parquet.py b/oip_ecmc_app/convert_access_to_parquet.py index 774e4c1..84f403f 100644 --- a/oip_ecmc_app/convert_access_to_parquet.py +++ b/oip_ecmc_app/convert_access_to_parquet.py @@ -106,8 +106,7 @@ def main() -> None: with parquet_metadata_path.open('w') as f: json.dump(utils.to_json(parquet_metadata, logger=logger), f) - driver = get_access_driver( - config.Config.microsoft_access_driver, logger) + driver = get_access_driver(config.Config.microsoft_access_driver) data = mdb_import(access_db_metadata, logger, driver=driver) write_parquet(parquet_path, data, logger) @@ -124,7 +123,8 @@ def read_odbc_table( ) -> pl.DataFrame: logger.info(f'loading data from {table} in {connection[ODBCKey.dbq]}') query = f'SELECT * FROM \"{table}\"' - return pl.read_database(query, connection=odbc_connection_str(connection)) + return pl.read_database( + query, connection=odbc_connection_str(connection, logger)) def get_parquet_metadata( diff --git a/oip_ecmc_app/scrape_from_ecmc.py b/oip_ecmc_app/scrape_from_ecmc.py index 12f6788..8f407ce 100644 --- a/oip_ecmc_app/scrape_from_ecmc.py +++ b/oip_ecmc_app/scrape_from_ecmc.py @@ -100,7 +100,6 @@ def main() -> None: utils.to_json( get_db_metadata(access_db_path, zip_metadata, logger)), f, - logger=logger, ) diff --git a/oip_ecmc_app/transform_ecmc.py b/oip_ecmc_app/transform_ecmc.py index 604ae35..fdeed54 100644 --- a/oip_ecmc_app/transform_ecmc.py +++ b/oip_ecmc_app/transform_ecmc.py @@ -55,8 +55,6 @@ class Config: 'water_prod', ] completions_columns_to_keep: List[str] = [ - 'name', - 'operator_num', 'facility_name', 'facility_num', 'well_name', @@ -165,7 +163,7 @@ def write_output_data( data['completions'][max(data['completions'])], on='API_num', how='outer', - ).select(pl.exclude('^.*_right$')) + ) if remove_co2_wells: df_out = df_out.filter(pl.col('Prod_days') != 0) df_out.write_csv(output_path / f'{year}.csv')