-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Tyler, bugfixes, perf improvements and more complex TOML config
- Loading branch information
1 parent
b1ea1a6
commit 27c8681
Showing
10 changed files
with
383 additions
and
118 deletions.
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
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 |
---|---|---|
@@ -1,54 +1,37 @@ | ||
using Bonito, WGLMakie, NDViewer | ||
using NetCDF, YAXArrays | ||
using DimensionalData | ||
using Random | ||
|
||
data_cube = Cube(joinpath(@__DIR__, "speedyweather.nc")) | ||
layers = [ | ||
Dict( | ||
"type" => heatmap, | ||
# "attributes" => Dict("colorrange" => colorrange), | ||
"args" => [[1, 2]], | ||
), | ||
Dict( | ||
"type" => lines, | ||
"args" => [[1]], | ||
"attributes" => Dict("color" => "black") | ||
) | ||
] | ||
|
||
|
||
dd = data_cube = DimensionalData.modify(data_cube) do arr | ||
return convert(Array{Float32}, arr) | ||
function create_app_from_yaml(file) | ||
yaml_str = read(file, String) | ||
viewer = NDViewer.load_from_yaml(yaml_str) | ||
app = App() do | ||
editor = CodeEditor("yaml"; initial_source=yaml_str, width=300, height=600, foldStyle="manual") | ||
css = DOM.style(""" | ||
.ace_scrollbar-v, | ||
.ace_scrollbar-h { | ||
display: none !important; | ||
} | ||
""") | ||
set_editor = js""" | ||
const editor = ace.edit($(editor.element)) | ||
editor.setReadOnly(true); | ||
""" | ||
yaml_display = DOM.div(css, Card(editor; width="fit-content"), set_editor) | ||
style = Styles("word-wrap" => "break-word") | ||
app_dom = Grid( | ||
yaml_display, viewer; | ||
justify_content="center", | ||
# align_items="center", | ||
style=Styles("grid-auto-flow" => "column") | ||
) | ||
return Centered(app_dom; style=Styles("width" => "100%")) | ||
end | ||
return app, viewer | ||
end | ||
|
||
NDViewer.wgl_create_plot(dd, layers) | ||
|
||
|
||
layers = [ | ||
Dict( | ||
"type" => linesegments, | ||
"args" => [[1, 2, 5 => 5], [1, 2, 5 => 3]], | ||
"attributes" => Dict("color" => "black") | ||
) | ||
] | ||
|
||
linesegments(data_cube[:, :, 5, 10, 5], data_cube[:, :, 5, 10, 3]) | ||
NDViewer.wgl_create_plot(data_cube, layers) | ||
|
||
using Zarr, DiskArrays | ||
path = "gs://cmip6/CMIP6/ScenarioMIP/DKRZ/MPI-ESM1-2-HR/ssp585/r1i1p1f1/3hr/tas/gn/v20190710" | ||
g = open_dataset(zopen(path; consolidated=true)) | ||
|
||
data_cube = DimensionalData.modify(g.tas) do arr | ||
return DiskArrays.CachedDiskArray(arr) | ||
end | ||
data = (data=data_cube, | ||
names=map(x -> name(x.dim), collect(axes(data_cube)))); | ||
|
||
layers = [Dict("type" => heatmap, | ||
"data" => [1, 2])] | ||
|
||
# vec(view(data_cube, :, :, 1)) # fails on Makie#master because of this! | ||
app1, viewer = create_app_from_yaml(joinpath(@__DIR__, "speedyweather.yaml")); app1 | ||
NDViewer.add_slice_view(viewer, 1, 1, 1, :black) | ||
NDViewer.add_slice_view(viewer, 1, 1, 2, :blue) | ||
|
||
NDViewer.wgl_create_plot(data, layers) | ||
app2, viewer = create_app_from_yaml(joinpath(@__DIR__, "speedyweather-tyler.yaml")); app2 | ||
app3, viewer = create_app_from_yaml(joinpath(@__DIR__, "tas-gn-64gb.yaml")); app3 |
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,25 @@ | ||
data: | ||
path: "c:\\Users\\sdani\\Programmieren\\MakieDev\\dev\\NDViewer\\examples\\speedyweather.nc" | ||
layers: | ||
- figure: | ||
size: [1000, 1000] | ||
- type: Axis | ||
position: [1, 1] | ||
attributes: | ||
aspect: DataAspect | ||
plots: | ||
- type: image | ||
attributes: | ||
colormap: viridis | ||
args: [[1, 2]] | ||
- type: Tyler | ||
position: [2, 1] | ||
attributes: | ||
provider: OpenTopoMap | ||
plots: | ||
- type: linesegments | ||
args: [[1, 2, {5: 5}], [1, 2, {5: 3}]] | ||
attributes: | ||
colormap: autumn1 | ||
alpha: 0.5 | ||
linewidth: 1 |
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,31 @@ | ||
data: | ||
path: "c:\\Users\\sdani\\Programmieren\\MakieDev\\dev\\NDViewer\\examples\\speedyweather.nc" | ||
layers: | ||
- layout: | ||
rowsize: [0.8, 0.2] | ||
- figure: | ||
size: [1000, 800] | ||
- layout: | ||
rowsize: [0.8, 0.2] | ||
- type: Axis | ||
position: [1, 1] | ||
attributes: | ||
aspect: DataAspect | ||
plots: | ||
- type: image | ||
attributes: | ||
colormap: viridis | ||
args: [[1, 2]] | ||
- type: Axis | ||
position: [2, 1] | ||
plots: | ||
- type: lines | ||
args: [[1]] | ||
attributes: | ||
color: black | ||
linewidth: 2 | ||
- type: lines | ||
args: [[2]] | ||
attributes: | ||
color: blue | ||
linewidth: 2 |
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 @@ | ||
data: | ||
path: "gs://cmip6/CMIP6/ScenarioMIP/DKRZ/MPI-ESM1-2-HR/ssp585/r1i1p1f1/3hr/tas/gn/v20190710" | ||
layers: | ||
- figure: | ||
size: [1000, 800] | ||
- type: Axis | ||
position: [1, 1] | ||
plots: | ||
- type: image | ||
args: [[1, 2]] |
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
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
Oops, something went wrong.