Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sbozzolo committed Aug 3, 2024
1 parent 1305c90 commit 49667d9
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 3 deletions.
11 changes: 10 additions & 1 deletion climaexplorer/libexplorer.jl → ClimaExplorer/ClimaExplorer.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
module ClimaExplorer

import ClimaAnalysis
import Bonito: Observable, App, Slider, Dropdown, DOM, Server, route!, wait, Asset
import CairoMakie
import GeoMakie

include("layouts.jl")

function BonitoApp(path)
app = App() do
climastyle = Asset(joinpath(@__DIR__, "assets", "interactive.css"))

simdir = ClimaAnalysis.SimDir(path)
variables = ClimaAnalysis.available_vars(simdir) |> collect
vars_menu = Dropdown(variables)
short_name = vars_menu.value.val
short_name = "rhoa"
# TODO: Add Dropdown menus for reduction and period

# reductions = ClimaAnalysis.available_reductions(simdir; short_name) |> collect
Expand Down Expand Up @@ -63,7 +69,8 @@ function BonitoApp(path)
DOM.h4("Short name"),
vars_menu,
DOM.h4("Reduction: ", reduction),
DOM.h4("Period: ", period),
DOM.h4("Period: ", period)),
DOM.div(
DOM.h4("Time: ", time_slider.value),
time_slider,
DOM.h4("Altitude: ", level_slider.value),
Expand All @@ -76,3 +83,5 @@ function BonitoApp(path)
end
return app
end

end
File renamed without changes.
8 changes: 8 additions & 0 deletions ClimaExplorer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<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>
ClimaExplorer
</h1>
File renamed without changes.
69 changes: 69 additions & 0 deletions ClimaExplorer/assets/logo-small-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions ClimaExplorer/assets/logo-small.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions climaexplorer/explorer.jl → ClimaExplorer/explorer.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
length(ARGS) == 1 || error("Usage: julia --project=climaexplorer explorer.jl <PATH>")

include(joinpath(@__DIR__, "libexplorer.jl"))
include(joinpath(@__DIR__, "ClimaExplorer.jl"))

path = first(ARGS)

Expand All @@ -15,7 +15,7 @@ server = Server(
proxy_url = "http://localhost:9384"
)

app = BonitoApp(path)
app = ClimaExplorer.BonitoApp(path)

route!(server, "/atmos" => app)
wait(server)
Expand Down
41 changes: 41 additions & 0 deletions ClimaExplorer/layouts.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""
spherical_shell_layout(var::ClimaAnalysis.OutputVar)
Set up the page layout and content for the given var, assuming it is a 3D sphere.
"""
function sphere_layout(var::ClimaAnalysis.OutputVar)
time_slider = Slider(ClimaAnalysis.times(var))
level_slider = Slider(ClimaAnalysis.altitudes(var))

var = map(time_slider) do time
short_name = vars_menu.value.val
# Trigger level_slidel
setindex!(level_slider, level_slider.value.val)
ClimaAnalysis.slice(get(simdir; short_name, reduction = reduction.val, period = period.val); time, z = level_slider.value.val)
end

var = map(level_slider) do level
short_name = vars_menu.value.val
ClimaAnalysis.slice(get(simdir; short_name, reduction = reduction.val, period = period.val); time = time_slider.value.val, z = level)
end

fig = map(var) do sliced_var
fig = CairoMakie.Figure(size=(1200, 760), fontsize=30)
ClimaAnalysis.Visualize.contour2D_on_globe!(fig, sliced_var)
# ClimaAnalysis.Visualize.plot!(fig, sliced_var)
fig
end

return

end


"""
spherical_shell_layout(var::ClimaAnalysis.OutputVar)
Set up the page layout and content for the given var, assuming it is a (2D) spherical shell.
"""
function spherical_shell_layout(var::ClimaAnalysis.OutputVar)
time_slider = Slider(ClimaAnalysis.times(var))
end

0 comments on commit 49667d9

Please sign in to comment.