Skip to content
Snippets Groups Projects
Commit 5a31c784 authored by Rudolf, Michael's avatar Rudolf, Michael
Browse files

Fixes #116

parent 3f56dc18
No related branches found
No related tags found
No related merge requests found
...@@ -5,12 +5,12 @@ requirements of the HLNUG. ...@@ -5,12 +5,12 @@ requirements of the HLNUG.
import os import os
import numpy as np
import docx import docx
import docx.parts import docx.parts
import docx.shared import docx.shared
import geopandas as gp import geopandas as gp
import humanize import humanize
import numpy as np
import uncertainties as unc import uncertainties as unc
from docx.document import Document from docx.document import Document
from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.enum.text import WD_ALIGN_PARAGRAPH
...@@ -115,7 +115,17 @@ def site_report( ...@@ -115,7 +115,17 @@ def site_report(
document = soils(img_path, img_fmt, document) document = soils(img_path, img_fmt, document)
FIGURENUM = 1 FIGURENUM = 1
# Save to docx file # Save to docx file
document.save(os.path.join(output_path_docx, f"{group:05}_info.docx")) mapnums = eval(row[1].geology_mapnum)
if mapnums:
docx_path = (
os.path.join(output_path_docx, f"{str(mapnums)}_{group:05}.docx")
.replace("[", "")
.replace("]", "")
.replace(", ", "_")
)
else:
docx_path = os.path.join(output_path_docx, f"XXXX_{group:05}.docx")
document.save(docx_path)
def location(series: gp.GeoSeries, document: Document) -> Document: def location(series: gp.GeoSeries, document: Document) -> Document:
...@@ -204,10 +214,7 @@ def hlnug_description( ...@@ -204,10 +214,7 @@ def hlnug_description(
if isinstance(mapnum, list): if isinstance(mapnum, list):
mapname = eval(row["geology_mapname"]) mapname = eval(row["geology_mapname"])
map_list = [ map_list = [
f"{mpnum} {mpname}" f"{mpnum} {mpname}" for mpnum, mpname in zip(mapnum, mapname)
for mpnum, mpname in zip(
mapnum, mapname
)
] ]
mapnum_string = u4human.listed_strings(map_list) mapnum_string = u4human.listed_strings(map_list)
prgph.add_run(f"auf den Kartenblättern {mapnum_string}. ") prgph.add_run(f"auf den Kartenblättern {mapnum_string}. ")
...@@ -310,7 +317,9 @@ def hlnug_description( ...@@ -310,7 +317,9 @@ def hlnug_description(
else: else:
prgph.add_run("eine nicht benannte Landstraße. ") prgph.add_run("eine nicht benannte Landstraße. ")
else: else:
prgph.add_run("Im Umkreis von 1\u00a0km sind keine größeren Straßen vorhanden. ") prgph.add_run(
"Im Umkreis von 1\u00a0km sind keine größeren Straßen vorhanden. "
)
if row["railways_has"]: if row["railways_has"]:
prgph.add_run( prgph.add_run(
...@@ -319,7 +328,8 @@ def hlnug_description( ...@@ -319,7 +328,8 @@ def hlnug_description(
) )
elif row["railways_close"]: elif row["railways_close"]:
prgph.add_run( prgph.add_run(
f"Eine Bahnlinie liegt ca. {int(row['railways_length'])}\u00a0m " + "entfernt vom Mittelpunkt der Rutschung. " f"Eine Bahnlinie liegt ca. {int(row['railways_length'])}\u00a0m "
+ "entfernt vom Mittelpunkt der Rutschung. "
) )
# Add drill sites # Add drill sites
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment