MeshArrays.jl
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
- generate a global grid decomposition
- seed random noise across global domain
- smooth out noise by applying diffusion globally
- 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:
- reading and writing files in Netcdf (CF-compliant), CSV, or binary formats often used in climate sciences. NCTiles.jl readily supports domain decomposition and spatial interpolation when used along with
MeshArray.jl
- support for the analysis of MITgcm model ouput and optimized, state estimate solutions are provided via MITgcmTools.jl and OceanStateEstimation.jl, with interfaces in
MeshArray.jl
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