aare/examples/numpy_write_example.cpp
Bechir Braham 28d7e8c07a
read write cluster file (#60)
* Read and write cluster files (save work)

* add reading test

* use define for examples env variable and fix ci

* read and write cluster files (working)

* fix cluster CI
2024-04-16 13:14:41 +02:00

28 lines
634 B
C++

// Your First C++ Program
#include "aare/core/Frame.hpp"
#include "aare/examples/defs.hpp"
#include "aare/file_io/File.hpp"
#include <iostream>
using aare::File;
using aare::FileConfig;
using aare::Frame;
int main() {
auto path = std::filesystem::path("/tmp/test.npy");
auto dtype = aare::DType(typeid(uint32_t));
FileConfig const cfg = {dtype, 100, 100};
File npy(path, "w", cfg);
Frame f(100, 100, dtype.bitdepth());
for (int i = 0; i < 10000; i++) {
f.set<uint32_t>(i / 100, i % 100, i);
}
npy.write(f);
f.set<uint32_t>(0, 0, 77);
npy.write(f);
npy.write(f);
return 0;
}