If you import data into UniPlot, the data will be saved in a netCDF file. The standard extension is .nc. netCDF is a file format for measured data developed by the University Corporation for Atmospheric Research (see Copyright netCDF).
A new alternative file format has been added for netCDF files (netCDF-up) with a number of advantages
Advantages of netCDF-up
| File | Orginal (MDF/VS100) | netCDF (Original) | netCDF-up |
|---|---|---|---|
| File small | 11 | 17 | 12 |
| File medium | 934 | 1426 | 453 |
| File big | 13727 | 33883 | 4271 |
Sometimes (for example pure random numbers) netCDF-up files can be bigger than netCDF fields. But this will be a rare case.
| Tools | |
|---|---|
| NC_CreateMeanCycleFile | NC_CreateMeanCycleFile creates a new NC file with the mean, minimum and maximum cycle of an NC data file containing multiple cycles (segments). |
| NC_Edit | NC_Edit opens a dialog box to edit a netCDF data file (NC file). |
| NC_ExportData | NC_ExportData converts netCDF data files (.nc) into another data format. |
| NC_GetVarNames | NC_GetVarNames returns the variable names of a netCDF data file (NC file). |
| NC_Interpolation | :ref:`NC_Interpolation ` creates a new NC file with interpolated data. The function can be used to change the sampling rate (frequency resolution). MDF/Inca files with multiple time channels can be interpolated onto a common time channel. |
| NC_MapInterpolation | NC_MapInterpolation calculates new channels by map interpolation and adds the new channels to an NC file. |
| nc_from_obj | nc_from_obj creates a netCDF file from a special structured UniScript object. |
| nc_to_obj | nc_to_obj reads a netCDF file or a selection of channels of a netCDF file into a UniScript object. |
| Open and Close | |
|---|---|
| nc_abort | nc_abort closes or deletes a netCDF file. |
| nc_close | nc_close closes an open netCDF file. |
| nc_create | nc_create creates a new netCDF file. |
| nc_open | nc_open opens an existing netCDF file. |
| nc_sync | nc_sync writes all buffered data to the file. |
| Global Functions | |
|---|---|
| nc_copy | nc_copy copies all variables and attributes of an NC file to a new NC file. |
| nc_diminq_size | nc_diminq_size returns the size of a dimension when given its ID. |
| nc_endef | nc_endef takes an open netCDF file out of define mode. The changes made to the netCDF file while it was in define mode are checked and committed to disk if no problems occurred. In particular, non-record variables are filled with their fill-values unless nc_setfill has been called with the argument NC_NOFILL. The netCDF file is then placed in data mode, so that variable data can be read or written. |
| nc_fatal_error | nc_fatal_error. |
| nc_filename | nc_filename returns the file name for a given ncid. |
| nc_get_option | nc_get_option gets an option. |
| nc_inquire_format | nc_inquire_format returns the file format for a given ncid. |
| nc_inquire_ndims | nc_inquire_ndims returns the number of dimensions in a netCDF file. |
| nc_inquire_ngatts | nc_inquire_ngatts returns the number of global attributes in a netCDF file. |
| nc_inquire_nvars | nc_inquire_nvars returns the number of variables in a netCDF file. |
| nc_inquire_recdim | nc_inquire_recdim returns the ID number of the record variable in a netCDF file. |
| nc_last_error | nc_last_error returns the last error that occurred of netCDF-up files. If the last invoked nc_-function returned without an error the function will return 0. |
| nc_redef | nc_redef puts an open netCDF file into define mode, so dimensions, variables, and attributes can be added or renamed and attributes can be deleted. |
| nc_set_option | nc_set_option sets an option. |
| nc_seterror_options | nc_seterror_options sets the error options for the netCDF functions. |
| nc_setfill | nc_setfill determines whether or not variable prefilling will be done. |
| nc_str_error | nc_str_error. |
| Dimensions | |
|---|---|
| nc_dimdef | nc_dimdef adds a new dimension to an open netCDF file. |
| nc_dimid | nc_dimid returns the ID of a netCDF dimension when given the name of the dimension. |
| nc_diminq_name | nc_diminq_name returns the name of a dimension when given its ID. |
| nc_dimredim | nc_dimredim modifies the size of a dimension. The netCDF file must be set to define mode (siehe nc_endef/nc_redef). |
| nc_dimrename | nc_dimrename renames a given dimension. |
| Variables | |
|---|---|
| nc_makevalidname | nc_makevalidname returns a valid netCDF variable name for a given name. |
| nc_varcopy | nc_varcopy copies the data of a variable from one NC file to another NC file. The variable must exist in both files and must have the same number of points. |
| nc_vardef | nc_vardef adds a new variable to an open netCDF file in define mode. |
| nc_vardelete | nc_vardelete deletes a given variable. A variable can only be deleted if the file is not in definition mode. |
| nc_varget | nc_varget reads data values from a netCDF variable of an open netCDF file. The file must be in data mode. |
| nc_varget_missing | nc_varget_missing reads data values from a netCDF variable of an open netCDF file. The file must be in data mode. |
| nc_varid | nc_varid returns the ID of a netCDF variable when given its name. |
| nc_varinq_changed | nc_varinq_changed returns the change counter of a netCDF variable. |
| nc_varinq_datatype | nc_varinq_datatype returns the data type of a variable when given its ID. |
| nc_varinq_dimids | nc_varinq_dimids returns a vector of dimension IDs. |
| nc_varinq_name | The nc_varinq_name function returns the name of a netCDF variable when given its ID. |
| nc_varinq_natts | The nc_varinq_natts function returns the number of attributes for a variable, given its ID. |
| nc_varput | The nc_varput functions writes data values into a netCDF variable of an open netCDF file. The file must be in data mode. |
| nc_varput_missing | The nc_varput_missing functions writes data values into a netCDF variable of an open netCDF file. The file must be in data mode. Missing values must have the value MISSING_VALUE. |
| nc_varrename | nc_varrename renames a given netCDF variable. |
| Attributes | |
|---|---|
| nc_attcopy | nc_attcopy copies a given attribute into a different NC file. |
| nc_attdelete | nc_attdelete deletes a given attribut. The file must be in define mode. |
| nc_attget | nc_attget returns the value(s) of a netCDF attribute. |
| nc_attinq_datatype | nc_attinq_datatype returns the data type of an attribute when given its ID and name. |
| nc_attinq_len | nc_attinq_len returns the number of values stored in the attribute. If the attribute is of type NC_CHAR, the function returns the string length. |
| nc_attname | nc_attname returns the attribute name. |
| nc_attput | nc_attput changes a variable attribute or global attribute of an open nc file. If the attribute is new, or if the space required to store the attribute is greater than before, the nc file must be in define mode. |
| nc_attrename | nc_attrename renames a given attribute. |
netCDF-up is a file format with an interface that is mostly compatible to the netCDF-Library.
The command
WriteProfileInt("Settings", "standard-netcdf-files", 2);
can be used to enable the netCDF-up interface. The command File=>Import Data will create netCDF-up files, if the new interface is enabled.
Attention: This is a beta version of the new interface. It may contain many bugs and should be used for test purposes only. The release version will be available with 6.0.
The following command will switch back to the standard netCDF library:
// Create standard netCDF files
WriteProfileInt("Settings", "standard-netcdf-files", 1);
or
// netCDF with Intel byte order (Default)
WriteProfileInt("Settings", "standard-netcdf-files", 0);
Advantages of netCDF-up
The following function creates a netCDF file. In this example the data is passed as a string matrix (smData).
def NC_WriteSimpleNCFile(ssFileName, ssNetCDFName, svChanName, svUnits, ...
rvDataType, smData, ssCreator)
{
nCols = nc(smData);
nRows = nr(smData);
ncid = nc_create(ssNetCDFName, NC_CLOBBER|0x10000);
if (ncid == -1) {
ssError = sprintf(_s("Cannot create file %s - Is file already open?");
MessageBox(ssError, ssNetCDFName), "ICONSTOP");
return "#IMPORTERROR#";
}
dimids = nc_dimdef(ncid, "nRows", nRows);
// Globale Attribute:
nc_attput(ncid, -1, "Origin", NC_CHAR, _StandardFileName(ssFileName));
nc_attput(ncid, -1, "Source", NC_CHAR, "Uniplot Software GmbH");
nc_attput(ncid, -1, "Creator", NC_CHAR, ssCreator);
rvRange = [1, nRows];
nc_attput(ncid, -1, "Range", NC_LONG, rvRange);
nc_attput(ncid, -1, "Reference", NC_CHAR, "");
nc_attput(ncid, -1, "Date", NC_CHAR, sum(date()));
nc_attput(ncid, -1, "Time", NC_CHAR, sum(time()));
nc_attput(ncid, -1, "Title", NC_CHAR, "");
nc_attput(ncid, -1, "Comment1", NC_CHAR, "");
nc_attput(ncid, -1, "Comment2", NC_CHAR, "");
nc_attput(ncid, -1, "Comment3", NC_CHAR, "");
for (i in 1:nCols) {
if (NC_DATETIME == rvDataType[i]) {
varid = nc_vardef(ncid, svChanName[i], NC_DOUBLE, dimids);
} else {
varid = nc_vardef(ncid, svChanName[i], rvDataType[i], dimids);
}
nc_attput(ncid, varid, "title", NC_CHAR, svChanName[i]);
nc_attput(ncid, varid, "units", NC_CHAR, svUnits[i]);
nc_attput(ncid, varid, "long_name", NC_CHAR, svChanName[i] + ..
" [" + svUnits[i] + "]");
nc_attput(ncid, varid, "scale_factor", NC_DOUBLE, 1.0);
nc_attput(ncid, varid, "add_offset", NC_DOUBLE, 0.0);
nc_attput(ncid, varid, "Description", NC_CHAR, "");
nc_attput(ncid, varid, "Comment", NC_CHAR, "");
nc_attput(ncid, varid, "ChanType", NC_CHAR, "DateTime");
}
nc_setfill(ncid, NC_NOFILL);
nc_endef(ncid);
for (i in 1:nCols) {
if (rvDataType[i] == 100) {
rvData = DT_ParseDateTime(smData[;i]);
} else {
rvData = strtod(smData[;i]); // string to double
}
nc_varput(ncid, i-1, 0, nRows, rvData);
}
nc_close(ncid);
return ssNetCDFName;
}
Copyright 1993-1999 University Corporation for Atmospheric
Research/Unidata
Portions of this software were developed by the Unidata Program at the
University Corporation for Atmospheric Research.
Access and use of this software shall impose the following obligations
and understandings on the user. The user is granted the right, without
any fee or cost, to use, copy, modify, alter, enhance and distribute
this software, and any derivative works thereof, and its supporting
documentation for any purpose whatsoever, provided that this entire
notice appears in all copies of the software, derivative works and
supporting documentation. Further, UCAR requests that the user credit
UCAR/Unidata in any publications that result from the use of this
software or in any product that includes this software. The names UCAR
and/or Unidata, however, may not be used in any advertising or
publicity to endorse or promote any products or commercial entity
unless specific written permission is obtained from UCAR/Unidata. The
user also understands that UCAR/Unidata is not obligated to provide
the user with any support, consulting, training or assistance of any
kind with regard to the use, operation and performance of this
software nor to provide the user with any updates, revisions, new
versions or "bug fixes."
THIS SOFTWARE IS PROVIDED BY UCAR/UNIDATA "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL UCAR/UNIDATA BE LIABLE FOR ANY SPECIAL,
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.
http://www.unidata.ucar.edu/software/netcdf/
id-1707929