17 const std::vector<ioda::Dimensions_t> &dims,
bool chunk,
bool gzip,
21 std::cout <<
"Testing variable " << varname << std::endl;
22 std::cout <<
"\tCreating..." << std::endl;
35 std::cout <<
"\t\tSuccess.\n\tWriting..." << std::endl;
39 std::cout <<
"\t\tSuccess.\n\tCheck that the variable's chunking options match the reference."
46 if (vChunks.size() != dims.size()) {
47 std::cout <<
"\t\tFailed. Chunk was not set." << std::endl;
50 for (
size_t i = 0;
i < vChunks.size(); ++
i) {
51 if (vChunks[
i] != dims[
i]) {
52 std::cout <<
"\t\tFailed. Chunk size does not match reference." << std::endl;
57 if (!vChunks.empty()) {
58 std::cout <<
"\t\tFailed. Chunk should not be set." << std::endl;
63 std::cout <<
"\t\tSuccess.\n\tCheck compression options." << std::endl;
66 if (gzip != vGZIP.first) {
67 std::cout <<
"\t\tFailed. GZIP enable flag does not match reference." << std::endl;
70 if (gzip && !vGZIP.second) {
71 std::cout <<
"\t\tFailed. GZIP enabled, but at zero compression level." << std::endl;
76 if (szip != std::get<0>(vSZIP)) {
77 std::cout <<
"\t\tFailed. SZIP enable flag does not match reference." << std::endl;
81 std::cout <<
"\t\tSZIP compression was enabled." << std::endl;
86 std::cout <<
"\t\tSuccess." << std::endl;
90 std::cout <<
"\t\tFailed with exception." << std::endl;
95 int main(
int argc,
char **argv) {
104 int good = 0, bad = 0;
106 (testVar<std::string>(
f,
"varlen-string-test", {
"This is a test"}, {1},
false,
false,
false)) ? good++
108 (testVar<int>(
f,
"int-test-nochunks", {1, 2, 3, 4}, {2, 2},
false,
false,
false)) ? good++ : bad++;
109 (testVar<int>(
f,
"int-test-chunks", {2, 3, 4, 5}, {2, 2},
true,
false,
false)) ? good++ : bad++;
110 (testVar<int>(
f,
"int-test-chunks-gzip", {1, -4, 9, -16}, {2, 2},
true,
true,
false)) ? good++ : bad++;
113 (testVar<int>(
f,
"int-test-chunks-szip", {9, 4, 3, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, {4, 4},
118 std::cout <<
"\tSkipping SZIP checks since the backend disables them." << std::endl;
120 std::cout <<
"\n\nSuccesses: " << good <<
"\nFailures: " << bad << std::endl;
121 return (bad) ? 1 : 0;
122 }
catch (
const std::exception &e) {
Structs that describe backend capabilities.
Definitions for setting up backends with file and memory I/O.
Interfaces for ioda::Group and related classes.
Groups are a new implementation of ObsSpaces.
virtual std::vector< Dimensions_t > getChunkSizes() const
Retrieve the chunking options for the Variable.
virtual std::pair< bool, int > getGZIPCompression() const
Retrieve the GZIP compression options for the Variable.
virtual std::tuple< bool, unsigned, unsigned > getSZIPCompression() const
Retrieve the SZIP compression options for the Variable.
virtual Variable write(gsl::span< char > data, const Type &in_memory_dataType, const Selection &mem_selection=Selection::all, const Selection &file_selection=Selection::all)
The fundamental write function. Backends overload this function to implement all write operations.
IODA_DL Group constructFromCmdLine(int argc, char **argv, const std::string &defaultFilename)
This is a wrapper function around the constructBackend function for creating a backend based on comma...
@ Unsupported
The feature causes an exception if used.
int main(int argc, char **argv)
bool testVar(ioda::Group &f, const std::string &varname, const std::vector< T > &data, const std::vector< ioda::Dimensions_t > &dims, bool chunk, bool gzip, bool szip)
IODA_DL void unwind_exception_stack(const std::exception &e, std::ostream &out=std::cerr, int level=0)
Convenience function for unwinding an exception stack.
Used to specify Variable creation-time properties.