Example 3 : Tiled Domain

This example first reads in Global Ocean variables, generated by the MITgcm, which are split into a collection of subdomain arrays ( tiles ) using MeshArrays.jl. It then writes them to a collection of NetCDF files ( nctiles ) using NCTiles.jl.

Packages & Helper Functions

using NCTiles
import NCTiles: Dates

p=dirname(pathof(NCTiles))
fil = joinpath(p, "../examples/helper_functions.jl")
include(fil);

File Paths & I/O Back-End

inputs=NCTiles.NCTILES_TESTCASES
NCTiles.ensure_testcases_installed()

outputs = joinpath(tempdir(),"NCTILES_TESTCASES_OUTPUT/ex3/")
if ~ispath(outputs); mkpath(outputs); end

nc=NCTiles.NCDatasets # I/O Back-End
NCDatasets

Process Global Ocean Variables

Here we process a two-dimensional field (ETAN), two three-dimensional tracer fields (THETA, SALT), and the three components of a vector field (UVELMASS, VVELMASS and WVELMASS). In each case, flds denotes the lazy representation of the processing chain (incl. all needed metadata) which the write function instantiates (i.e. outputs to files).

Note: on a C-grid these components are staggered in space.

writedir=outputs
readme = ["File created by","example 3 of NCTiles.jl","on "*string(Dates.now())]
3-element Vector{String}:
 "File created by"
 "example 3 of NCTiles.jl"
 "on 2024-05-04T18:20:14.929"

2D example

(flds,savename,readme)=prep_nctiles_native(inputs,"state_2d_set1","ETAN",Float32)
write(flds,savename,README=readme);

3D examples

(flds,savename,readme)=prep_nctiles_native(inputs,"state_3d_set1","THETA",Float32);
write(flds,savename,README=readme);

(flds,savename,readme)=prep_nctiles_native(inputs,"state_3d_set1","SALT",Float32);
write(flds,savename,README=readme);

3D vector field examples

(flds,savename,readme)=prep_nctiles_native(inputs,"trsp_3d_set1","UVELMASS",Float32);
write(flds,savename,README=readme);

(flds,savename,readme)=prep_nctiles_native(inputs,"trsp_3d_set1","VVELMASS",Float32);
write(flds,savename,README=readme);

(flds,savename,readme)=prep_nctiles_native(inputs,"trsp_3d_set1","WVELMASS",Float32);
write(flds,savename,README=readme);

This page was generated using Literate.jl.