From 580ed05b8d753c408d3e99e194efe8788480c4cc Mon Sep 17 00:00:00 2001 From: akrherz Date: Wed, 6 Nov 2024 12:55:34 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Workarounds=20needed=20for=20sce?= =?UTF-8?q?nario=20170?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/import/flowpath_importer.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/import/flowpath_importer.py b/scripts/import/flowpath_importer.py index 66f4ae0b..680ab409 100644 --- a/scripts/import/flowpath_importer.py +++ b/scripts/import/flowpath_importer.py @@ -37,6 +37,7 @@ MAX_POINTS_OFE = 97 GENLU_CODES = {} PROCESSING_COUNTS = { + "flowpaths_found": 0, "flowpaths_good": 0, "flowpaths_deduped": 0, "flowpaths_tooshort": 0, @@ -103,6 +104,8 @@ def get_data(filename): if HUC12RE.match(col): huc12 = col[len(PREFIX) : (len(PREFIX) + 12)] break + # Count up unique flowpaths + PROCESSING_COUNTS["flowpaths_found"] += len(df[f"fp{huc12}"].unique()) if "irrigated" not in df.columns: LOG.info("%s had no irrigated column", filename) @@ -134,6 +137,11 @@ def get_data(filename): fld_df = gpd.read_file(fldfn, engine="pyogrio").drop( columns=["OBJECTID"], ) + if "CropRotatn" in fld_df.columns: + LOG.info("Field_df renaming CropRotatn to CropRotatn_CY_2022") + fld_df = fld_df.rename( + columns={"CropRotatn": "CropRotatn_CY_2022"} + ) fld_df.index = fld_df["FBndID"].str.split("_").str[1].astype(int) # Placeholder for capturing database insert fld_df["field_id"] = -1