120 likes | 256 Views
Towards an Algebra of Grid Functions. Bill Howe. Claims. All our data can be modeled using grids (discretizations of a domain) and functions over the discrete elements All our data products can be specified as manipulations of these grid functions bind subgrid regrid.
E N D
Towards an Algebra of Grid Functions Bill Howe
Claims • All our data can be modeled using • grids (discretizations of a domain) and • functions over the discrete elements • All our data products can be specified as manipulations of these grid functions • bind • subgrid • regrid
Vocabulary: Grids • A k-dimensional cell, or k-cell can be thought of as just a polygon • 0-cell : ‘vertex’ = c • 1-cell : ‘edge’ = (c1, c2) • d-cell: ‘element’ (or just ‘cell’) = (c1, c2,...,cm) • AgridG is a sequence of sets of k-cells [C0,C1,...] • k-cell(G) denotes the (k+1)th set in the sequence, Ck. • dim(G) is the highest k for which k-cell(G) . • G1 G2is the cross product of G1 and G2 2-cell 1-cell
Vocabulary: Grid Functions • GFk a : ( G, f ), where • G is a grid, • f : k-cell(G) a where a is some type. (scalar float, vector of int, etc.) • grid(GFk a) = G • dom(GFk a) = kcell(G)
Examples of f geometry : 0-cell(G) (x,y,z) salinity : 2-cell(G) float neighbors(i, j) : i-cell(G) {j-cell(G)} measure(i) : i-cell(GF0(x,y,z)) float //length, area, etc. column : k-cell(G1) {k-cell(G1 G2)}
Bind bind( f )[GFk a] = GFk (a,b) where f : k-cell(G) b b (b,x) a Bind(f) c (c,y) (a,w) d (d,z) gfZ = bind(vgrid, depths) gfXY = bind(hgrid, geometry) gfBath = bind(gfXY, bath)
Subgrid subgrid(p)[GFk a] = GFk a where p : a Bool gfXY = bind(hgrid, nodes) gfZ = bind(vgrid, depths) gfBath = bind(gfXY, bath) crossGrid = gfXYb gfZ corieGrid = subgrid(d > b?, crossGrid)
Regrid Three components: • target grid, G • cell mapping, g where g : k-cell(G) { j-cell( grid( GFk b ) ) } • aggregate function, f where f : {a} b Regrid( G, g, f )[GFja] = GFkb
target grid = hgrid cell mapping = g : e e vgrid where e 2-cell(GF) aggregate = max Example: max salinity gfSalt = bind(salt)[hgrid vgrid] gfMaxSalt = regrid(hgrid, g, max)[gfSalt]
Example: salinity gradient salinity • target grid = same • cell mapping = halo • aggregate function = gradient gfAreas = bind(measure(2))[hgrid vgrid] gfGeo = bind(geometry)[gfAreas] gfSalt = bind(salinity)[gfGeo] gfSaltGrad = regrid(G, halo, gradient)[gfSalt]
Example: plume volume • target grid = unit_grid • cell mapping = g where g : e {3-cell(G)} • aggregate = sum float gfElev = bind(elev)[corieGrid] gfOcean = subgrid(ocean?)[gfElev] gfPlume = subgrid(salt<26)[gfOcean] gfVol = bind(measure(3))[gfPlume] gfPlumVol = regrid(unit, g, sum)[gfVol]
Grid Functions • Grid functions can model • Spatial data sets • Image data • Plots • Timeseries • Independent of representations • Arrays • Objects • Relations • File Formats (CORIE, NetCDF, etc.)