MeshArrays.jl

Gridded earth variables, domain decomposition, and climate model C-grid support
Author JuliaClimate
Popularity
20 Stars
Updated Last
4 Months Ago
Started In
August 2018

MeshArrays.jl

Travis Build Status codecov

DOI Binder

MeshArrays.jl defines the MeshArray data structure (or type) that can contain, and distribute, collections of inter-connected arrays as generally done in climate models. This provides a simple yet efficient and general way to e.g. analyze climate system simulations.

Installation

using Pkg
Pkg.add("MeshArrays")
Pkg.test("MeshArrays")

Workflow Example

The diffusive smoother presented here as an example uses MeshArrays.jl to compute partial derivatives over a global domain / grid, which involves transfering data between neighboring subdomain arrays. In this workflow example, we

  1. generate a global grid decomposition
  2. seed random noise across global domain
  3. smooth out noise by applying diffusion globally
  4. plots the outer array of subdomain / inner arrays
using MeshArrays; p=dirname(pathof(MeshArrays))
γ,Γ=GridOfOnes("PeriodicDomain",16,20)

include(joinpath(p,"../examples/Demos.jl"))
(xi,xo,_,_)=demo2(Γ);
show(xo)

using Plots
include(joinpath(p,"../examples/Plots.jl"))
heatmap(xo,clims=(-0.25,0.25),colorbar=false,tickfont = (4, :black))

===>

Global Grids

In the previous example we used a basic doubly periodic domain with 16 subdomains of 40x40 grid points each. However, MeshArrays.jl also readily supports more elaborate global grid configurations, such as the ones shown below, which are commonly used in modeling climate.

To be able to handle such climate model grids in practical and uniform fashion, MeshArrays.jl introduces custom array types that are geared towards climate science applications.

struct gcmarray{T, N} <: AbstractMeshArray{T, N}
   grid::gcmgrid
   meta::varmeta
   f::Array{Array{T,2},N}
   fSize::Array{NTuple{2, Int}}
   fIndex::Array{Int,1}
   version::String
end

Jupyter Notebooks

The Global Ocean Notebooks illustrate standard workflows that use MeshArrays.jl to, e.g.:

  • accurately compute planetary scale transports on a global ocean model C-grid
  • efficiently compute trajectories of ocean plastic, plankton, etc over any supported C-grid configuration using MeshArrays.jl along with IndividualDisplacements.jl

Additional functionalities provided via related packages include:

For information about Jupyter notebook, see Jupyter docs. Free apps like https://nbviewer.jupyter.org and https://mybinder.org let you view them and try them out conveniently in the cloud.

JuliaCon 2018 Video

MeshArrays.jl was first introduced as as gcmfaces.jl in this presentation at JuliaCon 2018 which corresponds to DataStructures/01_MeshArrays.ipynb in the GlobalOceanNotebooks