Skip to content

Commit

Permalink
Adds nbviewer and binder badges in examples (#68)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
navidcy authored Apr 27, 2020
1 parent 99d1079 commit 634c8d1
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 19 deletions.
25 changes: 11 additions & 14 deletions examples/barotropicqg_acc.jl
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions examples/barotropicqg_betadecay.jl
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions examples/barotropicqg_betaforced.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions examples/barotropicqgql_betaforced.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions examples/multilayerqg_2layer.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 5 additions & 3 deletions examples/twodnavierstokes_decaying.jl
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions examples/twodnavierstokes_stochasticforcing.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down

2 comments on commit 634c8d1

@navidcy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/13710

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.1 -m "<description of version>" 634c8d149296f8b86143c4420dfd7e69c66d3867
git push origin v0.4.1

Please sign in to comment.