From f3f54383e6c5c042d4c7744d27254f1f3e5cbff0 Mon Sep 17 00:00:00 2001 From: Roy Thomson Date: Tue, 28 Nov 2023 11:22:47 +1100 Subject: [PATCH] bug: #113 Deal with case when no objectids are valid in geology file --- map2loop/m2l_map_checker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/map2loop/m2l_map_checker.py b/map2loop/m2l_map_checker.py index 0c8138a..81f4400 100644 --- a/map2loop/m2l_map_checker.py +++ b/map2loop/m2l_map_checker.py @@ -452,7 +452,10 @@ def check_geology_map( vals = geology[ geology[c_l["o"]].astype(str).str.replace(".", "", 1).str.isdigit() ][c_l["o"]].astype(int) - next_index = int(np.nanmax(vals)) + 1 + if len(vals): + next_index = int(np.nanmax(vals)) + 1 + else: + next_index = 0 for ind, layer in geology.iterrows(): if pd.isna(layer[c_l["o"]]): geology.loc[ind, c_l["o"]] = next_index