Skip to content

Better error message when building DiskChopper fails - #729

Open
nvaytet wants to merge 1 commit into
mainfrom
better-diskchopper-error-msg
Open

nvaytet wants to merge 1 commit into
mainfrom
better-diskchopper-error-msg

Conversation

@nvaytet

@nvaytet nvaytet commented Sep 17, 2026

Copy link
Copy Markdown
Member

When building a DiskChopper, if a log is empty as opposed to containing just a single value, we get the error

DimensionError: Chopper field 'rotation_speed_setpoint' must be a scalar variable, got a 1d variable

The fact that it says it's 1d even though it contains nothing is confusing, because the same log contaning just 1 value gets squeezed and becomes a scalar.

The difference comes from the fact that squeezing a variable with a dimension but size 0 does nothing and keeps the dim.

sc.array(dims=['x'], values=[]).squeeze()  # --> 1d variable
sc.array(dims=['x'], values=[1]).squeeze()  # --> scalar variable

In this PR, we make the error message less confusing.

@nvaytet
nvaytet requested a review from jl-wynen September 17, 2026 10:15
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.

1 participant