-
Notifications
You must be signed in to change notification settings - Fork 3
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
Sbozzolo
wants to merge
7
commits into
main
Choose a base branch
from
gb/interactive
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f4ab3f1
Add ClimaExplorer
Sbozzolo 44c9fea
Add docs on ssh tunnelling
Sbozzolo b287bb6
fix typo
AlexisRenchon 3140a7b
Switch to WGLMakie
AlexisRenchon c5d50d2
WGLMakieExt.jl
AlexisRenchon 9380fe6
Creates figure and axis only once, fixing many glitches and improving…
AlexisRenchon c9ffe2d
ssh forward 8080 to 8080, so proxy_url is unchanged
AlexisRenchon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
module ClimaExplorer | ||
|
||
import ClimaAnalysis | ||
|
||
import Bonito: | ||
Observable, | ||
App, | ||
Slider, | ||
Dropdown, | ||
DOM, | ||
Asset, | ||
TextField, | ||
Card, | ||
Grid, | ||
Label, | ||
Styles, | ||
Centered, | ||
Button, | ||
on | ||
import WGLMakie | ||
import GeoMakie | ||
|
||
include("layouts.jl") | ||
|
||
function _logo_img() | ||
|
||
# TODO: The logo does not resize correctly | ||
imstyle = Styles( | ||
"display" => :block, | ||
"position" => :relative, | ||
"width" => "180px", | ||
"max-width" => :none, # needs to be set so it's not overwritten by others | ||
) | ||
img = DOM.a( | ||
href = "https://www.github.com/CliMA/ClimaAnalysis.jl", | ||
DOM.img(; | ||
src = Asset(joinpath("assets", "logo-full.svg")), | ||
style = imstyle, | ||
), | ||
) | ||
return img | ||
end | ||
|
||
|
||
|
||
""" | ||
BonitoApp(path) | ||
|
||
Return a `Bonito` `App` for data at `path`. | ||
""" | ||
function BonitoApp(path) | ||
app = App(; title = "ClimaExplorer") do | ||
|
||
# Text field to change the path | ||
# | ||
# TODO: width = 98% is pretty random. We should find a truly responsive with. | ||
path_obs = TextField(path, style = Styles("width" => "98%")) | ||
|
||
# Most of the logic is implemented in the layout.jl file. Every time path_obs | ||
# change, the body of the web page is redrawn. This allows us to handle invalid | ||
# states too. | ||
body_layout = map(layout, path_obs) | ||
|
||
img = _logo_img() | ||
input_field = Centered( | ||
Grid( | ||
"Insert the path of your output data and press ENTER", | ||
path_obs, | ||
), | ||
) | ||
|
||
grid = Grid(Card(input_field), Card(img); columns = "90% 10%") | ||
|
||
return Grid(grid, body_layout) | ||
end | ||
return app | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name = "ClimaExplorer" | ||
authors = ["Gabriele Bozzola <[email protected]>"] | ||
version = "0.0.1" | ||
|
||
[deps] | ||
Bonito = "824d6782-a2ef-11e9-3a09-e5662e0c26f8" | ||
ClimaAnalysis = "29b5916a-a76c-4e73-9657-3c8fd22e65e6" | ||
GeoMakie = "db073c08-6b98-4ee5-b6a4-5efafb3259c6" | ||
WGLMakie = "276b4fcb-3e11-5398-bf8b-a0c2d153d008" | ||
|
||
[compat] | ||
Bonito = "3" | ||
ClimaAnalysis = "0.5.5" | ||
GeoMakie = "0.6.5, 0.7" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<h1 align="center"> | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="assets/logo-small-white.svg" width="100px"> | ||
<source media="(prefers-color-scheme: light)" srcset="assets/logo-small.svg" width="100px"> | ||
<img alt="Shows the logo of ClimaExplorer, a compass styled with Julia's colors" src="assets/logo-small.svg"> | ||
</picture> <br> | ||
ClimaExplorer | ||
</h1> | ||
|
||
`ClimaExplorer` is a tool to explore simulation outputs interactively. Please, refer to the ClimaAnalysis [documentation](https://clima.github.io/ClimaAnalysis.jl/) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.container { | ||
display: flex; | ||
} | ||
.column { | ||
padding: 10px; | ||
} | ||
.left { | ||
flex: 0 1 20%; /* Flex-grow: 0, Flex-shrink: 1, Flex-basis: 20% */ | ||
} | ||
.right { | ||
flex: 1; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
include(joinpath(@__DIR__, "ClimaExplorer.jl")) | ||
|
||
import Bonito: route!, wait, Server | ||
|
||
path = length(ARGS) >= 1 ? ARGS[1] : "." | ||
|
||
# Create server | ||
IPa = "127.0.0.1" | ||
port = 8080 | ||
server = Server(IPa, port; proxy_url = "http://localhost:9384") | ||
|
||
app = ClimaExplorer.BonitoApp(path) | ||
route!(server, "/" => app) | ||
println(server) | ||
wait(server) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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)