E4 ยท Publication Volume 26

Raster Data Models

grids, cell centres, extent, resolution, NoData and alignment

Learning objectives

  • Explain the decision and evidence boundary for grids, cell centres, extent, resolution, NoData and alignment.
  • Select and implement the relevant representation or algorithm without hidden coordinate, support or topology assumptions.
  • Separate exact predicates, approximation error, source uncertainty and visual delivery.
  • Produce an aligned-raster contract with affine-transform and mask fixtures from synthetic evidence.

The lesson is complete only when the learner can defend the representation, transform, predicates, tests and release decision. A visually clean map or 3D scene without executable invariants and provenance remains unverified.

This is a general, institution-neutral tutorial with no relationship to any company or individual. All coordinates, geometries, grids, points, surfaces, volumes, attributes and review events in the lesson are synthetic and must not be used for an operational decision.

Decision context

The decision is whether array positions can be interpreted as spatial support and combined without an unrecorded shift. Width, height and pixel values are insufficient. A raster requires coordinate reference, affine or other geolocation model, cell-versus-point interpretation, extent convention, resolution, band semantics, data type, valid range, mask or NoData policy and alignment key. Two rasters with the same dimensions and nominal resolution are not aligned unless corresponding indices address the same support.

Write the intended use, consequence of error, required evidence, spatial support and release authority before selecting a representation or transformation. Fitness is evaluated against a versioned contract and use, not attached permanently to a file extension.

Core concept

A raster is a coverage over an indexed domain. In an affine model, pixel and line coordinates map to world coordinates through six coefficients. The top-left corner of the top-left cell is at index coordinate (0,0), while its centre is at (0.5,0.5) under the common area-cell convention. Extent may describe outer cell edges or centre coordinates; mixing them introduces a half-cell shift. NoData is a value-state declaration, not a very small or very large scientific measurement, and an external validity mask may be safer than an embedded reserved value.

Keep received evidence, accepted analytical views and derived representations as distinct objects. This allows corrected evidence, a changed transform or a new level of detail to generate a new result without rewriting history. Every coordinate and primitive therefore answers both a spatial question and a provenance question.

Algorithm and data model

Define a grid identity from coordinate reference, transform, dimensions, axis direction, cell interpretation and index origin. Store band-level units, categories, scale and offset, missingness and uncertainty separately. An alignment test maps a selected set of corner and centre indices through both transforms and compares world coordinates under a declared tolerance derived from transform precision, not a percentage of cell size chosen for convenience. Rotated and sheared grids remain valid but cannot be treated as north-up arrays by dropping off-diagonal terms.

Define parsing, semantic validation, canonicalisation, indexing, exact or approximate calculation, quality evaluation and encoding as separate stages. Each stage emits structured output and does not depend on interface state, file order, graphics-driver behaviour or undocumented defaults.

Constraints and invariants

| Invariant | Executable or review test | | --- | --- | | Grid identity includes reference, transform, dimensions and cell interpretation. | Reject or quarantine the exact affected object and preserve the received representation. | | Band values, units, masks and NoData states remain distinct metadata. | Evaluate this condition before creating a derived geometry, grid, surface or volume. | | Alignment is tested in world coordinates at declared index locations. | Record the predicate, tolerance policy, observed values and coordinate frame. | | Rotated or sheared terms are preserved unless a versioned resampling removes them. | Make every repair a new version and rerun all dependent golden cases. |

An invariant must survive import, transformation, processing, export and rerun. A failed hard invariant produces no apparently valid substitute. Diagnostics remain visible with predicate, threshold, coordinate frame, scope and evidence, and require a reviewed rule before they can trigger repair.

Quantitative reasoning

For affine coefficients GT, world coordinates are X=GT_0+iGT_1+jGT_2 and Y=GT_3+iGT_4+jGT_5. Evaluate all four outer corners using (0,0), (n,0), (0,m) and (n,m) for an n by m area-cell grid. Report determinant GT_1GT_5-GT_2GT_4, cell area magnitude, axis orientation, valid-cell fraction, masked-cell fraction and alignment residuals. A zero determinant is non-invertible. Test one-cell grids, negative row spacing, rotated grids, integer reserved marker values, floating NaN, all-masked bands and transforms that differ by exactly half a cell.

Every metric includes units, support, numerator and denominator where applicable, exclusions, comparison policy and evaluation version. Aggregate metrics are stratified when pooling can hide local geometry failure. A performance gain cannot overrule invalid topology, missing reference metadata or broken lineage.

Evidence and uncertainty

Keep acquisition uncertainty, interpretation uncertainty, discretisation error, numeric round-off and delivery error separate. Increasing coordinate digits or triangle count does not improve the original evidence. A sampled surface may be smooth and watertight while remaining poorly constrained between observations. Report uncertainty in the quantity and support to which it belongs.

Build an evidence packet containing immutable received objects, semantic declarations, validation findings, transform inputs and outputs, measured errors, test results, reviewer decisions and fingerprints. Contradictory evidence remains available. When a required reference, topology state or classification cannot be resolved, return unknown, conflict or blocked rather than inventing geometry.

Interfaces and storage

Interfaces transmit identity, coordinate reference, units, axis order, support, topology expectations, attribute association, null state, version and lineage beside coordinates. Structured errors identify the object, primitive, predicate, observed value, expected condition and rule. An interface that carries vertices but drops the transform or face orientation has not preserved the object.

Store authoritative received evidence separately from reproducible analytical derivatives and disposable delivery artefacts. Indexes, caches, pyramids and render meshes improve access but cannot become the only copy of source attributes or coordinate metadata. Round-trip tests verify identity, precision, topology, ordering, missingness and association after encoding changes.

Governance and review

Assign responsibilities to roles rather than named organisations or people: evidence custodian, representation author, algorithm maintainer, independent validator and release reviewer. A role may propose a repair but cannot erase the received geometry. Transform, predicate and tolerance changes are versioned and evaluated against fixed regression fixtures before release.

Exceptions are explicit decisions with scope, rationale, evidence, approving role, affected versions and review trigger. They never turn invalid topology into valid topology by label. The host website has no ownership or scientific-authority role in this workflow; it only delivers the tutorial.

Integration checkpoint

an aligned-raster contract with affine-transform and mask fixtures
an aligned-raster contract with affine-transform and mask fixtures

Read the figure as a reasoning map from preserved evidence through declared support and coordinates, controlled transformation, validation and scoped release. Each arrow represents a declared relationship. Integrate an aligned-raster contract with affine-transform and mask fixtures into SYN-SPATIAL, rerun earlier fixtures and record every changed assumption.

Synthetic worked example

Synthetic rasters SYN-R01 and SYN-R02 are both 100 by 100 cells at 10 m resolution. Their filenames and dimensions suggest alignment, but SYN-R02 begins five metres east and five metres south because its producer wrote cell centres where the receiving contract expects outer corners. Index-by-index subtraction would therefore compare different ground support. The alignment validator detects centre residuals of (5,-5) m, blocks map algebra, and creates an explicitly resampled derivative only after one grid is selected as the target contract.

  1. Preserve the received object and state the intended decision without repair.
  2. Resolve identity, reference, units, support, topology and evidence eligibility.
  3. Run the versioned transform or predicate while retaining intermediate diagnostics.
  4. Issue accept, reject or quarantine and show how an independent reviewer reproduces it.

Practice task

Implement the chapter artefact against a synthetic fixture containing one normal case, one boundary case, one invalid case and one unresolved-evidence case. Preserve the received fixture. Produce canonical input, validation findings, derivative output, processing manifest, measured error and a short release decision.

Acceptance criteria:

  • Every required identity, coordinate reference, unit, support and convention is explicit.
  • The implementation is deterministic under stable ordering and the declared numerical policy.
  • No repair overwrites received evidence or converts unknown into a guessed value.
  • All hard failures block the affected derivative and remain machine-readable.
  • A second implementation or reviewer can reproduce the result from the package alone.

Submit an aligned-raster contract with affine-transform and mask fixtures, golden and adversarial fixtures, exact findings, measured error and a limitations note. A screenshot is not sufficient evidence because it does not identify input versions, transforms, algorithms or rule configuration.

Common failure modes

  • Comparing arrays because width, height and resolution match.
  • Treating a NoData marker as a legitimate zero or extreme measurement.
  • Confusing cell-edge extent with cell-centre extent.
  • Dropping affine rotation terms when exporting a nominally north-up grid.

These failures share a pattern: implicit convenience is substituted for evidence. Diagnose the earliest boundary where the assumption entered, restore the source statement, make the transform or predicate explicit, rerun all dependent derivatives and supersede rather than overwrite the affected release.

Review questions

  1. What declarations make an array a georeferenced raster?
  2. Why does a cell-centre versus cell-corner mismatch create a half-cell shift?
  3. How should NoData differ from a scientific zero?
  4. Which index positions should an affine-transform fixture test?

For every answer, identify the governing invariant, evidence needed to evaluate it, numerical or semantic policy involved and correct behaviour when the condition fails.

Sources and further reading