Skip to content

Commit

Permalink
readSEGYSTACK recreates volD with optimal chunking
Browse files Browse the repository at this point in the history
  • Loading branch information
kerim371 committed Apr 29, 2023
1 parent af26849 commit 9d280b1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/h5geo/h5vol.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class H5Vol : public H5BaseObject
virtual bool recreateVolD(
size_t nX, size_t nY, size_t nZ,
size_t xChunk, size_t yChunk, size_t zChunk,
size_t compressionLevel) = 0;
unsigned compressionLevel) = 0;
};

using H5Vol_ptr = std::unique_ptr<H5Vol, h5geo::ObjectDeleter>;
Expand Down
2 changes: 1 addition & 1 deletion include/h5geo/private/h5volimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class H5VolImpl : public H5BaseObjectImpl<H5Vol>
virtual bool recreateVolD(
size_t nX, size_t nY, size_t nZ,
size_t xChunk, size_t yChunk, size_t zChunk,
size_t compressionLevel) override;
unsigned compressionLevel) override;

//----------- FRIEND CLASSES -----------
friend class H5VolContainerImpl;
Expand Down
15 changes: 13 additions & 2 deletions src/h5geo/h5core_segy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1143,13 +1143,24 @@ bool readSEGYSTACK(
return false;

size_t nil = dv.quot;
if (!vol->resize(nxl, nil, nSamp))

// Recreate volume dataset with optimal chunking.
// Without this 2D volume may work extremely slow.
H5VolParam vp = vol->getParam();
vp.nX = nxl;
vp.nY = nil;
vp.nZ = nSamp;
vp.xChunkSize = std::min(vp.xChunkSize, nxl);
vp.yChunkSize = std::min(vp.yChunkSize, nil);
vp.zChunkSize = std::min(vp.zChunkSize, nSamp);
if (!vol->recreateVolD(vp.nX, vp.nY, vp.nZ,
vp.xChunkSize, vp.yChunkSize, vp.zChunkSize,
vp.compression_level))
return false;

// N - number of slices written at once (usually
// should be equal to Y-chunkSize to acieve best IO speed)
size_t N = 64;
H5VolParam vp = vol->getParam();
if (vp.yChunkSize > 0 &&
vp.nY > 0 &&
vp.yChunkSize < vp.nY){
Expand Down
2 changes: 1 addition & 1 deletion src/h5geo/h5volimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ bool H5VolImpl::exportToSEGY(
bool H5VolImpl::recreateVolD(
size_t nX, size_t nY, size_t nZ,
size_t xChunk, size_t yChunk, size_t zChunk,
size_t compressionLevel)
unsigned compressionLevel)
{
if (nX < 1 || nY < 1 || nZ < 1)
return false;
Expand Down

0 comments on commit 9d280b1

Please sign in to comment.