Skip to content

fix: resolve OutOfBoundsTimedelta in compute_ventilation_volumes #285#286

Merged
sorlob merged 1 commit into
UniGrazMath:mainfrom
sorlob:fix/285-tolist-datetime-overflow
May 7, 2026
Merged

fix: resolve OutOfBoundsTimedelta in compute_ventilation_volumes #285#286
sorlob merged 1 commit into
UniGrazMath:mainfrom
sorlob:fix/285-tolist-datetime-overflow

Conversation

@sorlob
Copy link
Copy Markdown
Collaborator

@sorlob sorlob commented May 6, 2026

Summary

  • Drop .tolist() on datetime64[ns] arrays in compute_reverse_airflow_labels: calling .tolist() converted each element to a Python int (nanoseconds since epoch), which TimeSeriesBase.__init__ then misinterpreted as seconds, overflowing timedelta64[ns].
  • Remove the len > 0 guard in IntervalLabel.__init__: empty (0, 2) arrays (no reverse airflow intervals present) were bypassing the 2D→1D reshape and reaching pd.to_timedelta as a 2D array, which it rejects with TypeError.

Test plan

  • Existing test TestComputeVentilationVolumes::test_compute_ventilation_volumes_basic_outputs now passes (was failing before this fix)
  • Full test suite passes (153 passed)

Closes #285

🤖 Generated with Claude Code

…razMath#285

Drop .tolist() on datetime64[ns] arrays in compute_reverse_airflow_labels
to avoid nanosecond values being misinterpreted as seconds. Also remove
the len > 0 guard in IntervalLabel.__init__ so empty (0, 2) arrays are
reshaped to 1-D before reaching pd.to_timedelta.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sorlob sorlob requested a review from behackl May 7, 2026 16:08
@sorlob sorlob merged commit d4ae3e2 into UniGrazMath:main May 7, 2026
10 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.

compute_ventilation_volumes() raises OutOfBoundsTimedelta due to .tolist() on datetime64[ns] array

2 participants