#12927 Add optional time threshold before creating ESMRY

When checking timestamp for ESMRY vs SMSPEC, allow ESMRY to be written before SMSPEC within a given limit in time difference.
This commit is contained in:
Magne Sjaastad committed 2025-10-13 14:35:42 +02:00
1 parent 31088c0ec7
commit 24ca039790
6 files changed
+47 -10

No files matched your search

@@ -91,9 +91,9 @@ bool RifHdf5SummaryExporter::ensureHdf5FileIsCreated( const std::string& smspecF
if ( !std::filesystem::exists( smspecFileName ) ) return false;
bool exportIsRequired = false;
bool h5FileExists = std::filesystem::exists( h5FileName );
bool exportIsRequired = false;
const int timeThresholdInSeconds = 0;
bool h5FileExists = std::filesystem::exists( h5FileName );
if ( !h5FileExists )
{
if ( createHdfIfNotPresent )
@@ -101,7 +101,7 @@ bool RifHdf5SummaryExporter::ensureHdf5FileIsCreated( const std::string& smspecF
exportIsRequired = true;
}
}
else if ( RiaFilePathTools::isFirstOlderThanSecond( h5FileName, smspecFileName ) )
else if ( RiaFilePathTools::isFirstOlderThanSecond( h5FileName, smspecFileName, timeThresholdInSeconds ) )
{
// If both files are present, check if the SMSPEC file is newer than the H5 file. If the SMSPEC file is newer, we abort if it is not
// possible to write to the H5 file
@@ -20,6 +20,7 @@
#include "RiaFilePathTools.h"
#include "RiaLogging.h"
#include "RiaPreferencesSummary.h"
#ifdef _MSC_VER
// Disable warning from external library to make sure treat warnings as error works
@@ -28,9 +29,9 @@
#include "opm/io/eclipse/ESmry.hpp"
#include "opm/io/eclipse/ExtESmry.hpp"
#include "QRegularExpression"
#include <QFile>
#include <QFileInfo>
#include <QRegularExpression>
//--------------------------------------------------------------------------------------------------
///
@@ -181,7 +182,8 @@ bool RifOpmSummaryTools::isEsmryConversionRequired( const QString& fileName )
return true;
}
if ( RiaFilePathTools::isFirstOlderThanSecond( candidateEsmryFileName.toStdString(), smspecFileName.toStdString() ) )
const int timeThresholdInSeconds = RiaPreferencesSummary::current()->esmryTimeThreshold();
if ( RiaFilePathTools::isFirstOlderThanSecond( candidateEsmryFileName.toStdString(), smspecFileName.toStdString(), timeThresholdInSeconds ) )
{
QString root = QFileInfo( smspecFileName ).canonicalPath();