Skip to content

Function: isobands()

ts
function isobands(field, levels?): IsobandPolygon[];

Defined in: charts/fields.ts:63

Filled contour bands (matplotlib's contourf).

Each grid cell is split into four triangles around its centre before clipping, which is what removes the saddle ambiguity plain marching squares has — a triangle's linear interpolant cannot produce two disjoint regions.

A cell only needs that subdivision when it actually straddles a level, which most cells do not — the interior of a band is the bulk of any field. Runs of uniform cells along a row merge into one rectangle, so a smooth field emits a few wide bars per band instead of a polygon per cell. That is where the polygon count — and the triangulation and upload behind it — mostly goes.

Parameters

ParameterTypeDefault value
fieldScalarFieldundefined
levelsnumber | number[]8

Returns

IsobandPolygon[]

MIT licensed. WebGL2 required.