Skip to content

Add time_index to plot_variable; auto-squeeze extra dims before plotting#46

Merged
rajeeja merged 1 commit into
mainfrom
rajeeja/plot-time-index
May 14, 2026
Merged

Add time_index to plot_variable; auto-squeeze extra dims before plotting#46
rajeeja merged 1 commit into
mainfrom
rajeeja/plot-time-index

Conversation

@rajeeja
Copy link
Copy Markdown
Collaborator

@rajeeja rajeeja commented May 14, 2026

Summary

  • plot_variable (and all layers below it) now accepts time_index: int = 0
  • Before calling uxda.plot.polygons(), any non-face dimensions (e.g. Time) are reduced: size-1 dims are always squeezed; larger dims use time_index
  • Fixes ValueError: Data Variable must be 1-dimensional for MPAS datasets where t2m has shape [1, 40962]

Root cause

ux.open_dataset on an MPAS file preserves the Time dimension even with a single snapshot. to_geodataframe (called internally by .plot.polygons()) requires a strictly 1-D face array.

Test plan

  • Pre-commit: all hooks pass
  • pytest: 248 passed
  • Live test on UCAR endpoint: plot_variable on history.2025-05-14_00.00.00.nc / t2m

… plotting

Fixes ValueError when plotting MPAS variables with a Time dimension
(shape [T, n_face]). Adds time_index=0 to the full call chain so
callers can select any step; size-1 time dims are always squeezed.
@rajeeja rajeeja merged commit af077f0 into main May 14, 2026
8 checks passed
@rajeeja rajeeja deleted the rajeeja/plot-time-index branch May 14, 2026 02:28
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