Chevron DownAPI Reference

NPYLoader

The NPYLoader parses an array from the NPY format, a lightweight encoding of multidimensional arrays used by the Python NumPy library.

LoaderCharacteristic
File Extension.npy
File TypeBinary
File FormatArray
Data FormatArray
Supported APIsload, parse, parseSync
Decoder TypeSynchronous
Worker Thread SupportYes
Streaming SupportNo

Usage

import {_NPYLoader} from '@loaders.gl/terrain';
import {load} from '@loaders.gl/core';

const {data, header} = await load(url, _NPYLoader);

data is a TypedArray containing the array's data.

header is an object with three keys:

  • descr: a string describing the data type. E.g. |u1 refers to uint8 and <u2 refers to little-endian uint16. Full details are available in the NumPy documentation.
  • fortran_order: a boolean that is true if the array is stored in Fortran order instead of C order.
  • shape: an array of integers that describes the shape of the array. The length of the array corresponds to the number of dimensions of the array.

Options

Currently no options are supported for this loader.

OptionTypeDefaultDescription
npy.workerUrlstringunpkg CDNURL to worker script.