Skip to content

transform_process_response_sheet should warn or detect space_on_x mismatch with plotting calls #23

@madsCodeBuddy

Description

@madsCodeBuddy

Context. transform_process_response_sheet bakes ellipse polygon coords into x_coords / y_coords columns by calling create_ellipse_data. The orientation of those coords depends on the space_on_x argument. Downstream, add_processes (which calls _render_glyph) plots them positionally without re-checking.

Bug shape. If a caller passes space_on_x=False to add_processes but called transform_process_response_sheet without the matching argument (default True), the ellipses render with swapped x/y silently. The two halves of the API don't enforce or communicate the convention they share.

Reproduced in the merged leverage-points HTML before #22 fixed the calling site.

Possible fixes (in increasing order of API change):

  1. Document the contract. Add a docstring note to transform_process_response_sheet and add_processes that space_on_x must match across the pipeline. (Cheapest; doesn't prevent the bug.)
  2. Stamp orientation as metadata. Have transform_process_response_sheet add a column like _coord_orientation ("stommel" or "boyd"). Have add_processes raise if the orientation doesn't match its space_on_x argument.
  3. Regenerate at render time. Have _render_glyph ignore x_coords / y_coords and call create_ellipse_data itself with the right space_on_x. Trades cache benefit for correctness.

Lean toward (2) — keeps the precomputed-coords benefit while making the failure mode loud.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions