예제 #1
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);
    }
예제 #2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
RifWellPathImporter::WellData RifWellPathImporter::readJsonWellData(const QString& filePath)
{
    ResInsightInternalJson::JsonReader jsonReader;
    QMap<QString, QVariant> jsonMap = jsonReader.decodeFile(filePath);

    double datumElevation = jsonMap["datumElevation"].toDouble();
    QList<QVariant> pathList = jsonMap["path"].toList();
    WellData wellData;
    wellData.m_wellPathGeometry = new RigWellPath;
    wellData.m_wellPathGeometry->setDatumElevation(datumElevation);
    wellData.m_name = jsonMap["name"].toString();

    foreach(QVariant point, pathList)
    {
        QMap<QString, QVariant> coordinateMap = point.toMap();
        cvf::Vec3d vec3d(coordinateMap["east"].toDouble(), coordinateMap["north"].toDouble(), -(coordinateMap["tvd"].toDouble() - datumElevation));
        wellData.m_wellPathGeometry->m_wellPathPoints.push_back(vec3d);
        double measuredDepth = coordinateMap["md"].toDouble();
        wellData.m_wellPathGeometry->m_measuredDepths.push_back(measuredDepth);
    }
예제 #3
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
RifWellPathImporter::WellMetaData RifWellPathImporter::readJsonWellMetaData(const QString & filePath)
{
    ResInsightInternalJson::JsonReader jsonReader;
    QMap<QString, QVariant> jsonMap = jsonReader.decodeFile(filePath);
    WellMetaData metadata;

    metadata.m_id = jsonMap["id"].toString();
    metadata.m_name = jsonMap["name"].toString();
    metadata.m_sourceSystem = jsonMap["sourceSystem"].toString();
    metadata.m_utmZone = jsonMap["utmZone"].toString();
    metadata.m_updateUser = jsonMap["updateUser"].toString();
    metadata.m_surveyType = 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
    metadata.m_updateDate.setTime_t(updateDateUint);

    return metadata;
}