Skip to content

Commit 59e09a6

Browse files
EliEli
authored andcommitted
Better message over entirely missing data for a column.
1 parent 81105ff commit 59e09a6

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

schimpy/merge_th.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,15 @@ def merge_th(th_spec):
207207
colmissing = colmissing[colmissing > 0]
208208

209209
if colmissing.any():
210-
print("Missing data in columns:")
211-
print(colmissing)
210+
nrows = len(mdf)
211+
entirely_absent = colmissing[colmissing == nrows]
212+
has_gaps = colmissing[colmissing < nrows]
213+
if not entirely_absent.empty:
214+
print("Columns not found in any input data source (label mismatch?):")
215+
print(entirely_absent.index.tolist())
216+
if not has_gaps.empty:
217+
print("Columns found but with temporal gaps (missing values):")
218+
print(has_gaps)
212219
print(mdf.loc[mdf.isnull().any(axis=1), :])
213220
mdf.loc[mdf.isnull().any(axis=1), :].to_csv("missing.csv")
214221
raise ValueError(

schimpy/prepare_schism.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -826,10 +826,11 @@ def prepare_schism(args, use_logging=True):
826826

827827
# If mesh already loaded above, reuse it
828828
for bctides_out in bctides_items:
829-
logger.info(f"Processing bctides YAML: {bctides_out}")
830-
by = load_boundary(hgrid, bctides_items[bctides_out], None)
831-
# Output file name: use YAML path or key
832-
by.write_bctides(bctides_out)
829+
out_name = bctides_out["name"]
830+
logger.info(f"Processing bctides YAML: {out_name}")
831+
by = load_boundary(hgrid, bctides_out, None)
832+
out_path = ensure_outdir(inputs["prepro_output_dir"], out_name)
833+
by.write_bctides(out_path)
833834

834835

835836
if item_exist(inputs, "copy_resources"):

0 commit comments

Comments
 (0)