Visualizing the GFDL OM3 tripolar grid with Ferret

Left-click any thumbnail image for a zoomable PDF.
Right-click and select "View Image" for a larger GIF image.

See also: Orthographic views of the OM3 ocean tracer grid

Setup for tracer examples:

! Use a DODS/OPeNDAP dataset containing a tripolar tracer.
can dat/all
use "http://nomads.gfdl.noaa.gov:9190/thredds/dodsC/tripolar_grid/so"

! Convenient variable and grid for displaying grid checkerboard.
let checker_t = missing(0*so,2) + mod(i+j,2)
def grid/x=so/y=so g_t

! Longitudes, latitudes, and associated vertices
let x_t  = geolon
let y_t  = geolat
let xv_t = geolon_vertex
let yv_t = geolat_vertex

palette land_sea

Longitude/latitude checkerboard of tracer cells

When setting a region, always include n+1 vertices to bracket your n gridpoints. Each limit of the region should extend just beyond a cell center without including the next vertex. Ferret will then automatically include the bracketing cell vertices, because their edges sit at the cell centers. If you fail to set the region properly, Ferret may plot the cells displaced a half-cell away from their actual locations.
can region; set region/k=1/l=1/y=60.01n:89.99n
shade/nokey/hl=0:360 checker_t, xv_t, yv_t
shade/ov/lev/nolab checker_t, xv_t-360, yv_t
go land 7

Stereographic checkerboard of tracer cells

can region; set region/k=1/l=1/y=60.01n:89.99n

go mp_stereographic_north 350
let mp_lambda = xv_t * deg2rad
let mp_phi = yv_t * deg2rad
set grid g_t

go mp_aspect
shade/noax/nokey checker_t, x_page, y_page

ppl color 6 100 100 100
go mp_graticule 0 360 20 60 80 10 6
go mp_land 7

Orthographic checkerboard of tracer cells

can region; set region/k=1/l=1

go mp_orthographic 260 60
let mp_lambda = xv_t * deg2rad
let mp_phi = yv_t * deg2rad
set grid g_t

go mp_aspect
shade/noax/nokey checker_t*mp_mask[g=checker_t], \
   x_page, y_page

ppl color 6 100 100 100
go mp_graticule 0 360 20 -80 80 10 6
go mp_land 7

Setup for all u/v examples:

! Use a DODS/OPeNDAP dataset containing the tripolar i-velocities,
! i.e. the velocities along this OM3 model's quasi-east direction.
can dat/all
use "http://nomads.gfdl.noaa.gov:9190/thredds/dodsC/tripolar_grid/uo"

! Convenient variable and grid for displaying grid checkerboard.
let checker_u = missing(0*uo,2) + mod(i+j,2)
def grid/x=uo/y=uo g_u

! Longitudes, latitudes, and associated vertices
let x_u  = geolon
let y_u  = geolat
let xv_u = geolon_vertex
let yv_u = geolat_vertex

palette land_sea

Stereographic checkerboard of u/v cells

can region; set region/k=1/l=1/y=59.51n:90.49n

go mp_stereographic_north 350
let mp_lambda = xv_u * deg2rad
let mp_phi = yv_u * deg2rad
set grid g_u

go mp_aspect
shade/noax/nokey checker_u, x_page, y_page

ppl color 6 100 100 100
go mp_graticule 0 360 20 60 80 10 6
go mp_land 7

Orthographic checkerboard of u/v cells

can region; set region/k=1/l=1

go mp_orthographic 260 60
let mp_lambda = xv_u * deg2rad
let mp_phi = yv_u * deg2rad
set grid g_u

go mp_aspect
shade/noax/nokey checker_u*mp_mask[g=checker_u], \
   x_page, y_page

ppl color 6 100 100 100
go mp_graticule 0 360 20 -80 80 10 6
go mp_land 7

Stereographic i-velocity

can region; set region/k=1/l=1/y=59.51n:90.49n

go mp_stereographic_north 350
let mp_lambda = xv_u * deg2rad
let mp_phi = yv_u * deg2rad
set grid g_u

go mp_aspect
shade/noax/lev=c uo, x_page, y_page

go mp_stereographic_north 350
go mp_land 7
go mp_graticule 0 360 20 60 80 10 2

let mp_lambda = x_u * deg2rad
let mp_phi = y_u * deg2rad
set grid g_u
vector/ov/noax/xs=5/ys=2/len=.1 \
   uo, 0*uo, x_page, y_page

Orthographic i-velocity

can region; set region/k=1/l=1

go mp_orthographic 260 60
let mp_lambda = xv_u * deg2rad
let mp_phi = yv_u * deg2rad
set grid g_u

go mp_aspect
shade/noax/lev=c uo*mp_mask[g=uo], x_page, y_page

go mp_orthographic 260 60
go mp_fland
go mp_land 7

let mp_lambda = x_u * deg2rad
let mp_phi = y_u * deg2rad
set grid g_u
vector/ov/noax/xs=15/ys=3/len=.1 \
   uo*mp_mask, 0*uo*mp_mask, x_page, y_page

Additional setup for lat/lon u/v examples:

  • Requires def_great_circle.jnl to compute truncated vertices at the tripolar fold.
  • Requires external function modulo.f90 to correctly handle modulo operations on negative numbers.
! Define great-circle midpoints between
! cross-fold vertices.
let jmax  = `yv_u,r=jend`
go def_great_circle \
   xv_u[j=`jmax-1`] xv_u[j=`jmax`] \
   yv_u[j=`jmax-1`] yv_u[j=`jmax`] .5
let midlon = xsequence(gc_lon)
let midlat = xsequence(gc_lat)

! Rotate the longitudes into a specific interval.
let mod_start = 70
let midlon_rot = mod_start + \
   modulo(midlon[gx=xv_u@asn]-mod_start,360)

! Ensure that each row of longitudes is monotonic.
let branch = IF midlon_rot[i=@ddb] LT -1e-3 \
   AND i[gx=xv_u] NE 1 THEN 1 ELSE 0
let shift = 360*branch[i=@rsum]
let midlon_rot_mono = midlon_rot + shift

! Replace top (overlapping) row of vertices
! with the truncated locations.
let xv_u_trunc = IF y[gy=xv_u] LE 90 \
   THEN xv_u ELSE midlon_rot_mono
let yv_u_trunc = IF y[gy=yv_u] LE 90 \
   THEN yv_u ELSE midlat[gx=yv_u@asn]

Longitude/latitude checkerboard of u/v cells

can region; set region/k=1/l=1/y=59.51n:90.49n

shade/nokey/hl=0:360 checker_u, \
   xv_u_trunc, yv_u_trunc
shade/ov/lev/nolab checker_u, \
   xv_u_trunc-360, yv_u_trunc

go land 7

Longitude/latitude i-velocity

can region; set region/k=1/l=1/y=59.51n:90.49n

shade/hl=0:360/lev=c uo, xv_u_trunc, yv_u_trunc
shade/ov/lev/nolab uo, xv_u_trunc-360, yv_u_trunc

vector/ov/xs=5/ys=1/len=.1/col=1 \
   uo, 0*uo, x_u, y_u
vector/ov/xs=5/ys=1/len=.1/col=1/nolab \
   uo, 0*uo, x_u-360, y_u

go land 7

Andrew Wittenberg -- 23 February 2005