Test of class NcFileMetaCF.
#include <iostream>
using std::cout;
using std::endl;
#include "netcdf4"
char const *
const ncFileName =
"Test_NcFileMetaCF.nc";
void Fill (MetadataCFGlobal & meta)
{
meta.title = "data for title";
meta.institution = "data for institution";
meta.contact = "data for contact";
meta.copyright = "data for copyright";
meta.conventions = "data for conventions";
meta.references = "data for references";
meta.source = "data for source";
meta.comment = "data for comment";
meta.history = "data for history";
}
{
cout << "Test of class NcFileMetaCF." << endl;
try
{
cout <<
"Creating netCDF file: " <<
ncFileName << endl;
MetadataCFGlobal metadata1;
cout << metadata1 << endl;
cout << "Test writing global metadata:" << endl;
NcFileMetaCF metaFile (ncFile);
metaFile << metadata1;
cout << "Test reading global metadata:" << endl;
MetadataCFGlobal metadata2;
metaFile >> metadata2;
cout << metadata2 << endl;
cout << "metadata1 == metadata2 ? "
<< ( metadata1 == metadata2 ? "true" : "false" )
<< endl;
}
catch (std::exception const & e)
{
cout << "Exception: " << e.what() << endl;
}
catch (...)
{
cout << "Error: unknown error." << endl;
}
cout << "\n all done!" << endl;
return 0;
}