Skip to content

Commit 126d3da

Browse files
committed
fixed .gpkg pipeline
1 parent 7799f8a commit 126d3da

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

py-modules/map-integration/macrostrat/map_integration/commands/ingest.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,15 @@ def preprocess_dataframe(
7575
meta_df = P.read_excel(meta_path)
7676
# TODO xls pipeline for if feature_suffix == "polygons", "lines" OR "points"
7777
elif pipeline == ".gpkg":
78-
meta_df = map_t_b_standard(poly_line_pt_df, "epoch", "period")
7978
ingest_pipeline = ".gpkg pipeline"
8079
state = "needs review"
8180
comments = ""
82-
return meta_df, ingest_pipeline, comments, state
81+
if feature_suffix == "polygons":
82+
meta_df = map_t_b_standard(poly_line_pt_df, "epoch", "period")
83+
return meta_df, ingest_pipeline, comments, state
84+
else:
85+
return poly_line_pt_df, ingest_pipeline, comments, state
86+
8387
elif pipeline == ".gdb":
8488
if feature_suffix == "polygons":
8589
join_col = "mapunit"

py-modules/map-integration/macrostrat/map_integration/utils/ingestion_utils.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,20 @@ def map_t_b_standard(meta_df: G.GeoDataFrame, col_one: str, col_two: str) -> G.G
147147
meta_df.loc[needs_fill, "b_interval"] = mapped_col_two
148148
meta_df.loc[needs_fill, "t_interval"] = mapped_col_two
149149

150+
if "era" in meta_df.columns:
151+
needs_fill = meta_df["b_interval"].isna() | meta_df["t_interval"].isna()
152+
if needs_fill.any():
153+
mapped_col_three = (
154+
meta_df.loc[needs_fill, "era"]
155+
.astype("string")
156+
.str.strip()
157+
.str.lower()
158+
.replace("", pd.NA)
159+
.map(interval_lookup)
160+
)
161+
meta_df.loc[needs_fill, "b_interval"] = mapped_col_three
162+
meta_df.loc[needs_fill, "t_interval"] = mapped_col_three
163+
150164
return meta_df
151165

152166

0 commit comments

Comments
 (0)