Skip to content

Commit

Permalink
Remove GLMakie dependency for documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Odd committed Mar 9, 2024
1 parent c347b9b commit 1a670df
Show file tree
Hide file tree
Showing 10 changed files with 251 additions and 190 deletions.
44 changes: 26 additions & 18 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,49 @@ authors = ["Odd Andersen <odd.andersen@sintef.no>"]
version = "0.1.0"

[deps]
ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Debugger = "31a5f54b-26ea-5ae9-a837-f05ce5417438"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
DisplayAs = "0b91fe84-8a4c-11e9-3e1d-67c38462b6d6"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
GraphPlot = "a2cc645c-3eea-5389-862e-a155d0052231"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
IndirectArrays = "9b13fd28-a010-5f03-acff-a1bbcff69959"
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
Juno = "e5e0dc1b-0480-54bc-9374-aad01c23163d"
LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
PerceptualColourMaps = "54e51dfa-9dd7-5231-aa84-a4037b83483a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
ProfileView = "c46f51b8-102a-5cf2-8d2c-8597cb0e0da7"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StaticGraphs = "4c8beaf5-199b-59a0-a7f2-21d17de635b6"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"

[compat]
ArchGDAL = "0.9.2"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]


# [compat]
# ArchGDAL = "0.9.2"


# [unsure]
# ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"
# PerceptualColourMaps = "54e51dfa-9dd7-5231-aa84-a4037b83483a"
# Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
# GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
# CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
# DisplayAs = "0b91fe84-8a4c-11e9-3e1d-67c38462b6d6"


# [cant find]
# BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
# DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
# Debugger = "31a5f54b-26ea-5ae9-a837-f05ce5417438"
# IndirectArrays = "9b13fd28-a010-5f03-acff-a1bbcff69959"
# Juno = "e5e0dc1b-0480-54bc-9374-aad01c23163d"
# Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
# ProfileView = "c46f51b8-102a-5cf2-8d2c-8597cb0e0da7"
# Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
# StaticGraphs = "4c8beaf5-199b-59a0-a7f2-21d17de635b6"
# StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://sintefmath.github.io/SurfaceWaterIntegratedModeling.jl/dev/)
[![Build Status](https://github.com/sintefmath/Jutul.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/sintefmath/SurfaceWaterIntegratedModeling.jl/actions/workflows/CI.yml?query=branch%3Amain)

# SWIM - Surface Water Integrated Modeling

SWIM is an open-source software package for static modeling and prediction of
Expand Down
12 changes: 12 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[deps]
AbstractPlotting = "537997a7-5e4e-5d89-9595-2241ea00577e"
ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
PerceptualColourMaps = "54e51dfa-9dd7-5231-aa84-a4037b83483a"
SurfaceWaterIntegratedModeling = "71e2a337-b4d4-4738-9f2b-3c37e1d3d462"
11 changes: 8 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ push!(LOAD_PATH, "../src/")
push!(LOAD_PATH, "../examples/")

# Prepare example scripts
Literate.markdown("../examples/urban.jl", "src/"; execute=false)
Literate.markdown("../examples/flat_areas.jl", "src/"; execute=false)
Literate.markdown("../examples/synthetic.jl", "src/"; execute=false)
function set_to_cairo(content)
content = replace(content, "GLMakie" => "CairoMakie")
return content
end

Literate.markdown("../examples/urban.jl", "src/"; execute=false, preprocess = set_to_cairo)
Literate.markdown("../examples/flat_areas.jl", "src/"; execute=false, preprocess = set_to_cairo)
Literate.markdown("../examples/synthetic.jl", "src/"; execute=false, preprocess = set_to_cairo)

# Build documentation
makedocs(
Expand Down
11 changes: 11 additions & 0 deletions examples/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[deps]
AbstractPlotting = "537997a7-5e4e-5d89-9595-2241ea00577e"
ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
PerceptualColourMaps = "54e51dfa-9dd7-5231-aa84-a4037b83483a"
SurfaceWaterIntegratedModeling = "71e2a337-b4d4-4738-9f2b-3c37e1d3d462"
32 changes: 17 additions & 15 deletions examples/flat_areas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

# This is a simple demonstration of how large flat surfaces (like large water
# bodies) can be recognized, and straightened or excluded from analysis if
# desired.
# desired [^1].

# ## Imporing packages and loading the surface.
using SurfaceWaterIntegratedModeling
import GLMakie, Images # for visualization and loading of textures
import ColorSchemes
using Pkg.Artifacts
using DisplayAs # for image generation in documentation

# The package with SWIM testdata is provided as a Julia artifact, which can be
# accessed using the function `datapath_testdata`. We subsequently load and
Expand All @@ -22,17 +21,17 @@ grid = loadgrid(joinpath(datapath, "bay.txt"));
cmap = Dict(:blue => 2, :green => 4, :red => 6, :orange => 8,
:lilac => 10, :bright => 11);

## Also define a preset viewpoint
view1 = (GLMakie.Vec(1059, 783, 622), GLMakie.Vec(280, 311, 58), 0.68);

# The terrain used for demonstration is a varied surface that includes hills,
# a mountainside, a road and a significant part consisting of ocean.
tex = fill(cmap[:green], size(grid))
sf, fig, ax = plotgrid(grid, texture= tex,
sf, fig, sc = plotgrid(grid, texture = tex,
colormap=ColorSchemes.:Paired_12,
colorrange=(1,12))
cam = GLMakie.cameracontrols(ax)
cam_lookat = GLMakie.Vec(285, 317, 23.9) # set observer target point
cam_eyepos = GLMakie.Vec(767, 613, 414) # set observer position
GLMakie.update_cam!(ax.scene, cam_eyepos, cam_lookat, GLMakie.Vec3f0(0, 0, 1))
DisplayAs.PNG(ax.scene)
fig
set_camerapos(fig, sc, view1...)

# ## Identifying flat areas and running spill analysis
#
Expand All @@ -46,7 +45,8 @@ isflat = identify_flat_areas(grid, rel_tol, max_cluster_size)

tex[isflat] .= cmap[:blue]
drape_surface(sf, tex)
DisplayAs.PNG(ax.scene)
set_camerapos(fig, sc, view1...)


# We can see that the ocean part was correctly identified as flat, but so were
# many parts that ought not be included. We can increase the cluster size limit
Expand All @@ -57,7 +57,8 @@ isflat = identify_flat_areas(grid, rel_tol, max_cluster_size)
tex[isflat] .= cmap[:blue]
tex[.!isflat] .= cmap[:green]
drape_surface(sf, tex)
DisplayAs.PNG(ax.scene)
set_camerapos(fig, sc, view1...)

# With this value for the threshold, only the ocean remains identified as flat.
#
# For the surface used in this example, the surface is actually flat. However,
Expand Down Expand Up @@ -95,7 +96,7 @@ tex[tex.==0] .= cmap[:green]-1;
tex[isflat] .= cmap[:blue];

drape_surface(sf, tex)
DisplayAs.PNG(ax.scene)
set_camerapos(fig, sc, view1...)

# ## Adding more sinks
#
Expand All @@ -122,8 +123,9 @@ tex[tex.==0] .= cmap[:green]-1
tex[isflat] .= cmap[:blue]

drape_surface(sf, tex)
DisplayAs.PNG(ax.scene)
set_camerapos(fig, sc, view1...)
#

# This concludes this simple demo, and we close all graphical windows
GLMakie.closeall()
# [^1]:
# The data used in this example was originally obtained from
# [Kartverket](https://kartverket.no/) (the Norwegian Mapping Authority) under the
# [Creative Commons Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/) license.
Loading

0 comments on commit 1a670df

Please sign in to comment.