stateVector.metadata
Specify how to process metadata along dimensions of state vector variables
Syntax
Description
Specifies how to process metadata for the listed variables. If the first input is -1, applies the settings to all variables currently in the state vector.
Specify how to process metadata for the indicated dimensions of the listed variables. This metadata is used when building ensemble members of a state vector ensemble. The metadata is used to ensure that coupled variables within an ensemble member all correspond to the same point. This check proceeds by searching for matching metadata along the ensemble dimensions of coupled variables, and pinning the variables at matching metadata points. In the default case, this metadata is extracted from the gridfile metadata for each ensemble dimension.
However, different variables can use different metadata formats within their gridfiles, which can prevent the metadata check from finding matching metadata. This method allows you to specify alternate metadata, or a metadata conversion method, to facilitate the comparison of metadata in different formats.
This method is perhaps most commonly used to combine variables on different time steps. If this describes your scenario, check out the HOW-TO page on combining annual and seasonal data, which is located in the documentation.
obj = obj.metadata(variables, dimensions, 0|”r”|”raw”)
Use raw gridfile metadata for the indicated dimensions of the variables. Metadata for each dimension is extracted from the gridfile metadata for the dimension. This is the default behavior.
Specify an alternate set of metadata to use for a dimension, which will be used instead of the gridfile metadata. The metadata must be a matrix, and the number of rows must match the number of state/reference indices for the dimension.
Specify a function that can be used to convert gridfile metadata to a different format. The function must accept the metadata being converted as its first argument. You may use any built-in or user-defined function, which should be input as a function handle.
You may optionally provide additional arguments to be passed to the conversion function. These arguments should be organized in a cell vector. These input arguments will be passed to the conversion function in order, after the metadata argument. If you provide N optional arguments, they will be passed to the conversion function as input arguments 2 to N+1, as per the following:
convertedMetadata = conversionFunction(gridfile metadata, args{1}, args{2}, … arg{N})
Input Arguments
v
variableNames
dimensions
metadataType
[0|”r”|”raw” (default)]: Use gridfile metadata
[1|”s”|”set”]: Use an alternate set of user-specified metadata
[2|”c”|”convert”]: Apply a conversion function to gridfile metadata
alternateMetadata
Metadata matrices may have a numeric, logical, char, string, cellstring, or datetime data type. They cannot contain NaN or NaT elements. Cellstring metadata will be converted to string.
If only a single dimension is indicated, you may provide the alternate metadata directly, instead of as a scalar cell. However, the scalar cell syntax is also permitted.