Пример #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
            });
        }
Пример #2
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,
                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);
        }
Пример #3
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
            });
        }
Пример #4
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
            });
        }
        public async Task <IEnumerable <LogCurveInfo> > GetLogCurveInfo(string wellUid, string wellboreUid, string logUid)
        {
            var witsmlLog = await GetLogHeader(wellUid, wellboreUid, logUid);

            return(witsmlLog?.LogCurveInfo.Select(logCurveInfo =>
                                                  new LogCurveInfo
            {
                Uid = logCurveInfo.Uid,
                Mnemonic = logCurveInfo.Mnemonic,
                ClassWitsml = logCurveInfo.ClassWitsml,
                MaxDateTimeIndex = StringHelpers.ToDateTime(logCurveInfo.MaxDateTimeIndex),
                MaxDepthIndex = logCurveInfo.MaxIndex?.Value,
                MinDateTimeIndex = StringHelpers.ToDateTime(logCurveInfo.MinDateTimeIndex),
                MinDepthIndex = logCurveInfo.MinIndex?.Value,
                MnemAlias = logCurveInfo.MnemAlias,
                Unit = logCurveInfo.Unit
            }));
        }
Пример #6
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));
        }
Пример #7
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));
        }
Пример #8
0
 private List <MudLogGeologyInterval> GetGeologyIntervals(List <WitsmlMudLogGeologyInterval> geologyIntervals)
 {
     return(geologyIntervals.Select(geologyInterval =>
                                    new MudLogGeologyInterval
     {
         TypeLithology = geologyInterval.TypeLithology,
         MdTop = geologyInterval.MdTop?.Value,
         MdBottom = geologyInterval.MdBottom?.Value,
         Lithology = new MudLogLithology
         {
             CodeLith = geologyInterval.Lithology.CodeLith,
             LithPc = geologyInterval.Lithology.LithPc?.Value,
             Type = geologyInterval.Lithology.Type
         },
         CommonTime = new CommonTime
         {
             DTimCreation = StringHelpers.ToDateTime(geologyInterval.CommonTime.DTimCreation),
             DTimLastChange = StringHelpers.ToDateTime(geologyInterval.CommonTime.DTimLastChange)
         }
     }).ToList());
 }
        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,
                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));
        }
Пример #10
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());
        }
Пример #11
0
        public async Task <IEnumerable <LogObject> > GetLogs(string wellUid, string wellboreUid)
        {
            var witsmlLog = LogQueries.GetWitsmlLogsByWellbore(wellUid, wellboreUid);
            var result    = await WitsmlClient.GetFromStoreAsync(witsmlLog, new OptionsIn(ReturnElements.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 = log.GetStartIndexAsString(),
                EndIndex = log.GetEndIndexAsString(),
                DateTimeLastChange = StringHelpers.ToDateTime(log.CommonData.DTimLastChange),
                IndexCurve = log.IndexCurve.Value
            }).OrderBy(log => log.Name));
        }
Пример #12
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);
        }