Exemple #1
0
        /**
         * Parse the specified DOM element and instantiate the properties
         * of this instance.
         *
         * @param element  XML element to parse. Non-null.
         */
        void update(XElement element)
        {
            //throws WitsmlParseException {
            //Debug.Assert(element != null : "element cannot be null";

            // Remove current bulk data
            foreach (witsmllib.WitsmlLogCurve curve in curves)
                ((WitsmlLogCurve)curve).clear();

            // Common data
            XElement commonDataElement = element.Element(element.Name.Namespace + "commonData");//, element.getNamespace());
            if (commonDataElement != null)
                commonData = new WitsmlCommonData(commonDataElement);

            // Index
            indexType = XmlUtil.update(element, "indexType", indexType);
            if (indexType != null)
            {
                if (indexType.ToLower().Contains("time"))
                {
                    startIndex = getIndex(XmlUtil.update(element, "startDateTimeIndex", (String)null));
                    endIndex = getIndex(XmlUtil.update(element, "endDateTimeIndex", (String)null));
                }
                else
                {
                    startIndex = getIndex(XmlUtil.update(element, "startIndex", (String)null));
                    endIndex = getIndex(XmlUtil.update(element, "endIndex", (String)null));
                }
            }

            indexCurveName = XmlUtil.update(element, "indexCurve", indexCurveName);
            _isGrowing = XmlUtil.update(element, "objectGrowing", _isGrowing);
            nRows = XmlUtil.update(element, "dataRowCount", nRows);
            serviceCompany = XmlUtil.update(element, "serviceCompany", serviceCompany);
            runNumber = XmlUtil.update(element, "runNumber", runNumber);
            bhaRunNumber = XmlUtil.update(element, "bhaRunNumber", bhaRunNumber);
            pass = XmlUtil.update(element, "pass", pass);
            creationTime = XmlUtil.update(element, "creationDate", creationTime);
            description = XmlUtil.update(element, "description", description);
            direction = XmlUtil.update(element, "direction", direction);
            stepIncrement = XmlUtil.update(element, "stepIncrement", stepIncrement);
            indexUnit = XmlUtil.update(element, "indexUnits", indexUnit);
            noValue = XmlUtil.update(element, "nullValue", noValue);
            unitNamingSystem = XmlUtil.update(element, "uomNamingSystem", unitNamingSystem);
            comment = XmlUtil.update(element, "otherData", comment);

            // Curve data
            var logCurveInfoElements = element.Elements(element.Name.Namespace + "logCurveInfo");//, element.getNamespace());
            foreach (Object e in logCurveInfoElements)
            {
                XElement logCurveInfoElement = (XElement)e;

                String curveName = XmlUtil.update(logCurveInfoElement, "mnemonic", (String)null);
                Int32? curveNo = XmlUtil.update(logCurveInfoElement, "columnIndex", (Int32?)null);

                WitsmlLogCurve curve = (WitsmlLogCurve)findCurve(curveName);
                if (curve == null)
                {
                    curve = new WitsmlLogCurve(this, curveName, curveNo.Value );
                    curves.Add(curve);
                }

                curve.update(logCurveInfoElement);
            }

            // Bulk data
            XElement logDataElement = element.Element(element.Name.Namespace + "logData"); //, element.getNamespace());
            if (logDataElement != null)
            {
                var dataElements = logDataElement.Elements(element.Name.Namespace + "data"); //, element.getNamespace());

                //for (var j = dataElements.iterator(); j.hasNext(); )
                foreach(var j in dataElements)
                {
                    XElement dataElement = (XElement)j;//.next();

                    String valueString = dataElement.Value.Trim(); //.getTextTrim();

                    String[] tokens = valueString.Split(dataDelimiter); //, -1);
                    for (int i = 0; i < tokens.Length; i++)
                    {
                        String token = tokens[i];
                        if (token.Equals(noValue))
                            token = "";

                        WitsmlLogCurve curve = (witsmllib.v140.WitsmlLogCurve)findCurve(i + 1);
                        curve.addValue(token);
                    }

                    // Handle missing log values
                    for (int i = tokens.Length; i < getNCurves(); i++)
                    {
                        WitsmlLogCurve curve = (witsmllib.v140.WitsmlLogCurve)findCurve(i + 1);
                        curve.addValue(null);
                    }
                }
            }

            unitConvert();
        }
        /**
         * Create a WITSML trajectory station instance from the given
         * XML element node.
         *
         * @param element    XML element to parse. Non-null.
         * @param stationNo  Station number.
         */
        internal WitsmlTrajectoryStation(XElement element, int stationNo)
            : base(stationNo)
        {
            id = element.Attribute("uid").Value;

            time = XmlUtil.update(element, "dTimStn", time);
            type = XmlUtil.update(element, "typeTrajStation", type);
            surveyToolType = XmlUtil.update(element, "surveyToolType", surveyToolType);
            md = XmlUtil.update(element, "md", md);
            tvd = XmlUtil.update(element, "tvd", tvd);
            inclination = XmlUtil.update(element, "incl", inclination);
            azimuth = XmlUtil.update(element, "azi", azimuth);
            toolfaceMagneticAngle = XmlUtil.update(element, "mtf", toolfaceMagneticAngle);
            toolfaceGravityAngle = XmlUtil.update(element, "gtf", toolfaceGravityAngle);
            north = XmlUtil.update(element, "dispNs", north);
            east = XmlUtil.update(element, "dispEw", east);
            verticalSectionDistance = XmlUtil.update(element, "vertSect", verticalSectionDistance);
            dls = XmlUtil.update(element, "dls", dls);
            turnRate = XmlUtil.update(element, "rateTurn", turnRate);
            buildRate = XmlUtil.update(element, "rateBuild", buildRate);
            dMd = XmlUtil.update(element, "mdDelta", dMd);
            dTvd = XmlUtil.update(element, "tvdDelta", dTvd);
            errorModel = XmlUtil.update(element, "modelToolError", errorModel);
            gravityUncertainty = XmlUtil.update(element, "gravTotalUncert", gravityUncertainty);
            dipAngleUncertainty = XmlUtil.update(element, "dipAngleUncert", dipAngleUncertainty);
            magneticUncertainty = XmlUtil.update(element, "magTotalUncert", magneticUncertainty);
            _isAccelerometerCorrectionUsed = XmlUtil.update(element, "gravAccelCorUsed", _isAccelerometerCorrectionUsed);
            _isMagnetometerCorrectionUsed = XmlUtil.update(element, "magXAxialCorUsed", _isMagnetometerCorrectionUsed);
            _isSagCorrectionUsed = XmlUtil.update(element, "sagCorUsed", _isSagCorrectionUsed);
            _isDrillStringMagnetismCorrectionUsed = XmlUtil.update(element, "magDrlstrCorUsed", _isDrillStringMagnetismCorrectionUsed);
            gravitationFieldReference = XmlUtil.update(element, "gravTotalFieldReference", gravitationFieldReference);
            magneticFieldReference = XmlUtil.update(element, "magTotalFieldReference", magneticFieldReference);
            magneticDipAngleReference = XmlUtil.update(element, "magDipAngleReference", magneticDipAngleReference);
            magneticModel = XmlUtil.update(element, "magModelUsed", magneticModel);
            magneticModelValidInterval = XmlUtil.update(element, "magModelValid", magneticModelValidInterval);
            gravitationalModel = XmlUtil.update(element, "geoModelUsed", gravitationalModel);
            status = XmlUtil.update(element, "statusTrajStation", status);

            XElement locationElement = element.Element(element.Name.Namespace+"location"); //, element.getNamespace());
            if (locationElement != null)
                location = new WitsmlLocation(locationElement);

            XElement commonDataElement = element.Element(element.Name.Namespace + "commonData");//, element.getNamespace());
            if (commonDataElement != null)
                commonData = new WitsmlCommonData(commonDataElement);
        }
Exemple #3
0
        /**
         * Parse the specified DOM element and instantiate the properties
         * of this instance.
         *
         * @param element  XML element to parse. Non-null.
         */
        void update(XElement element)
        {
            //Debug.Assert(element != null : "element cannot be null";

            number = XmlUtil.update(element, "number", number);
            apiSuffix = XmlUtil.update(element, "suffixAPI", apiSuffix);
            wellboreNumber = XmlUtil.update(element, "numGovt", wellboreNumber);
            status = XmlUtil.update(element, "statusWellbore", status);
            purpose = XmlUtil.update(element, "purposeWellbore", purpose);
            type = XmlUtil.update(element, "typeWellbore", type);
            shape = XmlUtil.update(element, "shape", shape);
            kickoffTime = XmlUtil.update(element, "dTimKickoff", kickoffTime);
            _isTotalDepthReached = XmlUtil.update(element, "achievedTD", _isTotalDepthReached);
            mdCurrent = XmlUtil.update(element, "mdCurrent", mdCurrent);
            tvdCurrent = XmlUtil.update(element, "tvdCurrent", tvdCurrent);
            mdBitCurrent = XmlUtil.update(element, "mdBitCurrent", mdCurrent);
            tvdBitCurrent = XmlUtil.update(element, "tvdBitCurrent", tvdCurrent);
            mdKickoff = XmlUtil.update(element, "mdKickoff", mdKickoff);
            tvdKickoff = XmlUtil.update(element, "tvdKickoff", tvdKickoff);
            mdPlanned = XmlUtil.update(element, "mdPlanned", mdPlanned);
            tvdPlanned = XmlUtil.update(element, "tvdPlanned", tvdPlanned);
            mdSubSeaPlanned = XmlUtil.update(element, "mdSubSeaPlanned", mdSubSeaPlanned);
            tvdSubSeaPlanned = XmlUtil.update(element, "tvdSubSeaPlanned", tvdSubSeaPlanned);
            nTargetDays = XmlUtil.update(element, "dayTarget", nTargetDays);

            XElement commonDataElement = element.Element(element.Name.Namespace + "commonData");//, element.getNamespace());
            if (commonDataElement != null)
                commonData = new WitsmlCommonData(commonDataElement);
        }
Exemple #4
0
        /**
         * Parse the specified DOM element and instantiate the properties
         * of this instance.
         *
         * @param element  XML element to parse. Non-null.
         */
        void update(XElement element)
        {
            time = XmlUtil.update(element, "dTim", time);
            md = XmlUtil.update(element, "md", md);
            sequenceNumber = XmlUtil.update(element, "sequence", sequenceNumber);
            activityCode = XmlUtil.update(element, "activityCode", activityCode);

            XElement realtimeHeaderElement = element.Element(element.Name.Namespace + "realtimeHeader");//, element.getNamespace());
            if (realtimeHeaderElement != null)
            {
                wellName = XmlUtil.update(realtimeHeaderElement, "nameWell", wellName);
                wellboreName = XmlUtil.update(realtimeHeaderElement, "nameWellbore", wellboreName);
                serviceCompany = XmlUtil.update(realtimeHeaderElement, "serviceCompany", serviceCompany);
                runNumber = XmlUtil.update(realtimeHeaderElement, "runNumber", runNumber);
                creationDate = XmlUtil.update(realtimeHeaderElement, "creationDate", creationDate);
                description = XmlUtil.update(realtimeHeaderElement, "description", description);
            }

            var channelElements = element.Elements(element.Name.Namespace + "channel");//, element.getNamespace());
            foreach (Object subElement in channelElements)
            {
                XElement channelElement = (XElement)subElement;
                WitsmlRealtimeChannel channel = new WitsmlRealtimeChannel(channelElement);

                channels.Add(channel);
            }

            XElement commonDataElement = element.Element(element.Name.Namespace + "commonData");//, element.getNamespace());
            if (commonDataElement != null)
                commonData = new WitsmlCommonData(commonDataElement);
        }
Exemple #5
0
        /**
         * Parse the specified DOM element and instantiate the properties
         * of this instance.
         *
         * @param element  XML element to parse. Non-null.
         */
        void update(XElement element)
        {
            //Debug.Assert(element != null : "element cannot be null";

            legalName = XmlUtil.update(element, "nameLegal", legalName);
            licenseNumber = XmlUtil.update(element, "numLicense", licenseNumber);
            wellNumber = XmlUtil.update(element, "numGovt", wellNumber);
            licenseIssueTime = XmlUtil.update(element, "dTimLicense", licenseIssueTime);
            field = XmlUtil.update(element, "field", field);
            country = XmlUtil.update(element, "country", country);
            state = XmlUtil.update(element, "state", state);
            county = XmlUtil.update(element, "county", county);
            region = XmlUtil.update(element, "region", region);
            district = XmlUtil.update(element, "district", district);
            block = XmlUtil.update(element, "block", block);
            timeZone = XmlUtil.update(element, "timeZone", timeZone);
            @operator = XmlUtil.update(element, "operator", @operator);
            operatorDivision = XmlUtil.update(element, "operatorDiv", operatorDivision);
            operatorInterestShare = XmlUtil.update(element, "pcInterest", operatorInterestShare);
            apiNumber = XmlUtil.update(element, "numAPI", apiNumber);
            status = XmlUtil.update(element, "statusWell", status);
            purpose = XmlUtil.update(element, "purposeWell", purpose);
            fluidType = XmlUtil.update(element, "fluidWell", fluidType);
            flowDirection = XmlUtil.update(element, "directionWell", flowDirection);
            spudTime = XmlUtil.update(element, "dTimSpud", spudTime);
            pluggedTime = XmlUtil.update(element, "dTimPa", pluggedTime);
            wellHeadElevation = XmlUtil.update(element, "wellheadElevation", wellHeadElevation);
            groundElevation = XmlUtil.update(element, "groundElevation", groundElevation);
            waterDepth = XmlUtil.update(element, "waterDepth", waterDepth);

            XElement locationElement = element.Element(element.Name.Namespace+"wellLocation");//, element.getNamespace());
            if (locationElement != null)
                location = new WitsmlLocation(locationElement);

            XElement commonDataElement = element.Element(element.Name.Namespace+"commonData"); //, element.getNamespace());
            if (commonDataElement != null)
                commonData = new WitsmlCommonData(commonDataElement);
        }
        private static WitsmlTrajectories CreateTrajectoryQuery(string wellUid, string wellName, string wellboreUid, string wellboreName, string name,
                                                                IEnumerable <WitsmlTrajectoryStation> trajectoryStations, WitsmlCommonData commonData, string aziRef, WitsmlMeasuredDepthCoord mdMin, WitsmlMeasuredDepthCoord mdMax,
                                                                string dTimTrajectoryStart, string dTimTrajectoryEnd)
        {
            var tStations = trajectoryStations.Select(trajectoryStation => new WitsmlTrajectoryStation()
            {
                Uid             = Guid.NewGuid().ToString(),
                DTimStn         = trajectoryStation.DTimStn,
                TypeTrajStation = trajectoryStation.TypeTrajStation,
                Md         = trajectoryStation.Md,
                Tvd        = trajectoryStation.Tvd,
                Incl       = trajectoryStation.Incl,
                Azi        = trajectoryStation.Azi,
                DispNs     = trajectoryStation.DispNs,
                DispEw     = trajectoryStation.DispEw,
                VertSect   = trajectoryStation.VertSect,
                Dls        = trajectoryStation.Dls,
                CommonData = trajectoryStation.CommonData
            }).ToList();

            var trajectories = new WitsmlTrajectories()
            {
                Trajectories = new WitsmlTrajectory()
                {
                    UidWell            = wellUid,
                    NameWell           = wellName,
                    UidWellbore        = wellboreUid,
                    NameWellbore       = wellboreName,
                    Name               = name,
                    Uid                = Guid.NewGuid().ToString(),
                    DTimTrajStart      = dTimTrajectoryStart,
                    DTimTrajEnd        = dTimTrajectoryEnd,
                    MdMin              = mdMin,
                    MdMax              = mdMax,
                    AziRef             = aziRef,
                    TrajectoryStations = tStations,
                    CommonData         = commonData
                }.AsSingletonList()
            };

            return(trajectories);
        }