Skip to content

Commit a9a53b9

Browse files
committed
Merge branch 'main' of github.com:UW-Macrostrat/macrostrat
2 parents 32147e8 + a9f7fca commit a9a53b9

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

py-modules/map-integration/macrostrat/map_integration/__init__.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ def cmd_download_dir(
495495
console.print(f"[green] Download successful![/green]")
496496
console.print(json.dumps(res, indent=2))
497497

498+
498499
@staging_cli.command("convert-e00")
499500
def convert_e00_to_gpkg(
500501
data_path: str = Option(..., help="Directory containing .e00 files"),
@@ -537,8 +538,10 @@ def run(cmd):
537538

538539
# common args to make gpkg consistent
539540
common = [
540-
"-lco", "SPATIAL_INDEX=YES",
541-
"-lco", "GEOMETRY_NAME=geometry",
541+
"-lco",
542+
"SPATIAL_INDEX=YES",
543+
"-lco",
544+
"GEOMETRY_NAME=geometry",
542545
]
543546
if a_srs:
544547
common += ["-a_srs", a_srs]
@@ -556,13 +559,17 @@ def ogr2ogr_write(src_e00: Path, src_layer: str, dst_layer: str):
556559
str(out_gpkg),
557560
str(src_e00),
558561
src_layer,
559-
"-nln", dst_layer,
560-
"-nlt", "PROMOTE_TO_MULTI",
562+
"-nln",
563+
dst_layer,
564+
"-nlt",
565+
"PROMOTE_TO_MULTI",
561566
] + common
562567

563568
rc, out, err = run(cmd)
564569
if rc != 0:
565-
print(f"[ERROR] ogr2ogr failed for {src_e00.name}:{src_layer} -> {dst_layer}")
570+
print(
571+
f"[ERROR] ogr2ogr failed for {src_e00.name}:{src_layer} -> {dst_layer}"
572+
)
566573
print(err.strip() or out.strip())
567574
return False
568575

@@ -589,15 +596,20 @@ def ogr2ogr_write(src_e00: Path, src_layer: str, dst_layer: str):
589596
print(f"{f.name}: layers={sorted(layers)}")
590597

591598
if not created:
592-
raise RuntimeError("No layers were successfully written; output gpkg not created.")
599+
raise RuntimeError(
600+
"No layers were successfully written; output gpkg not created."
601+
)
593602

594603
# sanity check: can GDAL read it?
595-
p = subprocess.run(["ogrinfo", "-ro", "-so", str(out_gpkg)], capture_output=True, text=True)
604+
p = subprocess.run(
605+
["ogrinfo", "-ro", "-so", str(out_gpkg)], capture_output=True, text=True
606+
)
596607
if p.returncode != 0:
597608
raise RuntimeError(f"Created file but ogrinfo cannot read it:\n{p.stderr}")
598609

599610
print(f"Done: {out_gpkg}")
600611

612+
601613
# ----------------------------------------------------------------------------------------------------------------------
602614

603615

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,12 @@ def ingest_map(
367367
)
368368

369369
conn = db.engine.connect()
370-
370+
371371
if len(df) == 0:
372372
console.print(f"[yellow]Skipping {feature_suffix}: 0 features[/yellow]")
373373
continue
374374
df["geometry"] = df["geometry"].apply(strip_z)
375-
df = df.dropna(axis=1, how='all')
375+
df = df.dropna(axis=1, how="all")
376376

377377
for i, chunk in enumerate(chunker(df, chunksize)):
378378
chunk.to_postgis(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def get_minio_client():
3535
secure=True,
3636
)
3737

38+
3839
def make_zip_for_data_path(*, slug: str, data_path: Path) -> Path:
3940
tmp_dir = Path(tempfile.gettempdir()) / "macrostrat_upload_zips"
4041
tmp_dir.mkdir(parents=True, exist_ok=True)
@@ -262,7 +263,6 @@ def staging_upload_dir(
262263
pass
263264

264265

265-
266266
# --------------------DELETIONS-------------------
267267
def confirm_delete(count: int) -> bool:
268268
resp = (

0 commit comments

Comments
 (0)