Skip to content

Commit

Permalink
Merge branch 'main' into cf
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Jan 9, 2025
2 parents d4ea799 + 9a718eb commit 36a7391
Show file tree
Hide file tree
Showing 35 changed files with 1,175 additions and 212 deletions.
38 changes: 15 additions & 23 deletions .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,45 @@
# Sample workflow for building and deploying a VitePress site to GitHub Pages
#
name: Documenter
name: Documentation

on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches:
- main
tags: ['*']
tags: '*'
pull_request:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
# Sets permissions of the GITHUB_TOKEN
permissions:
contents: write
pages: write
id-token: write
statuses: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false
cancel-in-progress: true

jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
DISPLAY: ':0'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Julia
uses: julia-actions/setup-julia@v1
uses: julia-actions/setup-julia@v2
- name: Pull Julia cache
uses: julia-actions/cache@v1
- name: Install documentation dependencies
run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
- name: Install custom documentation dependencies
run: DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs -e 'using Pkg; pkg"dev ."; Pkg.instantiate(); Pkg.precompile(); Pkg.status()'
uses: julia-actions/cache@v2
- name: Install GLMakie dependencies
run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
- name: Install Julia dependencies
run: DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs -e 'using Pkg; Pkg.Registry.update(); pkg"dev ."; Pkg.instantiate(); Pkg.precompile(); Pkg.status()'
- name: Build and deploy
env:
RASTERDATASOURCES_PATH: "."
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
GKSwstype: "100" # https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
GKSwstype: "100"
JULIA_DEBUG: "Documenter"
DATADEPS_ALWAYS_ACCEPT: true
run: |
Expand Down
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Rasters"
uuid = "a3a2b9e3-a471-40c9-b274-f788e487c689"
authors = ["Rafael Schouten <[email protected]>"]
version = "0.12.1"
version = "0.13.0"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down Expand Up @@ -54,7 +54,7 @@ Adapt = "2, 3.0, 4"
Aqua = "0.8"
ArchGDAL = "0.9, 0.10"
CFTime = "0.1"
ColorTypes = "0.10, 0.11"
ColorTypes = "0.10, 0.11, 0.12"
CommonDataModel = "0.2.3, 0.3"
ConstructionBase = "1"
CoordinateTransformations = "0.6.2"
Expand Down Expand Up @@ -106,6 +106,7 @@ RasterDataSources = "3cb90ccd-e1b6-4867-9617-4276c8b2ca36"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Shapefile = "8e980c4a-a4fe-5da2-b3a7-4b4b0353a2f4"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

Expand Down
8 changes: 7 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,25 @@ DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterVitepress = "4710194d-e776-4893-9690-8d956a29c365"
GBIF2 = "dedd4f52-e074-43bf-924d-d6bce14ad628"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
GeoMakie = "db073c08-6b98-4ee5-b6a4-5efafb3259c6"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
MLJGLMInterface = "caf8df21-4939-456d-ac9c-5fefbfb04c0c"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
Maxnet = "81f79f80-22f2-4e41-ab86-00c11cf0f26f"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
NaNStatistics = "b946abbf-3ea7-4610-9019-9858bfdeaf2d"
NaturalEarth = "436b0209-26ab-4e65-94a9-6526d86fea76"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Proj = "c94c279d-25a6-4763-9509-64d165bea63e"
RasterDataSources = "3cb90ccd-e1b6-4867-9617-4276c8b2ca36"
Rasters = "a3a2b9e3-a471-40c9-b274-f788e487c689"
Shapefile = "8e980c4a-a4fe-5da2-b3a7-4b4b0353a2f4"
SpeciesDistributionModels = "3ef73bbf-0321-4d3b-9a2e-5fbebc8e35da"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"

[sources]
SpeciesDistributionModels = {url = "https://github.com/tiemvanderdeure/SpeciesDistributionModels.jl/"}
SpeciesDistributionModels = {url = "https://github.com/tiemvanderdeure/SpeciesDistributionModels.jl/"}
53 changes: 53 additions & 0 deletions docs/logo.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
ENV["RASTERDATASOURCES_PATH"] = "~/Data"
using Rasters, RasterDataSources
import ArchGDAL
using CairoMakie

layers = (:evenness, :range, :contrast, :correlation)
st = RasterStack(EarthEnv{HabitatHeterogeneity}, layers)
ausbounds = X(110 .. 190), Y(-55 .. 5) # Roughly cut out Australia and New Zealand!
aus = st[ausbounds...] |> Rasters.trim

# colorbar attributes
colormap = :batlow
flipaxis = false
tickalign=1
width = 13
ticksize = 13
# figure
fig = with_theme(theme_dark()) do
fig = Figure(; size=(600, 600),
backgroundcolor=:transparent
)
ax = Axis(fig[1,1],
backgroundcolor=:transparent
)
plt = Makie.heatmap!(ax, aus[:correlation]; colormap)
ylims!(ax, -50, 15)
xlims!(ax, 110, 180)
hidedecorations!(ax)
fig
end

mkpath(joinpath(@__DIR__, "src", "assets"))
save(joinpath(@__DIR__, "src", "assets", "logo.png"), fig; px_per_unit=2)
save(joinpath(@__DIR__, "src", "assets", "favicon.png"), fig; px_per_unit=0.25)

# do tiling for background image
function tile_background()
grid_color = RGBAf(0.55, 0.55, 0.55, 0.16)
fig = Figure(; figure_padding= 0, size=(600, 600),
backgroundcolor=:transparent
)
ax = Axis(fig[1,1], backgroundcolor=:transparent,
xgridcolor = grid_color, ygridcolor = grid_color,)
hidespines!(ax, :r, :b)
hidedecorations!(ax, grid=false)
ax.topspinecolor = grid_color
ax.leftspinecolor = grid_color
ax.xticks = 1:9
ax.yticks = 1:10
fig
end
fig = tile_background()
save(joinpath(@__DIR__, "src", "assets", "rect_pattern.png"), fig; px_per_unit=2)
6 changes: 3 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ CairoMakie.activate!(type = "png")
# Plots warnings are brWarn doctests. They don't warn the second time.
# Downloads also show op in doctests. So download everything first.
function flush_info_and_warnings()
# RasterStack(AWAP, (:tmin, :tmax); date=DateTime(2001, 1, 1))
# RasterStack(EarthEnv{HabitatHeterogeneity}, (:evenness, :range, :contrast, :correlation))
# RasterStack(WorldClim{BioClim}, (1, 3, 5, 7, 12))
RasterStack(AWAP, (:tmin, :tmax); date=DateTime(2001, 1, 1))
RasterStack(EarthEnv{HabitatHeterogeneity}, (:evenness, :range, :contrast, :correlation))
RasterStack(WorldClim{BioClim}, (1, 3, 5, 7, 12))
st = RasterStack(WorldClim{Climate}; month=1);
plot(st)
end
Expand Down
8 changes: 6 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
"docs:preview": "vitepress preview build/.documenter"
},
"devDependencies": {
"@types/d3-format": "^3.0.4",
"@types/node": "^22.10.1",
"markdown-it-mathjax3": "^4.3.2",
"vitepress": "^1.2.3",
"rollup-plugin-delete": "^2.0.0",
"vitepress": "^1.5.0",
"vitepress-plugin-tabs": "^0.5.0"
},
"dependencies": {
"markdown-it": "^14.0.0",
"d3-format": "^3.1.0",
"markdown-it": "^14.1.0",
"markdown-it-footnote": "^4.0.0"
}
}
Loading

0 comments on commit 36a7391

Please sign in to comment.