From 634c8d149296f8b86143c4420dfd7e69c66d3867 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 28 Apr 2020 00:17:00 +1000 Subject: [PATCH] Adds nbviewer and binder badges in examples (#68) * avoid precompilation of PyPlot in examples * adds docs/src/examples * avoid precompilation of PyPlot in examples * polishing examples * missing comma * devurl mistake * drop devurl mistake * adds nbviewer and binder badges --- examples/barotropicqg_acc.jl | 25 ++++++++----------- examples/barotropicqg_betadecay.jl | 6 +++-- examples/barotropicqg_betaforced.jl | 3 +++ examples/barotropicqgql_betaforced.jl | 3 +++ examples/multilayerqg_2layer.jl | 3 +++ examples/twodnavierstokes_decaying.jl | 8 +++--- .../twodnavierstokes_stochasticforcing.jl | 3 +++ 7 files changed, 32 insertions(+), 19 deletions(-) diff --git a/examples/barotropicqg_acc.jl b/examples/barotropicqg_acc.jl index 8b6a8383..19805473 100644 --- a/examples/barotropicqg_acc.jl +++ b/examples/barotropicqg_acc.jl @@ -1,20 +1,17 @@ +#md # [![](https://mybinder.org/badge_logo.svg)](@__BINDER_ROOT_URL__/examples/barotropicqgtopography.ipynb) +#md # [![](https://img.shields.io/badge/show-nbviewer-579ACA.svg)](@__NBVIEWER_ROOT_URL__/examples/barotropicqgtopography.ipynb) + # # Barotropic QG beta-plane turbulence over topography # # An idealized version of the Southern Ocean. We solve the barotropic # quasi-geostrophic eddy dynamics in a flud with variable depth $H-h(x,y)$. We # also include an "Antarctic Circumpolar Current," i.e., a domain-average zonal # velocity $U(t)$ which is forced by constant wind stress $F$ and influenced by -# bottom drag and topographic form stress. -# -# The equations solved are: -# -# $$ -# \partial_t \nabla^2\psi + \mathsf{J}(\psi-U y, \nabla^2\psi + \beta y + \eta) = -\mu\nabla^2\psi, -# $$ -# -# $$ -# \partial_t U = F - \mu U - \langle\psi\partial_x\eta\rangle . -# $$ +# bottom drag and topographic form stress. The equations solved are: +# $\partial_t \nabla^2\psi + \mathsf{J}(\psi-U y, \nabla^2\psi + \beta y + \eta) = -\mu\nabla^2\psi$ +# and +# $\partial_t U = F - \mu U - \langle\psi\partial_x\eta\rangle$. + using FourierFlows, PyPlot, Printf @@ -92,9 +89,9 @@ nothing # hide # We choose folder for outputing `.jld2` files and snapshots (`.png` files). filepath = "." -plotpath = "./plots_acctopo" +plotpath = "./plots_barotropicqgtopography" plotname = "snapshots" -filename = joinpath(filepath, "acctopo.jl.jld2") +filename = joinpath(filepath, "barotropicqgtopography.jld2") nothing # hide # Do some basic file management, @@ -124,7 +121,7 @@ function plot_output(prob, fig, axs; drawcolorbar=false) axis("square") xticks(-2:2) yticks(-2:2) - title(L"$\nabla^2\psi + \eta$ (part of the domain)") + title(L"$\nabla^2\psi + \eta$") if drawcolorbar==true colorbar() end diff --git a/examples/barotropicqg_betadecay.jl b/examples/barotropicqg_betadecay.jl index cf755216..ed770df5 100644 --- a/examples/barotropicqg_betadecay.jl +++ b/examples/barotropicqg_betadecay.jl @@ -1,3 +1,6 @@ +#md # [![](https://mybinder.org/badge_logo.svg)](@__BINDER_ROOT_URL__/examples/barotropicqg_betadecay.ipynb) +#md # [![](https://img.shields.io/badge/show-nbviewer-579ACA.svg)](@__NBVIEWER_ROOT_URL__/examples/barotropicqg_betadecay.ipynb) + # # Decaying barotropic QG beta-plane turbulence # # An example of decaying barotropic quasi-geostrophic turbulence on a beta plane. @@ -90,8 +93,7 @@ axis("square") xticks(-2:2:2) yticks(-2:2:2) title(L"initial streamfunction $\psi$") -gcf() #hide -nothing #hide +gcf() # hide # ## Diagnostics diff --git a/examples/barotropicqg_betaforced.jl b/examples/barotropicqg_betaforced.jl index 671a548c..9cd76e5b 100644 --- a/examples/barotropicqg_betaforced.jl +++ b/examples/barotropicqg_betaforced.jl @@ -1,3 +1,6 @@ +#md # [![](https://mybinder.org/badge_logo.svg)](@__BINDER_ROOT_URL__/examples/barotropicqg_betaforced.ipynb) +#md # [![](https://img.shields.io/badge/show-nbviewer-579ACA.svg)](@__NBVIEWER_ROOT_URL__/examples/barotropicqg_betaforced.ipynb) + # # Forced-dissipative barotropic QG beta-plane turbulence # # A simulation of forced-dissipative barotropic quasi-geostrophic turbulence on diff --git a/examples/barotropicqgql_betaforced.jl b/examples/barotropicqgql_betaforced.jl index 16d7b17b..8c988fc5 100644 --- a/examples/barotropicqgql_betaforced.jl +++ b/examples/barotropicqgql_betaforced.jl @@ -1,3 +1,6 @@ +#md # [![](https://mybinder.org/badge_logo.svg)](@__BINDER_ROOT_URL__/examples/barotropicqgql_betaforced.ipynb) +#md # [![](https://img.shields.io/badge/show-nbviewer-579ACA.svg)](@__NBVIEWER_ROOT_URL__/examples/barotropicqgql_betaforced.ipynb) + # # Quasi-Linear forced-dissipative barotropic QG beta-plane turbulence # # A simulation of forced-dissipative barotropic quasi-geostrophic turbulence on diff --git a/examples/multilayerqg_2layer.jl b/examples/multilayerqg_2layer.jl index cf0d113f..292e3cad 100644 --- a/examples/multilayerqg_2layer.jl +++ b/examples/multilayerqg_2layer.jl @@ -1,3 +1,6 @@ +#md # [![](https://mybinder.org/badge_logo.svg)](@__BINDER_ROOT_URL__/examples/multilayerqg_2layer.ipynb) +#md # [![](https://img.shields.io/badge/show-nbviewer-579ACA.svg)](@__NBVIEWER_ROOT_URL__/examples/multilayerqg_2layer.ipynb) + # # Phillips model of Baroclinic Instability # # A simulation of the growth of barolinic instability in the Phillips 2-layer model diff --git a/examples/twodnavierstokes_decaying.jl b/examples/twodnavierstokes_decaying.jl index 43ae3d79..304aee37 100644 --- a/examples/twodnavierstokes_decaying.jl +++ b/examples/twodnavierstokes_decaying.jl @@ -1,3 +1,6 @@ +#md # [![](https://mybinder.org/badge_logo.svg)](@__BINDER_ROOT_URL__/examples/twodnavierstokes_decaying.ipynb) +#md # [![](https://img.shields.io/badge/show-nbviewer-579ACA.svg)](@__NBVIEWER_ROOT_URL__/examples/twodnavierstokes_decaying.ipynb) + # # 2D decaying turbulence # # A simulations of decaying two-dimensional turbulence. @@ -56,7 +59,7 @@ nothing # hide # Let's plot the initial vorticity field: -fig = figure(figsize=(5, 3.5), dpi=200) +fig = figure(figsize=(3, 2), dpi=150) pcolormesh(x, y, vs.zeta) axis("square") xticks(-2:2:2) @@ -65,8 +68,7 @@ title(L"initial vorticity $\zeta = \partial_x v - \partial_y u$") colorbar() clim(-40, 40) axis("off") -gcf() #hide -nothing #hide +gcf() # hide # ## Diagnostics diff --git a/examples/twodnavierstokes_stochasticforcing.jl b/examples/twodnavierstokes_stochasticforcing.jl index 37d280ec..e44e8bba 100644 --- a/examples/twodnavierstokes_stochasticforcing.jl +++ b/examples/twodnavierstokes_stochasticforcing.jl @@ -1,3 +1,6 @@ +#md # [![](https://mybinder.org/badge_logo.svg)](@__BINDER_ROOT_URL__/examples/twodnavierstokes_stochasticforcing.ipynb) +#md # [![](https://img.shields.io/badge/show-nbviewer-579ACA.svg)](@__NBVIEWER_ROOT_URL__/examples/twodnavierstokes_stochasticforcing.ipynb) + # # 2D forced-dissipative turbulence # # A simulation of forced-dissipative two-dimensional turbulence. We solve the