// // vdfcreate code snippet that demonstrates creating a simple .vdf file // with multiple time steps and 3d variables, both with uniform sampling // { // Initialize VDC object. Data will be stored in NetCDF files. // n.b. no current plans for supporting other file formats // VDC vdc(VDC::NETCDF4); // Open the VDC master file for writing. Have to specify how // many compression ratios we will have // status = vdc.Initialize(masterpath, "w"); // Set up compression parameters. We will use the same ones for all // variables. Ditto for boundary periodicity // vdc.SetCompressionBlock(opt.bs, opt.wname, opt.wmode, opt.cratios()); vdc.SetPeriodicBoundary(opt.periodic); // All 3D variables have the same dimensions, named "x", "y", and "z", // plus time, "t" // vector dimnames; dimnames.push_back("x"); dimnames.push_back("y"); dimnames.push_back("z"); dimnames.push_back("t"); // Dimension lenths. // vector dimlens; dimlens.push_back(opt.dims[0]); dimlens.push_back(opt.dims[1]); dimlens.push_back(opt.dims[2]); dimlens.push_back(opt.numts); // Identify the axis for each dimension // vector axes; axes.push_back(VDC:X); axes.push_back(VDC:Y); axes.push_back(VDC:Z); axes.push_back(VDC:T); // Each dimension in the VDC has a 1D coordinate variable of the same // name. // vector coordnames; coordnames.push_back(dimnames[0]); coordnames.push_back(dimnames[1]); coordnames.push_back(dimnames[2]); coordnames.push_back(dimnames[3]); // Define dimensions and 1D coordinate variable associated with the // dimension. The DefineDimension() method both defines a dimension // name and length, as well as a 1D coordinate variable, of the same // name, with uniform sampling. // // Here we only have 4: x, y, z, and time (t) // for (int i=0; i