Example #1
0
        public void EtpUris_GetUri_Can_Get_Log_ChannelSet_200_ChannelIndex_Uri()
        {
            var channelIndex = new Witsml200.ComponentSchemas.ChannelIndex {
                Mnemonic = "MD"
            };
            var channel = new Witsml200.Channel {
                Uuid = _data.Uid(), Mnemonic = "ROP", Index = new List <Witsml200.ComponentSchemas.ChannelIndex> {
                    channelIndex
                }
            };
            var channelSet = new Witsml200.ChannelSet {
                Uuid = _data.Uid(), Channel = new List <Witsml200.Channel> {
                    channel
                }
            };
            var log = new Witsml200.Log {
                Uuid = _data.Uid(), ChannelSet = new List <Witsml200.ChannelSet> {
                    channelSet
                }
            };

            var uri = channelIndex.GetUri(log, channelSet);

            Assert.IsTrue($"eml://witsml20/Log({log.Uuid})/ChannelSet({channelSet.Uuid})/ChannelIndex({channelIndex.Mnemonic})".EqualsIgnoreCase(uri.ToString()));
            Assert.AreEqual(ObjectTypes.ChannelIndex.ToPascalCase(), uri.ObjectType);
            Assert.AreEqual(channelIndex.Mnemonic, uri.ObjectId);
        }
Example #2
0
 /// <summary>
 /// Determines whether this <see cref="Witsml200.ChannelSet"/> instance is a time index.
 /// </summary>
 /// <param name="channelSet">The channel set.</param>
 /// <param name="includeElapsedTime">if set to <c>true</c> elapsed time is included.</param>
 /// <returns>true if index is time, false otherwise</returns>
 public static bool IsTimeIndex(this Witsml200.ChannelSet channelSet, bool includeElapsedTime = false)
 {
     if (channelSet?.Index == null)
     {
         return(false);
     }
     return(channelSet.Index.Select(x => x.IsTimeIndex(includeElapsedTime)).FirstOrDefault());
 }
Example #3
0
 /// <summary>
 /// Determines whether this <see cref="Witsml200.ChannelSet"/> instance is increasing.
 /// </summary>
 /// <param name="channelSet">The channel set.</param>
 /// <returns>true if increasing, false otherwise</returns>
 public static bool IsIncreasing(this Witsml200.ChannelSet channelSet)
 {
     if (channelSet?.Index == null)
     {
         return(true);
     }
     return(channelSet.Index.Select(x => x.IsIncreasing()).FirstOrDefault());
 }
Example #4
0
        public void EtpUris_GetUri_Can_Get_Log_200_ChannelSet_Uri()
        {
            var channelSet = new Witsml200.ChannelSet {
                Uuid = _data.Uid()
            };
            var log = new Witsml200.Log {
                Uuid = _data.Uid(), ChannelSet = new List <Witsml200.ChannelSet> {
                    channelSet
                }
            };

            var uri = channelSet.GetUri(log);

            Assert.IsTrue($"eml://witsml20/Log({ log.Uuid })/ChannelSet({channelSet.Uuid})".EqualsIgnoreCase(uri.ToString()));
            Assert.AreEqual(ObjectTypes.ChannelSet.ToPascalCase(), uri.ObjectType);
            Assert.AreEqual(channelSet.Uuid, uri.ObjectId);
        }
Example #5
0
        public void EtpUris_GetUri_Can_Get_ChannelSet_200_Channel_Uri()
        {
            var channel = new Witsml200.Channel {
                Uuid = _data.Uid(), Mnemonic = "ROP"
            };
            var channelSet = new Witsml200.ChannelSet {
                Uuid = _data.Uid(), Channel = new List <Witsml200.Channel> {
                    channel
                }
            };

            var uri = channel.GetUri(channelSet);

            Assert.IsTrue($"eml://witsml20/ChannelSet({channelSet.Uuid})/Channel({channel.Uuid})".EqualsIgnoreCase(uri.ToString()));
            Assert.AreEqual(ObjectTypes.Channel.ToPascalCase(), uri.ObjectType);
            Assert.AreEqual(channel.Uuid, uri.ObjectId);
        }
Example #6
0
        /// <summary>
        /// Gets a <see cref="ChannelDataReader"/> for a <see cref="Witsml200.ChannelSet"/> instance.
        /// </summary>
        /// <param name="channelSet">The channel set.</param>
        /// <returns>A <see cref="ChannelDataReader"/> </returns>
        public static ChannelDataReader GetReader(this Witsml200.ChannelSet channelSet)
        {
            var data = Witsml200.Extensions.GetData(channelSet);

            if (string.IsNullOrWhiteSpace(data))
            {
                return(null);
            }

            _log.DebugFormat("Creating ChannelDataReader for {0}", channelSet.GetType().FullName);

            // Not including index channels with value channels
            var mnemonics  = channelSet.Channel.Select(x => x.Mnemonic).ToArray();
            var units      = channelSet.Channel.Select(x => x.Uom.ToString()).ToArray();
            var dataTypes  = channelSet.Channel.Select(x => x.DataType?.ToString()).ToArray();
            var nullValues = new string[units.Length];

            return(new ChannelDataReader(data, mnemonics, units, dataTypes, nullValues, channelSet.GetUri())
                   // Add index channels to separate collection
                   .WithIndices(channelSet.Index.Select(ToChannelIndexInfo), true));
        }
Example #7
0
        public void EtpUris_GetUri_Can_Get_Log_ChannelSet_200_Channel_Uri()
        {
            var channel = new Witsml200.Channel {
                Mnemonic = "ROP"
            };
            var channelSet = new Witsml200.ChannelSet {
                Uuid = _data.Uid(), Channel = new List <Witsml200.Channel> {
                    channel
                }
            };
            var log = new Witsml200.Log {
                Uuid = _data.Uid(), ChannelSet = new List <Witsml200.ChannelSet> {
                    channelSet
                }
            };
            var uri = channel.GetUri(log, channelSet);

            Assert.IsTrue($"eml://witsml20/Log({log.Uuid})/ChannelSet({ channelSet.Uuid })/Channel({channel.Mnemonic})".EqualsIgnoreCase(uri.ToString()));
            Assert.AreEqual(ObjectTypes.Channel, uri.ObjectType);
            Assert.AreEqual(channel.Mnemonic, uri.ObjectId);
        }
Example #8
0
 /// <summary>
 /// Gets the <see cref="EtpUri"/> for a given <see cref="Energistics.DataAccess.WITSML200.ComponentSchemas.ChannelIndex"/>
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <param name="log">The log.</param>
 /// <param name="channelSet">The channel set.</param>
 /// <returns>An <see cref="EtpUri"/> instance.</returns>
 public static EtpUri GetUri(this Witsml200.ComponentSchemas.ChannelIndex entity, Witsml200.Log log, Witsml200.ChannelSet channelSet)
 {
     return(channelSet.GetUri(log)
            .Append(ObjectTypes.ChannelIndex, entity.Mnemonic, true));
 }
Example #9
0
 /// <summary>
 /// Gets the <see cref="EtpUri"/> for a given <see cref="Energistics.DataAccess.WITSML200.Channel"/>
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <param name="log">The log.</param>
 /// <param name="channelSet">The channel set.</param>
 /// <returns>An <see cref="EtpUri"/> instance.</returns>
 public static EtpUri GetUri(this Witsml200.Channel entity, Witsml200.Log log, Witsml200.ChannelSet channelSet)
 {
     return(channelSet.GetUri(log)
            .Append(ObjectTypes.Channel, entity.Uuid));
 }
Example #10
0
 /// <summary>
 /// Gets the <see cref="EtpUri"/> for a given <see cref="Energistics.DataAccess.WITSML200.ChannelSet"/>
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <param name="log">The log.</param>
 /// <returns>An <see cref="EtpUri"/> instance.</returns>
 public static EtpUri GetUri(this Witsml200.ChannelSet entity, Witsml200.Log log)
 {
     return(log.GetUri()
            .Append(ObjectTypes.ChannelSet, entity.Uuid));
 }
Example #11
0
 /// <summary>
 /// Gets the <see cref="EtpUri"/> for a given <see cref="Energistics.DataAccess.WITSML200.Channel"/>
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <param name="channelSet">The channel set.</param>
 /// <returns>An <see cref="EtpUri"/> instance.</returns>
 public static EtpUri GetUri(this Witsml200.Channel entity, Witsml200.ChannelSet channelSet)
 {
     return(channelSet.GetUri()
            .Append(ObjectTypes.Channel, entity.Mnemonic));
 }