26 static const int NX = 6;
27 static const int NY = 12;
30 static const int NC_ERR = 2;
39 for(
int i = 0; i < NX; i++)
40 for(
int j = 0; j < NY; j++)
41 dataOut[i][j] = i * NY + j;
50 NcFile dataFile(filename, NcFile::replace, format);
53 NcDim xDim = dataFile.addDim(
"x", NX);
54 NcDim yDim = dataFile.addDim(
"y", NY);
61 NcVar data = dataFile.addVar(
"data", ncInt, dims);
65 if(format != NcFile::nc4)
89 if(ret = create_file(
"simple_xy_nc4.nc", NcFile::nc4))
91 cout <<
"*** SUCCESS creating nc4 file" << endl;
93 if(ret = create_file(
"simple_xy_nc4classic.nc", NcFile::nc4classic))
95 cout <<
"*** SUCCESS creating nc4classic file" << endl;
97 if(ret = create_file(
"simple_xy_classic.nc", NcFile::classic))
99 cout <<
"*** SUCCESS creating classic file" << endl;
101 if(ret = create_file(
"simple_xy_classic64.nc", NcFile::classic64))
103 cout <<
"*** SUCCESS creating classic64 file" << endl;
Class represents a netCDF dimension.
Base object is thrown if a netCDF exception is encountered.
void putVar(const void *dataValues) const
This is an overloaded member function, provided for convenience.
Class represents a netCDF variable.
Class represents a netCDF root group.