gridfile.transform

Transform data loaded from a .grid file.


Syntax



Description

[transform, parameters] = obj.transform
[transform, parameters] = obj.transform(‘default’)

Return the default transformation for a gridfile.

[sourceTransform, sourceParameters] = obj.transform(‘sources’)
[sourceTransform, sourceParameters] = obj.transform(‘sources’, s)
[sourceTransform, sourceParameters] = obj.transform(‘sources’, sourceNames)

Returns the transformations for the specified data sources. If no soures are specified, returns the transformation for all data sources in the gridfile.

obj.transform(type, params)

Applies a data transformation to data loaded from a .grid file. The transformation is applied to all data sources in currently in the .grid file, as well as any data sources added in the future. Only one transformation is supported at a time, so calling this method will override any previously specified transformations. See below for details of different transformations

obj.transform(type, params, s)
obj.transform(type, params, sources)

Applies a transformation to data loaded from the specified data Overrides any data transformations previously applied to the data sources.

obj.transform(‘log’)
obj.transform(‘ln’)
obj.transform(‘ln’, [], …)

Take the natural logarithm of loaded data.

obj.transform(‘log10’)
obj.transform(‘log10’, [])

Takes the base-10 logarithm of loaded data

obj.transform(‘exp’)
obj.transform(‘exp’, [], …)

Takes the exponential of loaded data.

obj.transform(‘power’, power, …)

Raise loaded data to the specified power.

obj.transform(‘plus’, plus, …)
obj.transform(‘add’, plus, …)
obj.transform(‘+’, plus, …)

Add the indicated value to loaded data.

obj.transform(‘times’, times, …)
obj.transform(‘multiply’, times, …)
obj.transform(‘*’, times, …)

Multiply loaded data by the specified value.

obj.transform(‘linear’, coeffs, …)

Apply a linear transformation to loaded data.

obj.transform(‘none’, …)
obj.transform(‘none’, [], …)

Do not apply a transformation to loaded data.


Input Arguments

type

string scalar
The type of transformation to apply to the data. Options are as follows:

[‘ln’ | ‘log’]: Natural logarithm

[‘log10’]: Base-10 logarithm

[‘exp’]: Exponential e^x

[‘power’]: Raise data to power

[‘plus’ | ‘add’ | ‘+’]: Add value to data

[‘times’ | ‘multiply’ | ‘*’]: Multiply data by value

[‘linear’]: Linear transformation

[‘none’]: No data transformation

params

numeric scalar | numeric vector | []
The parameters for the transformation. Use an empty array when applying transformation with no parameters (e.g. ln, log, log10, exp, or none) to specific data sources. See the entries on the “power”, “plus”, “times”, and “coeffs” inputs for more details.

power

numeric scalar
The exponent that should be applied to data

plus

numeric scalar
A value that should be added to data

times

numeric scalar
A value that data should be multiplied by

coeffs

numeric vector [2]
Coefficients for a linear transformation. The first element is the multiplicative constant, and the second element is the additive constant. Linear transformations are applied via: Y = coeffs(1) + coeffs(2) * X

s

logical vector [nSources] | vector, linear indices
The indices of the data sources that should be receive the transformation.

sourceName

string vector
The names of the data sources that should receive the transformation. Names may either be just file names, or the full file path / opendap url to the source.

Output Arguments

transform

string scalar
The default transformation for the gridfile

parameters

numeric row vector [2]
Parameters for the default transformation

sourceTransform

string vector [nSource]
The transformations for the specified data sources

sourceParameters

numeric matrix [nSource, 2]
Parameters for the data source transformations