gridfile.add
Catalogue a data source in a .grid file
Syntax
Description
Adds a data source file to the .grid file catalogue. Supported data sources include NetCDF variables, MAT-file variables, and delimited text files. The syntaxes for different data source types are detailed below. Data stored in a data source must be compatible with numeric data types. Compatible types include double, single, char, logical, int* and uint* data types.
obj.add(‘netcdf’, …)
Adds a NetCDF variable to the .grid file catalogue. The NetCDF can be accessed either via a local file, or opendap URL.
Adds a variable saved in a MAT-file to the .grid file catalogue.
obj.add(…, opts)obj.add(…, Name, Value)
Adds data stored in a delimited text file to the .grid file catalogue.
Input Arguments
type
string scalar
The type of data source file. Options are:
[‘nc’ | ‘netcdf’]: NetCDF file
[‘mat’]: MAT-file
[‘txt’ | ‘text’]: Delimited text file
file
string scalar
The name of a data source file. Name may either be an absolute file path, or the name of a file on the active path.
opendapURL
string scalar
An OPENDAP url to a data source file
variable
string scalar
The name of a variable in a NetCDF or MAT-file. Only this variable is catalogued in the gridfile.
dimensions
string vector
The order of dimensions for data in the data source. Dimensions with repeated names are merged when loading data from the gridfile.
metadata
scalar gridMetadata object
Dimensional metadata for the data source. The number of rows must match the length the size of the dimension in the data source. Must include metadata for all non-singleton dimensions in both the gridfile and data source. Metadata values for gridfile dimensions must exactly match a sequence of gridfile metadata for the dimension. If the metadata has non-dimensional attributes and/or a set dimension order, the attributes and/or dimension order will be ignored.
opts
ImportOptions object
Additional options for importing data from delimited text files using the builtin “readmatrix” function.
Name,Value
name-value pairs
Additional import options for reading data from a delimited text file using the builtin “readmatrix” functions. (See the readmatrix reference page for supported pairs.)