SparseRasterGrid

class SparseRasterGrid(val latitudes: Axis, val longitudes: Axis, gridValues: DoubleArray) : RasterGrid

A RasterGrid storing only the values that are not missing, suited for sparse grids. Each value takes 12 bytes (its index and itself), against the 8 bytes per cell of DenseRasterGrid, so it takes less memory when fewer than two thirds of the cells hold a value.

Parameters

gridValues

the values, row by row: all longitudes of the first latitude, then of the second, and so on.

Throws

if there is not exactly one value per cell.

Constructors

Link copied to clipboard
constructor(latitudes: Axis, longitudes: Axis, gridValues: DoubleArray)

Properties

Link copied to clipboard
open override val latitudes: Axis

the latitudes of the grid.

Link copied to clipboard
open override val longitudes: Axis

the longitudes of the grid.

Functions

Link copied to clipboard
open fun isInBounds(position: GeoPosition): Boolean

Whether position lies within the grid.

Link copied to clipboard
open override fun valueAt(latIndex: Int, lonIndex: Int): Double