Real data#

Real data in. No silent guesses.

canvas terrain[1201, 1201] { elevation  water }
run {
    load terrain.elevation "data/dem.asc" nodata 0
    ...
}

Formats#

Extension

Content

.npy

a 2-D numpy array

.csv, .txt

comma, semicolon with decimal comma, tab or space; a header line is ignored

.asc

the Esri ASCII grid, which GDAL exports from any GeoTIFF (gdal_translate -of AAIGrid)

.png

greyscale: the sample value. Colour or palette: the colour becomes the integer r*65536 + g*256 + b, the same number as rgb(r, g, b) in .vis. Transparent pixels become 0

Drawings and CAD plans: export them as PNG, painting each kind of equipment with its own colour and without anti-aliasing. A kernel can then test kind == rgb(30, 150, 60).

Validation#

The resolution of the file must match the canvas. When it does not, the message says what to declare:

bad.vis:2:7: error: 'elevation.csv' is 3x2 (width x height) and the canvas 'map' is 2x3; declare canvas map[3, 2]

Missing data#

A cell without data (NaN, or the NODATA_value of an .asc) is an error until the program says which number replaces it:

load terrain.elevation "dem.asc" nodata 1000
loaded terrain.elevation <- dem.asc (ASCII grid, cell 30, no data = -9999; 2 cells without data became 1000)

Reading the −9999 of a terrain model as an altitude is a classic mistake; Vision refuses it.

Inspect a file first#

vision info dem.asc

vision info shows the resolution, the canvas to declare, the values, the missing cells and, for an .asc, the origin and the cell size, which you can turn into parameters. Vision does not read the coordinate reference system.

Canonical values#

Data is stored the way the GPU would store it: subnormals become 0, −0 becomes +0 and ±infinity becomes ± the largest float. The same file gives the same state on every device.

In the receipt#

The SHA-256 of every data file goes into the receipt, and the verifier refuses different data.