Skip to content

Fix TBDArray.write_df index handling; raise on Go-binary failure - #19

Merged
mikegottlieb84 merged 2 commits into
mainfrom
fix/write-df-time-index-and-binary-errors
Aug 6, 2026
Merged

Fix TBDArray.write_df index handling; raise on Go-binary failure#19
mikegottlieb84 merged 2 commits into
mainfrom
fix/write-df-time-index-and-binary-errors

Conversation

@frigusgulo

@frigusgulo frigusgulo commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

Upstreams two fixes that earthscope-sfg-workflows currently carries as monkey-patches/workarounds at the top of sv3_pipeline.py (see EarthScope/earthscope-sfg-workflows#23), plus follow-on hygiene:

  • TBDArray.write_df passed the DataFrame straight to tiledb.from_pandas, but from_pandas maps the sparse time dimension from the pandas index — a plain time column made every base-class write fail. It also referenced df_val when validate=False (NameError). write_df now promotes a time column to the index after pandera validation. The subclass overrides (TDBAcousticArray, TDBShotDataArray) are unchanged — neither has the unbound-variable bug and shotdata's dimensions don't use time.
  • Go-binary wrappers (nova2tile, novb2tile, nov0002tile, tdb2rnx) ran subprocess.run(check=False) and returned without checking the result, so failed conversions were silently treated as successes by any caller not inspecting returncode. They now raise RuntimeError on non-zero exit (stdout/stderr in the message), matching the existing GoBinaryRunner pattern in utils/go_runner.py. Success still returns the CompletedProcess — callers that already check returncode are unaffected.
  • pandas<3 bound: tiledb-py's dataframe layer (tiledb.from_pandas) rejects pandas >= 3, and pandas was unbounded — this repo's own envs resolved pandas 3.0.3, leaving every TileDB write path broken locally. Bounded and re-locked (pandas → 2.3.3), which also enabled a real TileDB round-trip test for write_df.
  • tiledb_integration.__all__ cleanup: five listed symbols were never defined anywhere (TileDBService, TileDBOperationResult, TileDBIntegrationError, TileDBBinaryExecutionError, GoBinaryTileDBBackend — leftovers of an abandoned service-layer refactor) and broke star-imports; dropped, with missing novb2tile/rinex_qc exports added.
  • Bumps the stale pyproject.toml version (0.1.0) to 0.2.1 — the 0.2.0 tag shipped while pyproject still said 0.1.0. Suggest tagging 0.2.1 on the merge commit so consumers can pin it.

Test plan

  • New tests/test_tiledb_arrays.py: real TileDB round-trip for write_df with time as a plain column (failed before the fix), call-capture tests for index promotion and the validate=False path, and raise/return tests for all four Go-binary wrappers. Verified the fix-sensitive tests fail against the unfixed source.
  • pixi run format-check, pixi run -e tiledb build-go, pixi run -e tiledb test → 87 passed.
  • End-to-end coverage comes from the workflows integration suite in fixes friction test issues earthscope-sfg-workflows#23, which locks onto this branch.

TBDArray.write_df passed the DataFrame straight to tiledb.from_pandas,
but from_pandas maps the sparse 'time' dimension from the pandas index —
a plain 'time' column made every base-class write fail. It also
referenced df_val when validate=False, crashing with NameError.
write_df now promotes a 'time' column to the index after schema
validation (pandera expects it as a column). earthscope-sfg-workflows
currently monkeypatches write_df to do this; with this fix that
workaround can be dropped.

The tiledb_integration Go-binary wrappers (nova2tile, novb2tile,
nov0002tile, tdb2rnx) ran subprocess.run(check=False) and returned the
CompletedProcess without checking it, so callers that didn't inspect
returncode silently treated failed conversions as successes. They now
raise RuntimeError on non-zero exit with stdout/stderr in the message,
matching the existing GoBinaryRunner behavior in utils/go_runner.py.

Also bump the stale pyproject version (0.1.0) to 0.2.1 ahead of the
next tag; the 0.2.0 tag shipped while pyproject still said 0.1.0.

Note: the round-trip write path cannot be integration-tested in this
repo's env — tiledb-py's dataframe layer requires pandas < 3 and the
env resolves pandas 3.x (pandas is unpinned here); tests assert on the
frame handed to from_pandas instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@netlify

netlify Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy Preview for earthscope-sfg-tools ready!

Name Link
🔨 Latest commit cb84fe5
🔍 Latest deploy log https://app.netlify.com/projects/earthscope-sfg-tools/deploys/6a6ce0e504615e0008832f28
😎 Deploy Preview https://deploy-preview-19--earthscope-sfg-tools.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

frigusgulo pushed a commit to EarthScope/earthscope-sfg-workflows that referenced this pull request Jul 31, 2026
sv3_pipeline.py carried three monkey-patches applied at import time:
write_config_file (inject 'ISB model' / 'AI Ambiguity validation' pdp3
keys), PrideProcessor._validate_kinfile (DataFrame truthiness crash),
and TBDArray.write_df (promote 'time' column to index for
tiledb.from_pandas). All three are now fixed at the source:

- pride-ppp: config keys fixed in EarthScope/GNSSommelier#33 (merged),
  _validate_kinfile fixed in EarthScope/GNSSommelier#34
- earthscope-sfg-tools: write_df fixed in
  EarthScope/earthscope-sfg-tools#19 (which also makes the Go-binary
  wrappers raise on non-zero exit instead of failing silently)

pyproject now pins pride-ppp to an explicit GNSSommelier rev (it was
unpinned, resolving default-branch HEAD at lock time) and moves the
sfg-tools pin from 0.2.0 to the fix commit; pixi.lock re-solved
accordingly. Once the upstream PRs merge, both pins should move to
merged-main revs (sfg-tools 0.2.1 tag) with a single re-lock.

Removing the base-class write_df patch also ends qc_pipeline's silent
dependence on sv3_pipeline being imported first for its
qcKinPositionTDB writes to work.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
tiledb-py's dataframe layer (tiledb.from_pandas) rejects pandas >= 3,
and pandas was unbounded — the repo's own envs resolved pandas 3.x,
leaving every TileDB write path broken locally. Bound to <3 and
re-lock (pandas 3.0.3 -> 2.3.3 across envs).

With from_pandas working again, add a real TileDB round-trip test for
TBDArray.write_df alongside the call-capture tests.

tiledb_integration.__all__ listed five symbols that were never defined
(TileDBService, TileDBOperationResult, TileDBIntegrationError,
TileDBBinaryExecutionError, GoBinaryTileDBBackend — leftovers of an
abandoned service-layer refactor), which broke star-imports; drop them,
add the missing novb2tile/rinex_qc exports, and trim the module
docstring to describe what the module actually provides.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mikegottlieb84
mikegottlieb84 merged commit b010d58 into main Aug 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants