Skip to content
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

Analytics explorer #162

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

ayenpure
Copy link
Collaborator

@ayenpure ayenpure commented Feb 2, 2025

A work in progress PR for the analytics explorer
ToDo:

  • re-add caching of figure/date for when data does not change
  • performance in zonal and global averages with full temporal resolution
  • customize Pan3DView to contain additional button to toggle plot drawer
  • Add warnings for when xcdat not available

@ayenpure ayenpure requested a review from jourdain February 2, 2025 17:16
@ayenpure ayenpure self-assigned this Feb 2, 2025
"""Create a Trame GUI for a Pan3D XArray Viewer"""

def __init__(self, xarray=None, server=None, local_rendering=None):
"""Create an instance of the XArrayViewer class.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong class name in comment

self.ctrl.on_server_reload.add(self._build_ui)

# cli
self.server.cli.add_argument(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we've never done that in the previous apps, but it might be good for the CLI to create a group for those add-on args so they don't get bundled with the rest of the trame/wslink ones. The idea, will be that when we run with --help we can clearly identify the ones that are for that explorer/app.

self._setup_vtk()
self._build_ui()
print("forcing update figure", self.state.color_by)
self.plotting.on_change_active_plot()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should automatically be called right before on_server_ready as there is a @state.change attached to it. You should not need to make that call here.

def ctrl(self):
"""Returns the Controller for the trame server."""
return self.server.controller

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to add to that list of "trame" methods those ones.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could create a pan3d abstract class for an "app". That way we can get the boiler plate code done for all.

This could even include the vtk_setup for the render window (but no more)

def _build_ui(self, **kwargs):
print("Control : ", self.state.control_expended)

self.state.trame__title = "XArray Viewer"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to use your own name?

from trame.widgets import vuetify3 as v3, plotly, html

import hashlib
import xcdat # noqa
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need xcdat here?

@@ -22,6 +22,16 @@ html {
z-index: 2;
}

.controllerbr {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is controllerbr a good name?

@@ -233,6 +233,9 @@ def _on_view_type_change(self, view_3d, **_):
self.ctrl.view_reset_camera()


print(type(Pan3DView))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove debug?

@ayenpure
Copy link
Collaborator Author

ayenpure commented Feb 5, 2025

This issue addresses
#158

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