DS_SetDataSource

DS_SetDataSource sets the data file name and the channel names in the “Datasource” map of a dataset.

hMap = DS_SetDataSource(hData, ssNetCDFName, svChannels)
hMap = DS_SetDataSource(hData, ssNetCDFName, svChannels, options)

Return Value

The “Datasource” map of a dataset or 0, if an error occurred.

Parameters

hData

hData is the dataset handle.

ssNetCDFName

ssNetCDFName is the complete UniPlot data file name (.nc or .nc2).

svChannels

svChannels is a vector with channel names.

options

options is an object with key-value pairs.

Comment

If the function is invoked with 3 parameters, the following items will be created:

NCFile
DatasetType
Channel

If the ssNetCDFName file can be accessed, the following elements will be created:

NCFileTime  
Origin  
OriginTime  
units  
CycleInfo  
NumberOfPointsSource  
DataFilter  

If the function is invoked with 4 parameters and options.ncid is used to access the UniPlot data file.

Other elements in options will be saved in the dataset map. Identical elements will be overwritten.

The following elements can be set:

FirstPoint
NumberOfPoints
AutoReload
XSort

Example

def test_DS_SetDataSource()
{
    if (version(1) < 5200) return;

    <hDoc, hPage> = _UT_CreateEmptyPage();
    hLayer = LayerCreate();
    PageAddLayer(hPage, hLayer);

    ssFile = GetRootDirectory() + "samples\\cycles.nc2";

    hData = TYCreate("test");

    LayerAddDataset(hLayer, hData);

    DS_SetDataSource(hData, ssFile, "pzyl_1");

    XYReload(hData, XY_RELOAD_UPDATE);

    DS_SetValue(hData, "AutoReload", FALSE);

    LayerAutoScale(hLayer);
    PageReplot(hPage);

    n = XYGetNumberOfPoints(hData);

    if (_g().unit_test_cleanup) {
        DocDestroy(hDoc);
    }

    if (n <= 0) {
        error();
    }
}
test_DS_SetDataSource();

History

Version Description
5.20 New.

id-1238667