v1.1.0 - "correlate 1" fails: read-only ts under pandas ≥ 3, and lenc sized from the first station
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 72
- Forks
- 27
- PR merge metrics
- No merged PRs in 30d
Description
Summary
correlate 1 cannot run on a current installation. Two independent failures stop it,
both reproducible on master (src/mttime/core/inversion.py, _correlate).
Environment
mttime 1.1.0 (installed from git), Python 3.12, ObsPy 1.5.0, NumPy 2.5.1,
pandas 3.0.5, linux/amd64.
1. ts[index] = shift raises under pandas >= 3
File "mttime/core/inversion.py", line 398, in _correlate
ts[index] = shift
~~^^^^^^^
ValueError: assignment destination is read-only
_correlate mutates the station table through the NumPy view returned by
self.config.station_table.ts.values. Copy-on-write is mandatory in pandas 3, so that
view is read-only:
import pandas as pd
df = pd.DataFrame({"ts": [60, 60, 60]})
v = df.ts.values
print(pd.__version__, v.flags.writeable)
v[0] = 7 # pandas 2.2.3: works, df is updated
# pandas 3.0.5: ValueError: assignment destination is read-only
setup.py requires pandas>=1.0, so a fresh install today resolves to pandas 3 and the
flag is unusable. Under pandas 2.2.3 the same line works and updates the table.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/mttime/core/inversion.py at _correlate and reproduce the correlate 1 command on a current pandas installation. Inspect the station-table timestamp handling and the lenc sizing described in the issue. Done means correlate 1 runs without the read-only assignment failure and sizes lenc correctly for all stations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, pandas, python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100