gridfile.load

Load data from the sources catalogued in a gridfile.


Syntax



Description

[X, meta] = obj.load

Loads all the data catalogued in a gridfile. Returns the loaded data array and grid metadata for the array.

[X, meta] = obj.load(dimensions)

Returns the loaded data in a custom dimension order. The order of dimensions in the loaded array will match the order specified in the dimensions list. If the gridfile has dimension that are not specified in the dimension order, the unspecified dimensions are moved to the end of the order.

[X, meta] = obj.load(dimensions, indices)

Specify which elements to load along each dimension. The order of elements in the returned array will match the order of specified indices. Returned metadata will only hold metadata for the specified indices, and the rows of the metadata will match the order of the indices. If indices are not specified for a dimension, the method loads all data elements along that dimension.

[X, meta] = obj.load(dimensions, indices, precision)

Specify the numeric precision of the loaded array. By default, uses double precision when either 1. Requested data includes double, (u)int32, or (u)int64 data types, or 2. Requested data is not in any data source. Uses single precision if all requested data is of single, char, logical, (u)int8, or (u)int16 data types.


Input Arguments

dimensions

string vector [nDims]
The requested order of dimensions in the loaded data. Each element must be the name of a dimension in the gridfile. Dimension names cannot be repeated.

indices

cell vector [nDims] {[] | logical vector [dimension length] | vector, linear indices}
The indices of data elements to load. A cell vector with a set of indices for each dimension listed in the dimension order. Each set of indices must either be a logical vector the length of the dimension, a set of linear indices, or an empty array. If the indices for a dimension are an empty array, all elements along the dimension are loaded.

If only a single dimension is listed in the dimension order, the dimension’s indices may be provided directly, instead of in a scalar cell. However, the cell syntax is still permitted.

Note: Any dimensions not listed in the dimension order will be loaded in full.

precision

[] | ‘single’ | ‘double
Indicates the required numeric precision of the loaded data. If ‘single’ or ‘double’, uses the specified type. If unset or an empty array, uses double unless all requested data has a single, char, logical, (u)int8, or (u)int16 data type.

Output Arguments

X

double array | single array
The loaded data. If specified, dimensions are in the requested order. Will only include specified elements along each dimension if dimension indices are provided.

meta

gridMetadata object
Metadata for the loaded array. The metadata for each dimension will only include values for loaded data elements.