Skip to content

support plotting multi-dimensional data #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 31, 2025

Conversation

keewis
Copy link
Collaborator

@keewis keewis commented Jan 29, 2025

This adds sliders to support the visualization of multi-dimensional data (developed during the remote sprint this morning with @ofk123 and @evenmm).

The remaining things to improve are:

  • a text box for fine control of the selected value (the slider is a bit short) looks like this is not necessary, we can go step-by-step using the arrow keys
  • label-based selection instead of index-based selection
  • a decision on where to put the controls (they're below the map for now)
  • change the pixel inspection table to include the newly selected values

Follow-up tasks:

For an example, try:

import xdggs

ds = xdggs.tutorial.open_dataset("air_temperature", "h3").load().dggs.decode()
ds["air"].dggs.explore(alpha=0.8)

cc @kylebarron

@kylebarron
Copy link
Contributor

Cool! Do you have any screenshots/screencasts?

You could add this/your existing integration to the lonboard docs if you'd like https://developmentseed.org/lonboard/latest/examples/#integrations

@keewis
Copy link
Collaborator Author

keewis commented Jan 29, 2025

You could add this/your existing integration to the lonboard docs if you'd like

I'll do that!

I'd like to make sure this doesn't do anything weird with lonboard's layer object first, though. In particular, I'd like to update the values in the layer table with the currently selected ones (so the tool tip shows the currently selected values). Do you have any tips on how to get that to work? Setting the result of RecordBatch.set_column does not appear to do the right thing.

@kylebarron
Copy link
Contributor

kylebarron commented Jan 29, 2025

I'd like to make sure this doesn't do anything weird with lonboard's layer object first, though.

I don't think I've ever gotten such updates (where the selection happens on the Python/ipywidgets side, not the JS side) to work cleanly. I tried that in developmentseed/lonboard#610 but the selection updating was pretty flaky.

Setting the result of RecordBatch.set_column does not appear to do the right thing.

Are you setting that onto layer.table? I'm not sure that'll work.

The best option might be to use a DataFilterExtension with boolean values of either 0 or 1.

@keewis
Copy link
Collaborator Author

keewis commented Jan 29, 2025

Are you setting that onto layer.table? I'm not sure that'll work.

Yes, that's what I was talking about (and which definitely does not work, at least currently). The issue with DataFilterExtension (if I understand it correctly) is that the data I'd be interested in plotting may potentially be impossible to load into (browser) memory: this might be TB of climate model data that would be computed / loaded into memory on the fly (using dask, for example).

For the example above the data is a couple of megabytes in total, but so far this has been very smooth. That was on a local jupyterlab, though, so I'll have to experiment with a remote jupyterlab and bigger data.

@keewis keewis mentioned this pull request Jan 31, 2025
7 tasks
@keewis
Copy link
Collaborator Author

keewis commented Jan 31, 2025

I think we can go ahead and merge this, even though there's still a few things to resolve (the most important thing being the table updates)

@keewis keewis merged commit c792c3e into xarray-contrib:main Jan 31, 2025
14 checks passed
@keewis keewis deleted the multi-dim-plotting branch January 31, 2025 12:59
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.

2 participants