-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#9773: import StimPlan time series data.
- Loading branch information
Showing
14 changed files
with
373 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
ApplicationLibCode/Commands/RicImportStimPlanSummaryCaseFeature.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
///////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Copyright (C) 2023- Equinor ASA | ||
// | ||
// ResInsight is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY | ||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. | ||
// | ||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> | ||
// for more details. | ||
// | ||
///////////////////////////////////////////////////////////////////////////////// | ||
|
||
#include "RicImportStimPlanSummaryCaseFeature.h" | ||
|
||
#include "RiaApplication.h" | ||
|
||
#include "RimCsvSummaryCase.h" | ||
#include "RimOilField.h" | ||
#include "RimProject.h" | ||
#include "RimSummaryCaseCollection.h" | ||
#include "RimSummaryCaseMainCollection.h" | ||
|
||
#include "RiuFileDialogTools.h" | ||
|
||
#include <QAction> | ||
|
||
CAF_CMD_SOURCE_INIT( RicImportStimPlanSummaryCaseFeature, "RicImportStimPlanSummaryCaseFeature" ); | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
bool RicImportStimPlanSummaryCaseFeature::isCommandEnabled() | ||
{ | ||
return true; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
void RicImportStimPlanSummaryCaseFeature::onActionTriggered( bool isChecked ) | ||
{ | ||
RiaApplication* app = RiaApplication::instance(); | ||
RimProject* project = app->project(); | ||
|
||
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : nullptr; | ||
if ( !sumCaseColl ) return; | ||
|
||
QString pattern = "StimPlan Summary Files (*.csv)"; | ||
QString defaultDir = app->lastUsedDialogDirectory( "SUMMARY_CASE_DIR" ); | ||
QStringList filePaths = RiuFileDialogTools::getOpenFileNames( nullptr, "Import Data File", defaultDir, pattern ); | ||
for ( const QString& filePath : filePaths ) | ||
{ | ||
auto newSumCase = new RimCsvSummaryCase(); | ||
newSumCase->setFileType( RimCsvSummaryCase::FileType::STIMPLAN ); | ||
newSumCase->setSummaryHeaderFileName( filePath ); | ||
newSumCase->updateOptionSensitivity(); | ||
project->assignCaseIdToSummaryCase( newSumCase ); | ||
|
||
sumCaseColl->addCase( newSumCase ); | ||
} | ||
|
||
sumCaseColl->loadAllSummaryCaseData(); | ||
sumCaseColl->updateConnectedEditors(); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
void RicImportStimPlanSummaryCaseFeature::setupActionLook( QAction* actionToSetup ) | ||
{ | ||
actionToSetup->setIcon( QIcon( ":/SummaryCase.svg" ) ); | ||
actionToSetup->setText( "Import StimPlan Summary Case" ); | ||
} |
34 changes: 34 additions & 0 deletions
34
ApplicationLibCode/Commands/RicImportStimPlanSummaryCaseFeature.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
///////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Copyright (C) 2023- Equinor ASA | ||
// | ||
// ResInsight is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY | ||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. | ||
// | ||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> | ||
// for more details. | ||
// | ||
///////////////////////////////////////////////////////////////////////////////// | ||
|
||
#pragma once | ||
|
||
#include "cafCmdFeature.h" | ||
|
||
//================================================================================================== | ||
/// | ||
//================================================================================================== | ||
class RicImportStimPlanSummaryCaseFeature : public caf::CmdFeature | ||
{ | ||
CAF_CMD_HEADER_INIT; | ||
|
||
protected: | ||
bool isCommandEnabled() override; | ||
void onActionTriggered( bool isChecked ) override; | ||
void setupActionLook( QAction* actionToSetup ) override; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
ApplicationLibCode/FileInterface/RifStimPlanCsvSummaryReader.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
///////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Copyright (C) 2023- Equinor ASA | ||
// | ||
// ResInsight is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY | ||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. | ||
// | ||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> | ||
// for more details. | ||
// | ||
///////////////////////////////////////////////////////////////////////////////// | ||
|
||
#include "RifStimPlanCsvSummaryReader.h" | ||
|
||
#include "RiaDateStringParser.h" | ||
#include "RiaLogging.h" | ||
#include "RiaQDateTimeTools.h" | ||
|
||
#include "RifCsvUserDataParser.h" | ||
#include "RifEclipseUserDataKeywordTools.h" | ||
#include "RifEclipseUserDataParserTools.h" | ||
|
||
#include "SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h" | ||
|
||
#include "cafUtils.h" | ||
|
||
#include <QDateTime> | ||
#include <QFile> | ||
#include <QTextStream> | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
RifStimPlanCsvSummaryReader::RifStimPlanCsvSummaryReader() | ||
{ | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
RifStimPlanCsvSummaryReader::~RifStimPlanCsvSummaryReader() | ||
{ | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------- | ||
/// | ||
//-------------------------------------------------------------------------------------------------- | ||
bool RifStimPlanCsvSummaryReader::parse( const QString& fileName, const QDateTime& startDateTime, QString* errorText ) | ||
{ | ||
m_allResultAddresses.clear(); | ||
m_mapFromAddressToResultIndex.clear(); | ||
|
||
AsciiDataParseOptions parseOptions; | ||
parseOptions.useCustomDateTimeFormat = true; | ||
parseOptions.dateTimeFormat = "m.zzz"; | ||
parseOptions.cellSeparator = ","; | ||
parseOptions.decimalSeparator = "."; | ||
parseOptions.timeSeriesColumnName = "Time"; | ||
parseOptions.startDateTime = startDateTime; | ||
|
||
m_parser = std::unique_ptr<RifCsvUserDataFileParser>( new RifCsvUserDataFileParser( fileName, errorText ) ); | ||
if ( !m_parser->parse( parseOptions ) ) | ||
{ | ||
RiaLogging::error( QString( "Failed to parse file" ) ); | ||
return false; | ||
} | ||
|
||
buildTimeStepsAndMappings(); | ||
|
||
return true; | ||
} |
39 changes: 39 additions & 0 deletions
39
ApplicationLibCode/FileInterface/RifStimPlanCsvSummaryReader.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
///////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Copyright (C) 2023- Equinor ASA | ||
// | ||
// ResInsight is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY | ||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. | ||
// | ||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> | ||
// for more details. | ||
// | ||
///////////////////////////////////////////////////////////////////////////////// | ||
|
||
#pragma once | ||
|
||
#include "RifCsvSummaryReader.h" | ||
|
||
class QString; | ||
|
||
class RifCsvUserDataParser; | ||
class RifEclipseSummaryAddress; | ||
|
||
//================================================================================================== | ||
// | ||
// | ||
//================================================================================================== | ||
class RifStimPlanCsvSummaryReader : public RifCsvSummaryReader | ||
{ | ||
public: | ||
RifStimPlanCsvSummaryReader(); | ||
~RifStimPlanCsvSummaryReader() override; | ||
|
||
bool parse( const QString& fileName, const QDateTime& startDateTime, QString* errorText = nullptr ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.