Previous topic

nc_filename

Next topic

nc_get_option

This Page

nc_from_objΒΆ

nc_from_obj creates a netCDF file from a special structured UniScript object.

ssRet = nc_from_obj(obj, ssNCFilename)

Return Value

bool is TRUE (1) if the function was successful and otherwise FALSE (0).

Parameters

obj

obj is an object that contains the channel data and the following elements: globals, channel_info and order. globals is an optional object containing elements saved as global attributes in the nc file. channel_info is an optional object containing channel attributes. The optional element order sets the order of the channels in the netCDF file.

ssNCFilename

ssNCFilename is the complete file name of the new netCDF file.

Comment

The function save the channels in the netCDF file with the data type double or char.

Example

ssNCFileName = GetUserDirectory() + "test.nc";
nc_from_obj([. x = [1,2,3], y = [4,5,2]], ssNCFileName);
NC_Edit(ssNCFileName);

Example

def test()
{
    ssNCFileName = GetUserDirectory() + "test.nc";

    x = linspace(0,2*PI*100, 1e6);
    y = sin(x);
    o = [.
        x = x,
        y = y,
        order = [. 1 = "y", 2 = "x"],
        globals = [.
          Comment = "Simple Test"
        ],
        channel_info = [. x = [. units = "Nm", a = 1], y = [. units = "kg", b = 2]]
    ];

   nc_from_obj(o, ssNCFileName);
   NC_Edit(ssNCFileName);
   return o;
}
o = test()

History

Version Description
5.14.7 New.

id-54330