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


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.


using Pkg

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))


using Plots
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}
   fSize::Array{NTuple{2, Int}}

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 and 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