Commit 4f905cb8 authored by Jim King's avatar Jim King Committed by Jørgen Lind
Browse files

several small fixes to make actual data import work

parent 8d0e8201
......@@ -32,7 +32,7 @@ using namespace SEGY;
bool
SEGYFileInfo::Is4D() const
{
return m_segyType == SEGY::SEGYType::Prestack;
return m_segyType == SEGY::SEGYType::Prestack || m_segyType == SEGY::SEGYType::PrestackOffsetSorted;
}
bool
......
......@@ -2183,7 +2183,7 @@ SecondaryKeyDimension(const SEGYFileInfo& fileInfo)
int
PrimaryKeyDimension(const SEGYFileInfo& fileInfo)
{
if (fileInfo.m_segyType == SEGY::SEGYType::Prestack || fileInfo.m_segyType == SEGY::SEGYType::Prestack2D)
if (fileInfo.m_segyType == SEGY::SEGYType::Prestack || fileInfo.m_segyType == SEGY::SEGYType::Prestack2D || fileInfo.m_segyType == SEGY::SEGYType::PrestackOffsetSorted)
{
// Prestack2D doesn't really have a primary key dimension, but we'll use the same one as for Prestack as sort of a placeholder.
return 3;
......@@ -2694,7 +2694,11 @@ main(int argc, char* argv[])
// Check for only a single segment
if (!is2D && fileInfo.m_segmentInfoLists.size() == 1 && fileInfo.m_segmentInfoLists[0].size() == 1)
const bool isOneSegment = fileInfo.IsOffsetSorted()
? fileInfo.m_segmentInfoListsByOffset.size() == 1 && fileInfo.m_segmentInfoListsByOffset[0].size() == 1
: fileInfo.m_segmentInfoLists.size() == 1 && fileInfo.m_segmentInfoLists[0].size() == 1;
if (!is2D && isOneSegment)
{
OpenVDS::printWarning_with_condition_fatal(jsonOutput, !ignoreWarnings, "SegmentInfoList", "Warning: There is only one segment, either this is 2D data or this usually indicates using the wrong header format for the input dataset.", "Use --2d for 2D data. Use --ignore-warnings to force the import to go ahead.");
}
......@@ -3023,7 +3027,9 @@ main(int argc, char* argv[])
// For each input file, find the lower/upper segments and then add data requests to that file's traceDataManager
for (size_t fileIndex = 0; fileIndex < fileInfo.m_segmentInfoLists.size(); ++fileIndex)
const auto segmentInfoListsSize = fileInfo.IsOffsetSorted() ? fileInfo.m_segmentInfoListsByOffset.size() : fileInfo.m_segmentInfoLists.size();
for (size_t fileIndex = 0; fileIndex < segmentInfoListsSize; ++fileIndex)
{
const int
offetSortedOffsetValue = fileInfo.IsOffsetSorted() ? offsetStart + offsetStep * chunkInfo.min[1] : 0;
......@@ -3093,6 +3099,10 @@ main(int argc, char* argv[])
}
}
int64_t
amplitudePageCount = 0L,
traceCopyCount = 0L;
for (int64_t chunk = 0; chunk < amplitudeAccessor->GetChunkCount() && error.code == 0; chunk++)
{
int new_percentage = int(double(chunk) / amplitudeAccessor->GetChunkCount() * 100);
......@@ -3188,7 +3198,9 @@ main(int argc, char* argv[])
assert(!segyTraceHeaderBuffer || segyTraceHeaderPitch[pitchCheckDimension] == SEGY::TraceHeaderSize);
assert(!offsetBuffer || offsetPitch[pitchCheckDimension] == 1);
for (size_t fileIndex = 0; fileIndex < fileInfo.m_segmentInfoLists.size(); ++fileIndex)
const auto segmentInfoListsSize = fileInfo.IsOffsetSorted() ? fileInfo.m_segmentInfoListsByOffset.size() : fileInfo.m_segmentInfoLists.size();
for (size_t fileIndex = 0; fileIndex < segmentInfoListsSize; ++fileIndex)
{
auto result = chunkInfo.lowerUpperSegmentIndices.find(fileIndex);
if (result == chunkInfo.lowerUpperSegmentIndices.end())
......@@ -3323,6 +3335,7 @@ main(int argc, char* argv[])
const int targetOffset = VoxelIndexToDataIndex(fileInfo, primaryIndex, secondaryIndex, tertiaryIndex, chunkInfo.min, amplitudePitch);
copySamples(data, fileInfo.m_dataSampleFormatCode, fileInfo.m_headerEndianness, &reinterpret_cast<float*>(amplitudeBuffer)[targetOffset], chunkInfo.sampleStart, chunkInfo.sampleCount);
++traceCopyCount;
}
if (traceFlagBuffer)
......@@ -3366,6 +3379,9 @@ main(int argc, char* argv[])
traceDataManagers.clear();
dataViewManagers.clear();
fmt::print(stderr, "\nCreated {} amplitude pages\n", amplitudePageCount);
fmt::print(stderr, "Copied {} traces to amplitude pages\n", traceCopyCount);
if (error.code != 0)
{
return EXIT_FAILURE;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment