//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimWellLogFileCurve::onLoadDataAndUpdate(bool updateParentPlot) { this->RimPlotCurve::updateCurvePresentation(updateParentPlot); if (isCurveVisible()) { m_curveData = new RigWellLogCurveData; RimWellLogPlot* wellLogPlot; firstAncestorOrThisOfType(wellLogPlot); CVF_ASSERT(wellLogPlot); if (m_wellPath && m_wellLogFile) { RigWellLogFile* wellLogFile = m_wellLogFile->wellLogFileData(); if (wellLogFile) { std::vector<double> values = wellLogFile->values(m_wellLogChannnelName); std::vector<double> measuredDepthValues = wellLogFile->depthValues(); if (wellLogPlot && wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH) { bool canUseTvd = false; if (wellLogFile->hasTvdChannel()) { std::vector<double> tvdMslValues = wellLogFile->tvdMslValues(); if (values.size() == measuredDepthValues.size() && values.size() == tvdMslValues.size()) { m_curveData->setValuesWithTVD(values, measuredDepthValues, tvdMslValues, wellLogFile->depthUnit(), false); canUseTvd = true; } } if (!canUseTvd) { RigWellPath* rigWellPath = m_wellPath->wellPathGeometry(); if (rigWellPath) { std::vector<double> trueVerticeldepthValues; for (double measuredDepthValue : measuredDepthValues) { trueVerticeldepthValues.push_back(-rigWellPath->interpolatedPointAlongWellPath(measuredDepthValue).z()); } if (values.size() == trueVerticeldepthValues.size() && values.size() == measuredDepthValues.size()) { m_curveData->setValuesWithTVD(values, measuredDepthValues, trueVerticeldepthValues, wellLogFile->depthUnit(), false); canUseTvd = true; } } } if (!canUseTvd) { if (RiaApplication::instance()->preferences()->showLasCurveWithoutTvdWarning()) { QString tmp = QString("Display of True Vertical Depth (TVD) for LAS curves is not possible without a well log path, and the LAS curve will be hidden in this mode.\n\n"); tmp += "Control display of this warning from \"Preferences->Show LAS curve without TVD warning\""; QMessageBox::warning(nullptr, "LAS curve without TVD", tmp); } } } else { if (values.size() == measuredDepthValues.size()) { m_curveData->setValuesAndMD(values, measuredDepthValues, wellLogFile->depthUnit(), false); } } } if (m_isUsingAutoName) { m_qwtPlotCurve->setTitle(createCurveAutoName()); } } RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_METER; if (wellLogPlot) { displayUnit = wellLogPlot->depthUnit(); } if (wellLogPlot && wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH) { m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->trueDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size())); } else { m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->measuredDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size())); } m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices()); updateZoomInParentPlot(); if (m_parentQwtPlot) m_parentQwtPlot->replot(); } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimWellLogExtractionCurve::onLoadDataAndUpdate(bool updateParentPlot) { this->RimPlotCurve::updateCurvePresentation(updateParentPlot); if (isCurveVisible()) { // Make sure we have set correct case data into the result definitions. bool isUsingPseudoLength = false; RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value()); RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value()); m_eclipseResultDefinition->setEclipseCase(eclipseCase); m_geomResultDefinition->setGeoMechCase(geomCase); clampBranchIndex(); RimMainPlotCollection* mainPlotCollection; this->firstAncestorOrThisOfTypeAsserted(mainPlotCollection); RimWellLogPlotCollection* wellLogCollection = mainPlotCollection->wellLogPlotCollection(); cvf::ref<RigEclipseWellLogExtractor> eclExtractor; if (eclipseCase) { if (m_trajectoryType == WELL_PATH) { eclExtractor = wellLogCollection->findOrCreateExtractor(m_wellPath, eclipseCase); } else { std::vector<const RigWellPath*> simWellBranches = simulationWellBranches(); if (m_branchIndex >= 0 && m_branchIndex < static_cast<int>(simWellBranches.size())) { auto wellBranch = simWellBranches[m_branchIndex]; eclExtractor = wellLogCollection->findOrCreateSimWellExtractor(m_simWellName, eclipseCase->caseUserDescription(), wellBranch, eclipseCase->eclipseCaseData()); if (eclExtractor.notNull()) { m_wellPathsWithExtractors.push_back(wellBranch); } isUsingPseudoLength = true; } } } cvf::ref<RigGeoMechWellLogExtractor> geomExtractor = wellLogCollection->findOrCreateExtractor(m_wellPath, geomCase); std::vector<double> values; std::vector<double> measuredDepthValues; std::vector<double> tvDepthValues; RiaDefines::DepthUnitType depthUnit = RiaDefines::UNIT_METER; if (eclExtractor.notNull() && eclipseCase) { measuredDepthValues = eclExtractor->measuredDepth(); tvDepthValues = eclExtractor->trueVerticalDepth(); m_eclipseResultDefinition->loadResult(); cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createFromResultDefinition(eclipseCase->eclipseCaseData(), 0, m_timeStep, m_eclipseResultDefinition); if (resAcc.notNull()) { eclExtractor->curveData(resAcc.p(), &values); } RiaEclipseUnitTools::UnitSystem eclipseUnitsType = eclipseCase->eclipseCaseData()->unitsType(); if (eclipseUnitsType == RiaEclipseUnitTools::UNITS_FIELD) { // See https://github.com/OPM/ResInsight/issues/538 depthUnit = RiaDefines::UNIT_FEET; } } else if (geomExtractor.notNull()) // geomExtractor { measuredDepthValues = geomExtractor->measuredDepth(); tvDepthValues = geomExtractor->trueVerticalDepth(); m_geomResultDefinition->loadResult(); geomExtractor->curveData(m_geomResultDefinition->resultAddress(), m_timeStep, &values); } m_curveData = new RigWellLogCurveData; if (values.size() && measuredDepthValues.size()) { if (!tvDepthValues.size()) { m_curveData->setValuesAndMD(values, measuredDepthValues, depthUnit, true); } else { m_curveData->setValuesWithTVD(values, measuredDepthValues, tvDepthValues, depthUnit, true); } } RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_METER; RimWellLogPlot* wellLogPlot; firstAncestorOrThisOfType(wellLogPlot); CVF_ASSERT(wellLogPlot); if (!wellLogPlot) return; displayUnit = wellLogPlot->depthUnit(); if(wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH) { m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->trueDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size())); isUsingPseudoLength = false; } else if (wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH) { m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->measuredDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size())); } m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices()); if (isUsingPseudoLength) { RimWellLogTrack* wellLogTrack; firstAncestorOrThisOfType(wellLogTrack); CVF_ASSERT(wellLogTrack); RiuWellLogTrack* viewer = wellLogTrack->viewer(); if (viewer) { viewer->setDepthTitle("PL/" + wellLogPlot->depthPlotTitle()); } } updateZoomInParentPlot(); setLogScaleFromSelectedResult(); if (m_parentQwtPlot) m_parentQwtPlot->replot(); } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QString RimWellLogFileCurve::createCurveAutoName() { QStringList name; QString unit; bool channelNameAvailable = false; if (m_wellPath) { name.push_back(wellName()); name.push_back("LAS"); if (!m_wellLogChannnelName().isEmpty()) { name.push_back(m_wellLogChannnelName); channelNameAvailable = true; } RigWellLogFile* wellLogFile = m_wellLogFile ? m_wellLogFile->wellLogFileData() : nullptr; if (wellLogFile) { if (channelNameAvailable) { RimWellLogPlot* wellLogPlot; firstAncestorOrThisOfType(wellLogPlot); CVF_ASSERT(wellLogPlot); QString unitName = wellLogFile->wellLogChannelUnitString(m_wellLogChannnelName, wellLogPlot->depthUnit()); if (!unitName.isEmpty()) { name.back() += QString(" [%1]").arg(unitName); } } QString date = wellLogFile->date(); if (!date.isEmpty()) { name.push_back(wellLogFile->date()); } } return name.join(", "); } return "Empty curve"; }