Ejemplo n.º 1
0
        public async Task <Wellbore> GetWellbore(string wellUid, string wellboreUid)
        {
            var query  = WellboreQueries.GetWitsmlWellboreByUid(wellUid, wellboreUid);
            var result = await WitsmlClient.GetFromStoreAsync(query, new OptionsIn(ReturnElements.All));

            var witsmlWellbore = result.Wellbores.FirstOrDefault();

            if (witsmlWellbore == null)
            {
                return(null);
            }

            return(new Wellbore
            {
                Uid = witsmlWellbore.Uid,
                Name = witsmlWellbore.Name,
                WellUid = witsmlWellbore.UidWell,
                WellName = witsmlWellbore.NameWell,
                Number = witsmlWellbore.Number,
                SuffixAPI = witsmlWellbore.SuffixAPI,
                NumGovt = witsmlWellbore.NumGovt,
                WellStatus = witsmlWellbore.StatusWellbore,
                WellborePurpose = witsmlWellbore.PurposeWellbore,
                WellboreParentUid = witsmlWellbore.ParentWellbore?.UidRef,
                WellboreParentName = witsmlWellbore.ParentWellbore?.Value,
                WellType = witsmlWellbore.TypeWellbore,
                Shape = witsmlWellbore.Shape,
                DTimeKickoff = string.IsNullOrEmpty(witsmlWellbore.DTimKickoff) ? null : StringHelpers.ToDateTime(witsmlWellbore.DTimKickoff),
                Md = (witsmlWellbore.Md == null) ? null : new LengthMeasure {
                    Uom = witsmlWellbore.Md.Uom, Value = decimal.Parse(witsmlWellbore.Md.Value)
                },
                Tvd = (witsmlWellbore.Tvd == null) ? null : new LengthMeasure {
                    Uom = witsmlWellbore.Tvd.Uom, Value = decimal.Parse(witsmlWellbore.Tvd.Value)
                },
                MdKickoff = (witsmlWellbore.MdKickoff == null) ? null : new LengthMeasure {
                    Uom = witsmlWellbore.MdKickoff.Uom, Value = decimal.Parse(witsmlWellbore.MdKickoff.Value)
                },
                TvdKickoff = (witsmlWellbore.TvdKickoff == null) ? null : new LengthMeasure {
                    Uom = witsmlWellbore.TvdKickoff.Uom, Value = decimal.Parse(witsmlWellbore.TvdKickoff.Value)
                },
                MdPlanned = (witsmlWellbore.MdPlanned == null) ? null : new LengthMeasure {
                    Uom = witsmlWellbore.MdPlanned.Uom, Value = decimal.Parse(witsmlWellbore.MdPlanned.Value)
                },
                TvdPlanned = (witsmlWellbore.TvdPlanned == null) ? null : new LengthMeasure {
                    Uom = witsmlWellbore.TvdPlanned.Uom, Value = decimal.Parse(witsmlWellbore.TvdPlanned.Value)
                },
                MdSubSeaPlanned = (witsmlWellbore.MdSubSeaPlanned == null) ? null : new LengthMeasure {
                    Uom = witsmlWellbore.MdSubSeaPlanned.Uom, Value = decimal.Parse(witsmlWellbore.MdSubSeaPlanned.Value)
                },
                TvdSubSeaPlanned = (witsmlWellbore.TvdSubSeaPlanned == null) ? null : new LengthMeasure {
                    Uom = witsmlWellbore.TvdSubSeaPlanned.Uom, Value = decimal.Parse(witsmlWellbore.TvdSubSeaPlanned.Value)
                },
                DayTarget = (witsmlWellbore.DayTarget == null) ? null : new DayMeasure {
                    Uom = witsmlWellbore.DayTarget.Uom, Value = int.Parse(witsmlWellbore.DayTarget.Value)
                },
                DateTimeCreation = StringHelpers.ToDateTime(witsmlWellbore.CommonData.DTimCreation),
                DateTimeLastChange = StringHelpers.ToDateTime(witsmlWellbore.CommonData.DTimLastChange),
                ItemState = witsmlWellbore.CommonData.ItemState
            });
        }
Ejemplo n.º 2
0
        public async Task <IEnumerable <LogObject> > GetLogs(string wellUid, string wellboreUid)
        {
            var query  = LogQueries.QueryByWellbore(wellUid, wellboreUid);
            var result = await WitsmlClient.GetFromStoreAsync(query, OptionsIn.HeaderOnly);

            return(result.Logs.Select(log =>
                                      new LogObject
            {
                Uid = log.Uid,
                Name = log.Name,
                IndexType = log.IndexType,
                WellUid = log.UidWell,
                WellName = log.NameWell,
                WellboreUid = log.UidWellbore,
                WellboreName = log.NameWellbore,
                ObjectGrowing = StringHelpers.ToBooleanSafe(log.ObjectGrowing),
                ServiceCompany = log.ServiceCompany,
                RunNumber = log.RunNumber,

                StartIndex = GetIndexAsString(log.IndexType, log.StartIndex, log.StartDateTimeIndex),
                EndIndex = GetIndexAsString(log.IndexType, log.EndIndex, log.EndDateTimeIndex),
                DateTimeLastChange = StringHelpers.ToDateTime(log.CommonData.DTimLastChange),
                IndexCurve = log.IndexCurve.Value
            }).OrderBy(log => log.Name));
        }
Ejemplo n.º 3
0
        private async Task <WitsmlLog> GetLogHeader(string wellUid, string wellboreUid, string logUid)
        {
            var query  = LogQueries.QueryById(wellUid, wellboreUid, logUid);
            var result = await WitsmlClient.GetFromStoreAsync(query, OptionsIn.HeaderOnly);

            return(result.Logs.FirstOrDefault());
        }
Ejemplo n.º 4
0
        public async Task <MudLog> GetMudLog(string wellUid, string wellboreUid, string mudlogUid)
        {
            var query  = MudLogQueries.QueryById(wellUid, wellboreUid, mudlogUid);
            var result = await WitsmlClient.GetFromStoreAsync(query, new OptionsIn(ReturnElements.All));

            var witsmlMudLog = result.MudLogs.FirstOrDefault();

            if (witsmlMudLog == null)
            {
                return(null);
            }

            var mudlog = new MudLog
            {
                Uid              = witsmlMudLog.Uid,
                Name             = witsmlMudLog.Name,
                WellUid          = witsmlMudLog.UidWell,
                WellName         = witsmlMudLog.NameWell,
                WellboreUid      = witsmlMudLog.UidWellbore,
                WellboreName     = witsmlMudLog.NameWellbore,
                StartMd          = witsmlMudLog.StartMd?.Value,
                EndMd            = witsmlMudLog.EndMd?.Value,
                GeologyInterval  = GetGeologyIntervals(witsmlMudLog.GeologyInterval),
                ItemState        = witsmlMudLog.CommonData.ItemState,
                DateTimeCreation = StringHelpers.ToDateTime(witsmlMudLog.CommonData.DTimCreation),
            };

            return(mudlog);
        }
Ejemplo n.º 5
0
        public async Task <Wellbore> GetWellbore(string wellUid, string wellboreUid)
        {
            var query  = WellboreQueries.QueryByUid(wellUid, wellboreUid);
            var result = await WitsmlClient.GetFromStoreAsync(query, OptionsIn.All);

            var witsmlWellbore = result.Wellbores.FirstOrDefault();

            if (witsmlWellbore == null)
            {
                return(null);
            }

            return(new Wellbore
            {
                Uid = witsmlWellbore.Uid,
                Name = witsmlWellbore.Name,
                WellUid = witsmlWellbore.UidWell,
                WellName = witsmlWellbore.NameWell,
                WellborePurpose = witsmlWellbore.PurposeWellbore,
                WellboreParentUid = witsmlWellbore.ParentWellbore?.UidRef,
                WellboreParentName = witsmlWellbore.ParentWellbore?.Value,
                DateTimeCreation = StringHelpers.ToDateTime(witsmlWellbore.CommonData.DTimCreation),
                DateTimeLastChange = StringHelpers.ToDateTime(witsmlWellbore.CommonData.DTimLastChange),
                ItemState = witsmlWellbore.CommonData.ItemState
            });
        }
Ejemplo n.º 6
0
        private async Task <IEnumerable <Well> > GetWellsInformation(string wellUid = null)
        {
            var start       = DateTime.Now;
            var witsmlWells = string.IsNullOrEmpty(wellUid) ? WellQueries.GetAllWitsmlWells() : WellQueries.GetWitsmlWellByUid(wellUid);
            var result      = await WitsmlClient.GetFromStoreAsync(witsmlWells, new OptionsIn(ReturnElements.All));

            var wells = result.Wells
                        .Select(well => new Well
            {
                Uid                = well.Uid,
                Name               = well.Name,
                Field              = well.Field,
                Operator           = well.Operator,
                TimeZone           = well.TimeZone,
                DateTimeCreation   = StringHelpers.ToDateTime(well.CommonData.DTimCreation),
                DateTimeLastChange = StringHelpers.ToDateTime(well.CommonData.DTimLastChange),
                ItemState          = well.CommonData.ItemState,
                StatusWell         = well.StatusWell,
                PurposeWell        = well.PurposeWell,
                WellDatum          = WellDatum.FromWitsmlWellDatum(well.WellDatum),
                WaterDepth         = well.WaterDepth,
                WellLocation       = WellLocation.FromWitsmlLocation(well.WellLocation)
            }
                                ).ToList();
            var elapsed = DateTime.Now.Subtract(start).Milliseconds / 1000.0;

            Log.Debug("Fetched {Count} wells in {Elapsed} seconds", wells.Count, elapsed);
            return(wells);
        }
Ejemplo n.º 7
0
        public async Task <MessageObject> GetMessageObject(string wellUid, string wellboreUid, string msgUid)
        {
            var witsmlMessage = MessageQueries.GetMessageById(wellUid, wellboreUid, msgUid);
            var result        = await WitsmlClient.GetFromStoreAsync(witsmlMessage, new OptionsIn(ReturnElements.All));

            var messageObject = result.Messages.FirstOrDefault();

            if (messageObject == null)
            {
                return(null);
            }

            return(new MessageObject
            {
                WellboreUid = messageObject.UidWellbore,
                WellboreName = messageObject.NameWellbore,
                WellUid = messageObject.UidWell,
                WellName = messageObject.NameWell,
                Uid = messageObject.Uid,
                Name = messageObject.Name,
                MessageText = messageObject.MessageText,
                DateTimeCreation = StringHelpers.ToDateTime(messageObject.CommonData.DTimCreation),
                DateTimeLastChange = StringHelpers.ToDateTime(messageObject.CommonData.DTimLastChange)
            });
        }
Ejemplo n.º 8
0
        public async Task <IEnumerable <MessageObject> > GetMessageObjects(string wellUid, string wellboreUid)
        {
            var start         = DateTime.Now;
            var witsmlMessage = MessageQueries.GetMessageByWellbore(wellUid, wellboreUid);
            var result        = await WitsmlClient.GetFromStoreAsync(witsmlMessage, new OptionsIn(ReturnElements.Requested));

            var messageObjects = result.Messages
                                 .Select(message =>
                                         new MessageObject
            {
                Uid                = message.Uid,
                Name               = message.Name,
                WellboreUid        = message.UidWellbore,
                WellboreName       = message.NameWellbore,
                WellUid            = message.UidWell,
                WellName           = message.NameWell,
                MessageText        = message.MessageText,
                DateTimeLastChange = StringHelpers.ToDateTime(message.CommonData.DTimLastChange),
                DateTimeCreation   = StringHelpers.ToDateTime(message.CommonData.DTimCreation)
            })
                                 .OrderBy(message => message.WellboreName).ToList();
            var elapsed = DateTime.Now.Subtract(start).Milliseconds / 1000.0;

            Log.Debug("Fetched {Count} messageobjects from {WellboreName} in {Elapsed} seconds", messageObjects.Count, messageObjects.FirstOrDefault()?.WellboreName, elapsed);
            return(messageObjects);
        }
Ejemplo n.º 9
0
        public LogObjectTests(ITestOutputHelper output)
        {
            this.output = output;
            var config = ConfigurationReader.GetWitsmlConfiguration();

            client = new WitsmlClient(config.Hostname, config.Username, config.Password);
        }
Ejemplo n.º 10
0
        public async Task <IEnumerable <Risk> > GetRisks(string wellUid, string wellboreUid)
        {
            var query  = RiskQueries.GetWitsmlRiskByWellbore(wellUid, wellboreUid);
            var result = await WitsmlClient.GetFromStoreAsync(query, new OptionsIn(ReturnElements.All));

            return(result.Risks.Select(risk =>
                                       new Risk
            {
                Name = risk.Name,
                NameWellbore = risk.NameWellbore,
                UidWellbore = risk.UidWellbore,
                NameWell = risk.NameWell,
                UidWell = risk.UidWell,
                Uid = risk.Uid,
                Type = risk.Type,
                Category = risk.Category,
                SubCategory = risk.SubCategory,
                ExtendCategory = risk.ExtendCategory,
                AffectedPersonnel = risk.AffectedPersonnel,
                MdHoleStart = risk.MdHoleStart?.Value,
                MdHoleEnd = risk.MdHoleEnd?.Value,
                MdBitStart = risk.MdBitStart?.Value,
                MdBitEnd = risk.MdBitEnd?.Value,
                SourceName = risk.CommonData.SourceName,
                DiaHole = risk.DiaHole,
                SeverityLevel = risk.SeverityLevel,
                ProbabilityLevel = risk.ProbabilityLevel
            }).OrderBy(risk => risk.Name));
        }
Ejemplo n.º 11
0
        public async Task <IEnumerable <Wellbore> > GetWellbores(string wellUid = null)
        {
            var start = DateTime.Now;
            var query = string.IsNullOrEmpty(wellUid) ? WellboreQueries.QueryAll() : WellboreQueries.QueryByWell(wellUid);

            var result = await WitsmlClient.GetFromStoreAsync(query, OptionsIn.Requested);

            var wellbores = result.Wellbores
                            .Select(witsmlWellbore =>
                                    new Wellbore
            {
                Uid                = witsmlWellbore.Uid,
                Name               = witsmlWellbore.Name,
                WellUid            = witsmlWellbore.UidWell,
                WellName           = witsmlWellbore.NameWell,
                WellStatus         = witsmlWellbore.StatusWellbore,
                WellType           = witsmlWellbore.TypeWellbore,
                IsActive           = StringHelpers.ToBooleanSafe(witsmlWellbore.IsActive),
                DateTimeLastChange = StringHelpers.ToDateTime(witsmlWellbore.CommonData.DTimLastChange)
            })
                            .OrderBy(wellbore => wellbore.Name).ToList();
            var elapsed = DateTime.Now.Subtract(start).Milliseconds / 1000.0;

            Log.Debug($"Fetched {wellbores.Count} wellbores in {elapsed} seconds");
            return(wellbores);
        }
Ejemplo n.º 12
0
        public async Task <Rig> GetRig(string wellUid, string wellboreUid, string rigUid)
        {
            var query  = RigQueries.QueryById(wellUid, wellboreUid, rigUid);
            var result = await WitsmlClient.GetFromStoreAsync(query, OptionsIn.All);

            var witsmlRig = result.Rigs.FirstOrDefault();

            if (witsmlRig == null)
            {
                return(null);
            }

            return(new Rig
            {
                AirGap = witsmlRig.AirGap,
                DateTimeCreation = StringHelpers.ToDateTime(witsmlRig.CommonData.DTimCreation),
                DateTimeLastChange = StringHelpers.ToDateTime(witsmlRig.CommonData.DTimLastChange),
                ItemState = witsmlRig.CommonData.ItemState,
                Name = witsmlRig.Name,
                Owner = witsmlRig.Owner,
                TypeRig = witsmlRig.TypeRig,
                WellboreName = witsmlRig.NameWellbore,
                WellboreUid = witsmlRig.UidWellbore,
                WellName = witsmlRig.NameWell,
                WellUid = witsmlRig.UidWell,
                Uid = witsmlRig.Uid
            });
        }
Ejemplo n.º 13
0
        public async Task <LogData> ReadLogData(string wellUid, string wellboreUid, string logUid, List <string> mnemonics, bool startIndexIsInclusive, string start, string end)
        {
            var log = await GetLogHeader(wellUid, wellboreUid, logUid);

            var startIndex = Index.Start(log, start);
            var endIndex   = Index.End(log, end);

            if (!startIndexIsInclusive)
            {
                startIndex = startIndex.AddEpsilon();
            }

            if (startIndex > endIndex)
            {
                return(new LogData());
            }

            var indexMnemonic = log.IndexCurve.Value;

            if (!mnemonics.Contains(indexMnemonic))
            {
                mnemonics.Insert(0, indexMnemonic);
            }

            var query      = LogQueries.QueryLogContent(wellUid, wellboreUid, logUid, log.IndexType, mnemonics, startIndex, endIndex);
            var witsmlLogs = await WitsmlClient.GetFromStoreAsync(query, OptionsIn.All);

            if (!witsmlLogs.Logs.Any() || witsmlLogs.Logs.First().LogData == null)
            {
                return(new LogData());
            }

            var witsmlLog = witsmlLogs.Logs.First();

            var witsmlLogMnemonics = witsmlLog.LogData.MnemonicList.Split(",");
            var witsmlLogUnits     = witsmlLog.LogData.UnitList.Split(",");

            return(new LogData
            {
                StartIndex = Index.Start(witsmlLog).GetValueAsString(),
                EndIndex = Index.End(witsmlLog).GetValueAsString(),
                CurveSpecifications = witsmlLogMnemonics.Zip(witsmlLogUnits, (mnemonic, unit) =>
                                                             new CurveSpecification {
                    Mnemonic = mnemonic, Unit = unit
                }),
                Data = GetDataDictionary(witsmlLog.LogData)
            });
        }
Ejemplo n.º 14
0
        public WitsmlClientProvider(
            IConfiguration configuration,
            IHttpContextAccessor httpContextAccessor,
            ICredentialsService credentialsService,
            IOptions <WitsmlClientCapabilities> witsmlClientCapabilities)
        {
            if (httpContextAccessor.HttpContext == null || httpContextAccessor.HttpContext.Request.Headers["Authorization"].Count == 0)
            {
                return;
            }

            clientCapabilities = witsmlClientCapabilities.Value;

            var headers   = httpContextAccessor.HttpContext.Request.Headers;
            var serverUrl = headers[WitsmlServerUrlHeader];
            var witsmlServerAccessNeeded = !string.IsNullOrEmpty(serverUrl);

            if (!witsmlServerAccessNeeded)
            {
                return;
            }

            var credentials = ExtractCredentialsFromHeader(headers);

            //This provider will unintentionally be invoked also on initial authentication requests. Doing this to let the authentication route be triggered.
            var isEncrypted = credentialsService.VerifyIsEncrypted(credentials[0]);

            if (!isEncrypted)
            {
                return;
            }

            var logQueries = StringHelpers.ToBoolean(configuration["LogQueries"]);

            witsmlClient = new WitsmlClient(serverUrl, credentials[0].Username, credentialsService.Decrypt(credentials[0]), clientCapabilities, null, logQueries);

            var sourceServerUrl = headers[WitsmlSourceServerUrlHeader];

            if (string.IsNullOrEmpty(sourceServerUrl) && credentials.Count == 1)
            {
                return;
            }
            witsmlSourceClient = new WitsmlClient(sourceServerUrl, credentials[1].Username, credentialsService.Decrypt(credentials[1]), clientCapabilities, null, logQueries);
        }
Ejemplo n.º 15
0
        public async Task <IEnumerable <Rig> > GetRigs(string wellUid, string wellboreUid)
        {
            var query  = RigQueries.QueryByWellbore(wellUid, wellboreUid);
            var result = await WitsmlClient.GetFromStoreAsync(query, OptionsIn.IdOnly);

            return(result.Rigs.Select(rig =>
                                      new Rig
            {
                AirGap = rig.AirGap,
                Name = rig.Name,
                Owner = rig.Owner,
                TypeRig = rig.TypeRig,
                WellboreName = rig.NameWellbore,
                WellboreUid = rig.UidWellbore,
                WellName = rig.NameWell,
                WellUid = rig.UidWell,
                Uid = rig.Uid
            }).OrderBy(rig => rig.Name));
        }
Ejemplo n.º 16
0
        public async Task <IEnumerable <MudLog> > GetMudLogs(string wellUid, string wellboreUid)
        {
            var query  = MudLogQueries.QueryByWellbore(wellUid, wellboreUid);
            var result = await WitsmlClient.GetFromStoreAsync(query, new OptionsIn(ReturnElements.HeaderOnly));

            return(result.MudLogs.Select(mudLog =>
                                         new MudLog
            {
                Uid = mudLog.Uid,
                Name = mudLog.Name,
                WellUid = mudLog.UidWell,
                WellName = mudLog.NameWell,
                WellboreUid = mudLog.UidWellbore,
                WellboreName = mudLog.NameWellbore,
                StartMd = mudLog.StartMd?.Value,
                EndMd = mudLog.EndMd?.Value,
                ItemState = mudLog.CommonData.ItemState,
                DateTimeCreation = StringHelpers.ToDateTime(mudLog.CommonData.DTimCreation),
            }).OrderBy(mudLog => mudLog.Name));
        }
Ejemplo n.º 17
0
        public async Task <IEnumerable <Trajectory> > GetTrajectories(string wellUid, string wellboreUid)
        {
            var witsmlTrajectory = TrajectoryQueries.GetWitsmlTrajectoryByWellbore(wellUid, wellboreUid);
            var result           = await WitsmlClient.GetFromStoreAsync(witsmlTrajectory, new OptionsIn(ReturnElements.Requested));

            return(result.Trajectories.Select(trajectory =>
                                              new Trajectory
            {
                Uid = trajectory.Uid,
                WellUid = trajectory.UidWell,
                WellboreUid = trajectory.UidWellbore,
                Name = trajectory.Name,
                MdMin = StringHelpers.ToDecimal(trajectory.MdMin?.Value),
                MdMax = StringHelpers.ToDecimal(trajectory.MdMax?.Value),
                AziRef = trajectory.AziRef,
                DTimTrajStart = StringHelpers.ToDateTime(trajectory.DTimTrajStart),
                DTimTrajEnd = StringHelpers.ToDateTime(trajectory.DTimTrajEnd),
                DateTimeCreation = StringHelpers.ToDateTime(trajectory.CommonData?.DTimCreation),
                DateTimeLastChange = StringHelpers.ToDateTime(trajectory.CommonData?.DTimLastChange)
            }).OrderBy(trajectory => trajectory.Name));
        }
Ejemplo n.º 18
0
        public async Task <LogObject> GetLog(string wellUid, string wellboreUid, string logUid, OptionsIn queryOptions)
        {
            var query  = LogQueries.GetWitsmlLogById(wellUid, wellboreUid, logUid);
            var result = await WitsmlClient.GetFromStoreAsync(query, queryOptions);

            var witsmlLog = result.Logs.FirstOrDefault();

            if (witsmlLog == null)
            {
                return(null);
            }

            var logObject = new LogObject
            {
                Uid            = witsmlLog.Uid,
                Name           = witsmlLog.Name,
                IndexType      = witsmlLog.IndexType,
                WellUid        = witsmlLog.UidWell,
                WellName       = witsmlLog.NameWell,
                WellboreUid    = witsmlLog.UidWellbore,
                WellboreName   = witsmlLog.NameWellbore,
                IndexCurve     = witsmlLog.IndexCurve.Value,
                ObjectGrowing  = StringHelpers.ToBooleanSafe(witsmlLog.ObjectGrowing),
                ServiceCompany = witsmlLog.ServiceCompany,
                RunNumber      = witsmlLog.RunNumber
            };

            if (string.IsNullOrEmpty(witsmlLog.IndexType))
            {
                return(logObject);
            }

            logObject.StartIndex = witsmlLog.GetStartIndexAsString();
            logObject.EndIndex   = witsmlLog.GetEndIndexAsString();

            return(logObject);
        }
Ejemplo n.º 19
0
        private async Task <IEnumerable <Well> > GetWellsInformation(string wellUid = null)
        {
            var start  = DateTime.Now;
            var query  = string.IsNullOrEmpty(wellUid) ? WellQueries.QueryAll() : WellQueries.QueryByUid(wellUid);
            var result = await WitsmlClient.GetFromStoreAsync(query, OptionsIn.Requested);

            var wells = result.Wells
                        .Select(well => new Well
            {
                Uid                = well.Uid,
                Name               = well.Name,
                Field              = well.Field,
                Operator           = well.Operator,
                TimeZone           = well.TimeZone,
                DateTimeCreation   = StringHelpers.ToDateTime(well.CommonData.DTimCreation),
                DateTimeLastChange = StringHelpers.ToDateTime(well.CommonData.DTimLastChange),
                ItemState          = well.CommonData.ItemState
            }
                                ).ToList();
            var elapsed = DateTime.Now.Subtract(start).Milliseconds / 1000.0;

            Log.Debug($"Fetched {wells.Count} wells in {elapsed} seconds");
            return(wells);
        }
Ejemplo n.º 20
0
        public async Task <List <TrajectoryStation> > GetTrajectoryStations(string wellUid, string wellboreUid, string trajectoryUid)
        {
            var trajectoryToQuery = TrajectoryQueries.GetWitsmlTrajectoryById(wellUid, wellboreUid, trajectoryUid);
            var result            = await WitsmlClient.GetFromStoreAsync(trajectoryToQuery, new OptionsIn(ReturnElements.All));

            var witsmlTrajectory = result.Trajectories.FirstOrDefault();

            if (witsmlTrajectory == null)
            {
                return(null);
            }
            return(witsmlTrajectory.TrajectoryStations.Select(tStation => new TrajectoryStation
            {
                Uid = tStation.Uid,
                DTimStn = StringHelpers.ToDateTime(tStation.DTimStn),
                TypeTrajStation = tStation.TypeTrajStation,
                Md = StringHelpers.ToDecimal(tStation.Md?.Value),
                Tvd = StringHelpers.ToDecimal(tStation.Tvd?.Value),
                Incl = StringHelpers.ToDecimal(tStation.Incl?.Value),
                Azi = StringHelpers.ToDecimal(tStation.Azi?.Value)
            })
                   .OrderBy(tStation => tStation.Md)
                   .ToList());
        }
Ejemplo n.º 21
0
 private async Task VerifyCredentials(Uri serverUrl, Credentials credentials)
 {
     var witsmlClient = new WitsmlClient(serverUrl.ToString(), credentials.Username, credentials.Password,
                                         StringHelpers.ToBoolean(configuration["LogQueries"]));
     await witsmlClient.TestConnectionAsync();
 }
 internal WitsmlClientProvider(IConfiguration configuration)
 {
     var(serverUrl, username, password) = GetCredentialsFromConfiguration(configuration);
     witsmlClient = new WitsmlClient(serverUrl, username, password, true);
 }
Ejemplo n.º 23
0
 private async Task VerifyCredentials(Uri serverUrl, Credentials credentials)
 {
     var witsmlClient = new WitsmlClient(serverUrl.ToString(), credentials.Username, credentials.Password, clientCapabilities);
     await witsmlClient.TestConnectionAsync();
 }