What comes back
Values plus the metadata that makes them useful.
The loader returns a typed array for the values and a small header describing dtype, Fortran order, and dimensions. The array is ready for application or texture conversion code.
Data
TypedArray selected from the NPY descriptor
Dtype
Element kind, width, and byte order
Shape
Dimensions of the multidimensional array
Order
C-order or Fortran-order storage metadata
Detailed guide
NPYLoader details
The reference below covers the supported file shape, usage, returned header fields, and current option boundaries.
NPYLoader
The NPYLoader parses an array from the NPY format, a lightweight encoding of multidimensional arrays used by the Python NumPy library.
| NPYLoader | |
|---|---|
| File Extension | .npy |
| File Type | Binary |
| File Format | Array |
| Data Format | Array |
| Supported APIs | load, parse, parseSync |
| Decoder Type | Synchronous |
| Worker Thread | ✅ Yes |
| Streaming Support | ❌ No |
Usage
import {NPYLoader} from '@loaders.gl/scientific/npy';
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.|u1refers touint8and<u2refers to little-endianuint16. Full details are available in the NumPy documentation.fortran_order: a boolean that istrueif 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.
| Option | Type | Default | Description |
|---|
For synchronous access, use NPYLoaderWithParser from @loaders.gl/scientific/npy
with parseSync. The package root exports metadata and preloads the parser for async APIs.