Skip to content

Commit 49667d9

Browse files
committed
fixup
1 parent 1305c90 commit 49667d9

8 files changed

+198
-3
lines changed

climaexplorer/libexplorer.jl ClimaExplorer/ClimaExplorer.jl

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1+
module ClimaExplorer
2+
13
import ClimaAnalysis
24
import Bonito: Observable, App, Slider, Dropdown, DOM, Server, route!, wait, Asset
35
import CairoMakie
46
import GeoMakie
57

8+
include("layouts.jl")
9+
610
function BonitoApp(path)
711
app = App() do
812
climastyle = Asset(joinpath(@__DIR__, "assets", "interactive.css"))
13+
914
simdir = ClimaAnalysis.SimDir(path)
1015
variables = ClimaAnalysis.available_vars(simdir) |> collect
1116
vars_menu = Dropdown(variables)
1217
short_name = vars_menu.value.val
18+
short_name = "rhoa"
1319
# TODO: Add Dropdown menus for reduction and period
1420

1521
# reductions = ClimaAnalysis.available_reductions(simdir; short_name) |> collect
@@ -63,7 +69,8 @@ function BonitoApp(path)
6369
DOM.h4("Short name"),
6470
vars_menu,
6571
DOM.h4("Reduction: ", reduction),
66-
DOM.h4("Period: ", period),
72+
DOM.h4("Period: ", period)),
73+
DOM.div(
6774
DOM.h4("Time: ", time_slider.value),
6875
time_slider,
6976
DOM.h4("Altitude: ", level_slider.value),
@@ -76,3 +83,5 @@ function BonitoApp(path)
7683
end
7784
return app
7885
end
86+
87+
end
File renamed without changes.

ClimaExplorer/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<h1 align="center">
2+
<picture>
3+
<source media="(prefers-color-scheme: dark)" srcset="assets/logo-small-white.svg" width="100px">
4+
<source media="(prefers-color-scheme: light)" srcset="assets/logo-small.svg" width="100px">
5+
<img alt="Shows the logo of ClimaExplorer, a compass styled with Julia's colors" src="assets/logo-small.svg">
6+
</picture>
7+
ClimaExplorer
8+
</h1>
File renamed without changes.
+69
Loading

ClimaExplorer/assets/logo-small.svg

+68
Loading

climaexplorer/explorer.jl ClimaExplorer/explorer.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
length(ARGS) == 1 || error("Usage: julia --project=climaexplorer explorer.jl <PATH>")
22

3-
include(joinpath(@__DIR__, "libexplorer.jl"))
3+
include(joinpath(@__DIR__, "ClimaExplorer.jl"))
44

55
path = first(ARGS)
66

@@ -15,7 +15,7 @@ server = Server(
1515
proxy_url = "http://localhost:9384"
1616
)
1717

18-
app = BonitoApp(path)
18+
app = ClimaExplorer.BonitoApp(path)
1919

2020
route!(server, "/atmos" => app)
2121
wait(server)

ClimaExplorer/layouts.jl

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""
2+
spherical_shell_layout(var::ClimaAnalysis.OutputVar)
3+
4+
Set up the page layout and content for the given var, assuming it is a 3D sphere.
5+
"""
6+
function sphere_layout(var::ClimaAnalysis.OutputVar)
7+
time_slider = Slider(ClimaAnalysis.times(var))
8+
level_slider = Slider(ClimaAnalysis.altitudes(var))
9+
10+
var = map(time_slider) do time
11+
short_name = vars_menu.value.val
12+
# Trigger level_slidel
13+
setindex!(level_slider, level_slider.value.val)
14+
ClimaAnalysis.slice(get(simdir; short_name, reduction = reduction.val, period = period.val); time, z = level_slider.value.val)
15+
end
16+
17+
var = map(level_slider) do level
18+
short_name = vars_menu.value.val
19+
ClimaAnalysis.slice(get(simdir; short_name, reduction = reduction.val, period = period.val); time = time_slider.value.val, z = level)
20+
end
21+
22+
fig = map(var) do sliced_var
23+
fig = CairoMakie.Figure(size=(1200, 760), fontsize=30)
24+
ClimaAnalysis.Visualize.contour2D_on_globe!(fig, sliced_var)
25+
# ClimaAnalysis.Visualize.plot!(fig, sliced_var)
26+
fig
27+
end
28+
29+
return
30+
31+
end
32+
33+
34+
"""
35+
spherical_shell_layout(var::ClimaAnalysis.OutputVar)
36+
37+
Set up the page layout and content for the given var, assuming it is a (2D) spherical shell.
38+
"""
39+
function spherical_shell_layout(var::ClimaAnalysis.OutputVar)
40+
time_slider = Slider(ClimaAnalysis.times(var))
41+
end

0 commit comments

Comments
 (0)