NC_Classify

NC_Classify classifies the data into groups. For each group an index channel is created. The index channel starts with the value 1 and is constant for each group. The second group receives the index value 2 and so on. If invoked with more than 2 parameters the data file can be split into single files depending on the given index channel name.

bool = NC_Classify(ncid, smClassDefine)
bool = NC_Classify(ssNCFile, smClassDefine)
svNames = NC_Classify(ncid, smClassDefine, ssSplitBaseName, ssSplitIndexChannel)
svNames = NC_Classify(ssNCFile, smClassDefine, ssSplitBaseName, ssSplitIndexChannel)
svNames = NC_Classify(ncid, smClassDefine, ssSplitBaseName, ssSplitIndexChannel, svChannelList)
svNames = NC_Classify(ssNCFile, smClassDefine, ssSplitBaseName, ssSplitIndexChannel, svChannelList)

Return Value

bool is TRUE if the function was successful.

svNames are the names of the NC split files.

Parameters

ssNCFile

ssNCFile is the name of an NC file with the source data.

ncid

ncid is the handle of an NC file, returned by nc_create or nc_open. The file must be opened with write access.

smClassDefine

smClassDefine is a string matrix with 2 columns and 1 to 4 rows. The first column contains the channel name and the second column the tolerance.

Example:

smClassDefine = ["speed", "10";
                 "torque", "0.5"];

For text channels the tolerance value will be ignored. You can set the tolerance value to an empty string “”.

ssSplitBaseName

ssSplitBaseName is a complete file name used to name the split files. The channelname followed by = followed by the group value followed by an underscore followed by the index value, followed by .nc. Example: “d:\map-data_map.xls_N=4590_10.nc”

ssSplitIndexChannel

ssSplitIndexChannel is the name of the index channel. The name is the sting _index_ followed by the name of the channel used to classify the data.

svChannelList

svChannelList is and optional string vector with channel names. Only the given channels are added the the files.

Comment

Up to 4 channels can be specified to classify the data.

The data is sorted in ascending order after the first specified channel. The double tolerance is added to the first value (minimum) to specify the lower and upper class limit. The next class starts with the first value bigger than the last upper class limit.

For each channel an index channel is created. The index channel starts with the text _index_ followed by the channel name, for example _index_speed. The channel contains olny integer beginning wiht 1.

The index channel can be used to import data, for example the the type 2D: x/y/Cycle-Index.

See also Browser=>Classify.

Example

def TestSplit()
{
      ssFile = GetRootDirector() + "samples\\map-data.xls";
      ssNCFile = auto_ImportData(ssFile);
      if (ssNCFile == "") {
              return FALSE;
      }
      ssNewNCBaseName = sum(SplitPath(ssNCFile)[1,2,3]);
      return NC_Classify(ssNCFile, ["N", "20"], ssNewNCBaseName, "_index_N");
}

History

Version Description
R2013.14 New.

id-1676138