Skip to content

Remove TimeVector - #1270

Open
eivindjahren wants to merge 12 commits into
mainfrom
remove_time_t_vector
Open

Remove TimeVector#1270
eivindjahren wants to merge 12 commits into
mainfrom
remove_time_t_vector

Conversation

@eivindjahren

Copy link
Copy Markdown
Collaborator

No description provided.

@eivindjahren eivindjahren changed the title Avoid some usage of TimeVector Remove TimeVector Aug 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request removes the Python TimeVector abstraction and replaces time-vector plumbing across the Python/C++ boundary with standard containers (Python lists / NumPy arrays and C++ std::vector). This simplifies the API surface and reduces reliance on the ert/util/time_t_vector type.

Changes:

  • Removed TimeVector (Python implementation + exports) and updated tests to stop constructing/expecting it.
  • Updated Summary bindings and core logic to pass times as plain “time_t seconds” arrays/lists, returning NumPy datetime64[s] for allocated time vectors and Python lists for solve results.
  • Refactored C++ resampling/solve APIs to use std::vector instead of time_t_vector_type/double_vector_type.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/util_tests/test_vectors.py Removes TimeVector unit tests and imports.
tests/rd_tests/test_sum.py Updates resample tests to use tolist() / native lists instead of TimeVector.
tests/rd_tests/test_sum_equinor.py Updates expectations for alloc_time_vector return type and replaces TimeVector.createRegular usage.
tests/rd_tests/test_rd_sum.py Reworks time-range/solve/resample tests to match new return types and adds new coverage around time_range and solve behavior.
tests/rd_tests/test_npv.py Removes TimeVector import.
python/resdata/util/util/time_vector.py Deletes the TimeVector implementation.
python/resdata/util/util/init.py Stops exporting TimeVector.
python/resdata/summary/rd_sum.py Replaces TimeVector-based time handling with list/NumPy friendly conversions; updates time_range, resample, and solve/alloc behaviors.
lib/tests/test_rd_sum.cpp Updates C++ tests to use std::vector<time_t> instead of time_t_vector helpers.
lib/resdata/tests/rd_sum_test.cpp Removes time_t_vector include and updates dependencies accordingly.
lib/resdata/tests/rd_make_date_shift.cpp Removes time_t_vector include; adds <ctime> include.
lib/resdata/tests/rd_make_date_no_shift.cpp Removes time_t_vector include; adds <ctime> include.
lib/resdata/tests/rd_grid_copy.cpp Removes time_t_vector include.
lib/resdata/rd_sum.cpp Changes resample/time allocation/solve APIs to std::vector and iterator-based inputs.
lib/resdata/rd_sum_pybind.cpp Updates pybind bindings for resample/alloc_time_vector/solve_* to use std::vector and NumPy/Python-native outputs.
lib/resdata/rd_sum_data.cpp Refactors internal time/solution allocation to return std::vector instead of *_vector_type.
lib/resdata/cwrap_pybind.cpp Removes Python-side TimeVector type checking/conversion for C++ interop.
lib/include/resdata/rd_sum.hpp Updates public header signatures to std::vector and iterator ranges.
lib/include/resdata/rd_sum_data.hpp Updates public header signatures to std::vector.
lib/CMakeLists.txt Stops generating time_t_vector template header.
Suppressed comments (1)

python/resdata/summary/rd_sum.py:395

  • Like numpy_vector(), pandas_frame() will fail if time_index is a numpy datetime64 array (e.g., from alloc_time_vector()), because CTime() can't convert numpy.datetime64. Consider normalizing each element via .tolist() when available.
            time_points = [CTime(t).value() for t in time_index]

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/resdata/rd_sum_pybind.cpp Outdated
Comment thread python/resdata/summary/rd_sum.py Outdated
Comment thread python/resdata/summary/rd_sum.py
Comment thread python/resdata/summary/rd_sum.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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