Skip to content

ScalarGridField

Defined in: packages/core/src/renderer/grid-host.ts:92

A scalar field: one value per node.

  • GridFieldBase
PropertyModifierTypeDescriptionOverridesInherited fromDefined in
boundsreadonlyreadonly [number, number, number, number]The field’s cell edges, [west, south, east, north].-GridFieldBase.boundspackages/core/src/renderer/grid-host.ts:58
gridreadonlyGridGeometryThe node geometry (both authored forms normalize to it).-GridFieldBase.gridpackages/core/src/renderer/grid-host.ts:60
kindreadonly"scalar"-GridFieldBase.kind-packages/core/src/renderer/grid-host.ts:93
nxreadonlynumberColumns and rows (grid.nx, grid.ny).-GridFieldBase.nxpackages/core/src/renderer/grid-host.ts:64
nyreadonlynumber--GridFieldBase.nypackages/core/src/renderer/grid-host.ts:65
rangereadonlyreadonly [number, number] | undefinedThe values bytes 0 and 255 stand for (byte encodings only).-GridFieldBase.rangepackages/core/src/renderer/grid-host.ts:67
unitsreadonlystring | undefinedThe unit label the document gave (units:), if any.-GridFieldBase.unitspackages/core/src/renderer/grid-host.ts:56
wrapsreadonlybooleanWhether the grid spans the globe in longitude, so sampling wraps at the date line.-GridFieldBase.wrapspackages/core/src/renderer/grid-host.ts:62

contains(position): boolean

Defined in: packages/core/src/renderer/grid-host.ts:82

Whether position lies on the grid: on or between its columns (any longitude, when the grid wraps), at any latitude (latitude clamps to the first and last row, as sample does). Exactly where sample would answer with a value or null for a missing node — a missing node does not make it false — so callers can tell “outside” from “missing”. False for a position that isn’t a finite pair.

ParameterType
positionGridPosition

boolean

GridFieldBase.contains


isMissing(col, row): boolean

Defined in: packages/core/src/renderer/grid-host.ts:73

Whether node (col, row) carries no value: marked by the document’s nodata: rule or by the encoding’s own marker (alpha 0, a JSON null, a GeoTIFF’s nodata).

ParameterType
colnumber
rownumber

boolean

GridFieldBase.isMissing


rescale(range): GridField

Defined in: packages/core/src/renderer/grid-host.ts:88

The same field with another range: — a new field from the retained bytes, no decode. Byte encodings only (rg-uv, scalar-r); a field carrying physical values throws.

ParameterType
rangereadonly [number, number]

GridField

GridFieldBase.rescale


sample(position): number | null

Defined in: packages/core/src/renderer/grid-host.ts:99

The value at a position, interpolated bilinearly over the four surrounding nodes; null outside a non-wrapping grid or when any of the four is missing. Latitude clamps to the first and last row.

ParameterType
positionGridPosition

number | null


values(): object

Defined in: packages/core/src/renderer/grid-host.ts:101

Every node’s value, row-major from the north-west node, and the missing mask (1 = missing). Built once, on first call.

object

NameTypeDefined in
missingUint8Arraypackages/core/src/renderer/grid-host.ts:101
valueFloat32Arraypackages/core/src/renderer/grid-host.ts:101