equinor / segyio

Fast Python library for SEGY files.
Other
471 stars 213 forks source link

segy.trace[i, j] return array for int i, j #475

Closed gsakkis closed 3 years ago

gsakkis commented 3 years ago

I stumbled on a minor surprising behavior: segy.trace[i, j]) return an array of size 1 instead of a scalar value when i, j are integers. Is this intended, accidental or a bug?

jokva commented 3 years ago

Bug :---)

https://github.com/equinor/segyio/pull/477

GGDRriedel commented 3 years ago

Fixing this bug will break all my behaviour circumventions.. namely my additional paranthesises.. :(

jokva commented 3 years ago

What do you mean exactly? Will this change actually break anything, or just make your work-arounds unnecessary?

GGDRriedel commented 3 years ago

It makes my work-arounds unnecessary. It's absolutely fine to fix it.

gsakkis commented 3 years ago

By the way the same happens for segy.attributes(field)[i]

jokva commented 3 years ago

Fixed & released in 1.9.2

gsakkis commented 3 years ago

Thanks for the fix! What about these related shape inconsistencies?

I can open a new issue if you think these are bugs too.

jokva commented 3 years ago

Please make new issues for them for easier reference. I think the second a generator is involved, you'd have to expect arrays, but I'll give it a think.