Ejemplo n.º 1
0
//--------------------------------------------------------------------------------------------------
/// Read JSON or ascii file containing well path data
//--------------------------------------------------------------------------------------------------
bool RimFileWellPath::readWellPathFile(QString* errorMessage, RifWellPathImporter* wellPathImporter)
{
    if (caf::Utils::fileExists(m_filepath()))
    {
        RifWellPathImporter::WellData wellData = wellPathImporter->readWellData(m_filepath(), m_wellPathIndexInFile());
        RifWellPathImporter::WellMetaData wellMetaData = wellPathImporter->readWellMetaData(m_filepath(), m_wellPathIndexInFile());
        // General well info

        setName(wellData.m_name);
        id = wellMetaData.m_id;
        sourceSystem = wellMetaData.m_sourceSystem;
        utmZone = wellMetaData.m_utmZone;
        updateUser = wellMetaData.m_updateUser;
        setSurveyType(wellMetaData.m_surveyType);
        updateDate = wellMetaData.m_updateDate.toString("d MMMM yyyy");

        setWellPathGeometry(wellData.m_wellPathGeometry.p());
        return true;
    }
    else
    {
        if (errorMessage) (*errorMessage) = "Could not find the well path file: " + m_filepath();
        return false;
    }
}
Ejemplo n.º 2
0
//--------------------------------------------------------------------------------------------------
/// Read JSON file containing well path data
//--------------------------------------------------------------------------------------------------
void RimWellPath::readJsonWellPathFile()
{
    RigWellPath* wellPathGeom = new RigWellPath();
    ResInsightInternalJson::JsonReader jsonReader;
    QMap<QString, QVariant> jsonMap = jsonReader.decodeFile(filepath);

    // General well info

    name            = jsonMap["name"].toString();
    id              = jsonMap["id"].toString();
    sourceSystem    = jsonMap["sourceSystem"].toString();
    utmZone         = jsonMap["utmZone"].toString();
    updateUser      = jsonMap["updateUser"].toString();

    setSurveyType(jsonMap["surveyType"].toString());

    // Convert updateDate from the following format:
    // "Number of milliseconds elapsed since midnight Coordinated Universal Time (UTC) 
    // of January 1, 1970, not counting leap seconds"

    QString updateDateStr = jsonMap["updateDate"].toString().trimmed();
    uint updateDateUint = updateDateStr.toULongLong() / 1000; // should be within 32 bit, maximum number is 4294967295 which corresponds to year 2106
    QDateTime updateDateTime;
    updateDateTime.setTime_t(updateDateUint);

    updateDate = updateDateTime.toString("d MMMM yyyy");

    // Well path points

    double datumElevation = jsonMap["datumElevation"].toDouble();
    wellPathGeom->setDatumElevation(datumElevation);

    QList<QVariant> pathList = jsonMap["path"].toList();
    foreach (QVariant point, pathList)
    {
        QMap<QString, QVariant> coordinateMap = point.toMap();
        cvf::Vec3d vec3d(coordinateMap["east"].toDouble(), coordinateMap["north"].toDouble(), -(coordinateMap["tvd"].toDouble() - datumElevation));
        wellPathGeom->m_wellPathPoints.push_back(vec3d);
        
        double measuredDepth = coordinateMap["md"].toDouble();
        wellPathGeom->m_measuredDepths.push_back(measuredDepth);
    }