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

Add ClimaExplorer #42

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Add ClimaExplorer #42

wants to merge 7 commits into from

Conversation

Sbozzolo
Copy link
Member

@Sbozzolo Sbozzolo commented Jul 25, 2024

This commit adds an interactive viewer for ClimaAnalysis.

Work in progress!

lol.webm

@Sbozzolo Sbozzolo force-pushed the gb/interactive branch 2 times, most recently from ce1ce84 to 4342880 Compare July 26, 2024 08:26
@Sbozzolo Sbozzolo changed the title Add ClimaAnalysisInteractive Add ClimaExplorer Jul 26, 2024
@Sbozzolo Sbozzolo force-pushed the gb/interactive branch 2 times, most recently from 36cda5d to 0bf6969 Compare July 26, 2024 11:55
@AlexisRenchon
Copy link
Member

I see for now ClimaExplorer is not using Observable

Observables makes things a bit smoother because it only updates one object (e.g., a dot or a line) and does not recreate parent objects (a figure, an axis, etc.). Currently ClimaExplorer recreates everything each time, which can be slow and clunky (resizing everything each time for example).

Note that sometime you do want to recreate the whole figure, in which case SpecApi is more responsive. - but I think in our case we want Observables ideally


Once you installed `ClimaExplorer`, you can start the server with
```sh
julia --project=ClimaAnalysis.jl/climaexplorer ClimaAnalysis.jl/climaexplorer/explorer.jl PATH_OF_OUTPUT
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it would be nice to have an example output file inside of ClimaAnalysis that works out of the box?

I wanted to test it, followed these docs, and realized I don't have an output path to test


fig = map(var) do sliced_var
fig = CairoMakie.Figure(size=(1200, 760), fontsize=30)
ClimaAnalysis.Visualize.contour2D_on_globe!(fig, sliced_var)
Copy link
Member

Choose a reason for hiding this comment

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

I think the way to go to make this a plot element (contour) Observable is to make distinct functions for the creation of the Axis (GeoAxis here), and the function ClimaAnalysis.Visualize.contour2D_on_globe! taking fig and axis as arguments, so that only the plot element (contour) gets updated dynamically - fig and axis remain the same, and don't need to be updated here (so fig should be out too, and defined only once)

@Sbozzolo Sbozzolo force-pushed the gb/interactive branch 5 times, most recently from 49667d9 to 60d98dd Compare August 3, 2024 14:25
@Sbozzolo
Copy link
Member Author

Sbozzolo commented Aug 3, 2024

2024-08-03:07:26:30

@Sbozzolo Sbozzolo force-pushed the gb/interactive branch 7 times, most recently from 6aaa99c to bae39ec Compare August 3, 2024 21:38
This commit adds an interactive viewer for ClimaAnalysis
[skip ci][ci skip]
# Create server
IPa = "127.0.0.1"
port = 8080
server = Server(IPa, port; proxy_url = "http://localhost:9384")
Copy link
Member

Choose a reason for hiding this comment

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

Note:
This is valid only for the remote cluster method.
If run locally, you only need server = Server(IPa, port)
OR server = Server(IPa, port; proxy_url = "http://localhost:8080")

otherwise it will return a broken pipe error

Copy link
Member Author

@Sbozzolo Sbozzolo Aug 4, 2024

Choose a reason for hiding this comment

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

When run explorer.jl on my computer like this, it works

EDIT, or maybe no...

Copy link
Member

Choose a reason for hiding this comment

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

For me it just loses interactivity (but initial figure shows)


Once you installed `ClimaExplorer`, you can start the server with
```sh
julia --project=ClimaAnalysis.jl/ClimaExplorer ClimaAnalysis.jl/ClimaExplorer/explorer.jl
Copy link
Member

Choose a reason for hiding this comment

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

This will currently crash, see my comment above.

```
Then, instantiate the `climaexplorer` environment
```sh
julia --project=ClimaAnalysis.jl/ClimaExplorer -e 'using Pkg; Pkg.instantiate()'
Copy link
Member

Choose a reason for hiding this comment

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

This currently needs to be dev, until we make a release

@AlexisRenchon
Copy link
Member

AlexisRenchon commented Aug 4, 2024

3140a7b and c5d50d2 switch to WGLMakie, but all I did is copy-paste the CairoMakieExt and replace with WGLMakie, likewise in scripts.

This works, and the app is much faster and more responsive.

However, you may want a different design (compatibility with both CairoMakie and WGLMakie? or no duplicate of code in Ext?) so feel free to update or delete this commit and rework it

(Note, I wanted to squash these 2 commits into one, and I did locally, but I am a bit worried that if I do git push -f it will remove previous commits, so for now I leave these 2)

axis_kwargs = pairs(axis_kwargs_dict)
end

WGLMakie.Axis(place[p_loc...]; title, xlabel, ylabel, axis_kwargs...)
Copy link
Member

Choose a reason for hiding this comment

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

I think we will need to have separate function to create Axis and elements (like heatmap), in order to create the Axis only once outside of the interaction

@Sbozzolo
Copy link
Member Author

Sbozzolo commented Aug 4, 2024

3140a7b and c5d50d2 switch to WGLMakie, but all I did is copy-paste the CairoMakieExt and replace with WGLMakie, likewise in scripts.

This works, and the app is much faster and more responsive.

However, you may want a different design (compatibility with both CairoMakie and WGLMakie? or no duplicate of code in Ext?) so feel free to update or delete this commit and rework it

(Note, I wanted to squash these 2 commits into one, and I did locally, but I am a bit worried that if I do git push -f it will remove previous commits, so for now I leave these 2)

I think there should be a way to have a single MakieExt that can use different backends, but I haven't looked at how to accomplish this

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