|
OpenZGY/C++ API and Internals (ALPHA)
Access seismic data stored in ZGY format.
|
Go to the documentation of this file.
15 #include <openzgy/api.h>
28 void copy(
const std::string& srcname,
const std::string& dstname)
34 const std::array<std::int64_t,3> size = r->
size();
35 const std::array<std::int64_t,3> brick = r->
bricksize();
36 const std::array<std::int64_t,3> bs{brick[0], brick[1], size[2]};
37 const std::int64_t total = ((size[0] + bs[0] - 1) / bs[0]) *
38 ((size[1] + bs[1] - 1) / bs[1]);
40 std::unique_ptr<float> buf(
new float[bs[0]*bs[1]*bs[2]]);
41 std::array<std::int64_t,3> pos;
42 for (pos[0] = 0; pos[0] < size[0]; pos[0] += bs[0]) {
43 for (pos[1] = 0; pos[1] < size[1]; pos[1] += bs[1]) {
44 for (pos[2] = 0; pos[2] < size[2]; pos[2] += bs[2]) {
45 r->
read(pos, bs, buf.get(), 0);
46 w->
write(pos, bs, buf.get());
51 w->
finalize(std::vector<DecimationType>(), p2);
55 int main(
int argc,
const char **argv)
58 std::cerr <<
"Usage: " << argv[0] <<
" infile outfile" << std::endl;
62 copy(argv[1], argv[2]);
64 catch (
const std::exception& ex) {
65 std::cerr << argv[0] <<
": " << ex.what() << std::endl;
Argument package for creating a ZGY file.
Definition: api.h:388
virtual void write(const size3i_t &start, const size3i_t &size, const float *data) const =0
Write an arbitrary region.
Simple progress bar.
Definition: api.h:814
virtual void finalize(const std::vector< DecimationType > &decimation=std::vector< DecimationType >(), const std::function< bool(std::int64_t, std::int64_t)> &progress=nullptr, bool force=false)=0
Generate low resolution data, statistics, and histogram.
The entire public API is in this namespace.
Definition: api.cpp:68
virtual size3i_t bricksize() const =0
Size of one brick. Almost always (64,64,64), change at your own peril.
virtual void close()=0
Flush the file to disk and close it.
virtual void read(const size3i_t &start, const size3i_t &size, float *data, int lod=0) const =0
Read an arbitrary region.
virtual size3i_t size() const =0
Size in inline, crossline, vertical directions.
static std::shared_ptr< IZgyReader > open(const std::string &filename, const IOContext *iocontext=nullptr)
Open a ZGY file for reading.
Definition: api.cpp:1183
static std::shared_ptr< IZgyWriter > open(const ZgyWriterArgs &args)
Create a ZGY file and open it for writing.
Definition: api.cpp:1189