Skip to content

Plotting with extra dimensions #1600

Description

@Sevans711

Proposed new feature or change:

Right now, uxarray plotting routines crash if the underlying data includes any dimensions not connected to the grid. For example:

import uxarray as ux
data = ux.tutorial.open_dataset("outCSne30-timeseries")
print(data['psi'].sizes)    # {'time': 6, 'n_face': 5400}
data['psi'].plot()

Makes: ValueError: Data Variable must be 1-dimensional, with shape 5400 for face-centered data.

Proposed features:

  1. Provide options to create animations/movies in time (or any other non-grid dimension).
  2. Provide options add a slider or dropdown menu to slide/click through non-grid dimensions, like time or elevation, at least when using "bokeh" backend.
  3. For small-sized extra dimensions (size<10, ish?), make it easy to create multiple plots; for example, in this case, maybe it should be easy to make 6 subplots, showing the values at each time.
  4. Allow plotting datasets with small (<10, ish) number of data_vars; e.g. making one subplot per var (equivalent to (3) above, using uxds.to_array().plot() with dim="variable" as the "small-sized extra dimension") or allowing an animation, slider, or dropdown (as in suggestions (1) and (2) above).
  5. Avoid accidentally plotting way too much at once, by imposing (adjustable) default limits on sizes, raising error if inputs are too large. Example: "ValueError: refused to plot row='time' with 50 subplots; can adjust maximum number of plots per row via subplots_row_size_max=value (default: 10)"

Should these options occur by default, or require using flags, such as data['psi'].plot(row='time')? If they require using flags, then the default error message should be improved, to help users find those flags.

Sidenote: maybe the default error message could also be improved in the meantime by printing the sizes actually found in the data? Something like: ValueError(f"plotting only supports 1-dimensional data variable; expected face-centered array with n_faces=5400; got {array.data_location} array with sizes {array.sizes}") would have helped me understand the error and how to debug it much faster.

Metadata

Metadata

Assignees

No one assigned

    Labels

    new featureNew feature or requestvisualizationPlotting or other visualizations

    Type

    No type

    Projects

    Status
    📚 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions