public void ChannelDataExtensions_AddIndex_Adds_Index_To_Datablock() { var log = new Witsml200.Log { Uuid = "uid", Citation = new Witsml200.ComponentSchemas.Citation(), Wellbore = new Witsml200.ComponentSchemas.DataObjectReference(), SchemaVersion = "2.0" }; Witsml200.ComponentSchemas.ChannelIndex mdChannelIndex = _log20Generator.CreateMeasuredDepthIndex(Witsml200.ReferenceData.IndexDirection.increasing); DevKit.InitHeader(log, Witsml200.ReferenceData.LoggingMethod.MWD, mdChannelIndex); Assert.AreEqual(1, log.ChannelSet.Count); log.ChannelSet[0].Channel[1].DataType = null; var dataBlock = new ChannelDataBlock("eml://witsml20/well(1)/wellbore(1)/log(1)"); foreach (var channelIndex in log.ChannelSet[0].Index) { dataBlock.AddIndex(channelIndex); } Assert.AreEqual(1, dataBlock.Indices.Count); Assert.AreEqual(mdChannelIndex.Mnemonic, dataBlock.Indices[0].Mnemonic); Assert.AreEqual(mdChannelIndex.Uom.ToString(), dataBlock.Indices[0].Unit); }
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); }
public void ChannelDataExtensions_GetReaders_Returns_ChannelDataReader_For_20_Log() { var log = new Witsml200.Log { Uuid = "uid", Citation = new Witsml200.ComponentSchemas.Citation(), Wellbore = new Witsml200.ComponentSchemas.DataObjectReference(), SchemaVersion = "2.0" }; log = null; var readers = log.GetReaders(); Assert.AreEqual(0, readers.Count()); log = new Witsml200.Log { Uuid = "uid", Citation = new Witsml200.ComponentSchemas.Citation(), Wellbore = new Witsml200.ComponentSchemas.DataObjectReference(), SchemaVersion = "2.0" }; readers = log.GetReaders(); Assert.AreEqual(0, readers.Count()); Witsml200.ComponentSchemas.ChannelIndex mdChannelIndex = _log20Generator.CreateMeasuredDepthIndex(Witsml200.ReferenceData.IndexDirection.increasing); DevKit.InitHeader(log, Witsml200.ReferenceData.LoggingMethod.MWD, mdChannelIndex); Assert.AreEqual(1, log.ChannelSet.Count); // Correct mnemonic names log.ChannelSet[0].Channel[0].Mnemonic = "A"; log.ChannelSet[0].Channel[1].Mnemonic = "B"; log.ChannelSet[0].Channel[2].Mnemonic = "C"; // Null out the datetype of channel B log.ChannelSet[0].Channel[1].DataType = null; log.ChannelSet.Add(_log20Generator.CreateChannelSet(log)); Assert.AreEqual(2, log.ChannelSet.Count); readers = log.GetReaders(); var listOfReaders = readers.ToList(); Assert.AreEqual(1, listOfReaders.Count); AssertReaderAndData(listOfReaders); log.ChannelSet[0].Data = null; readers = log.GetReaders(); Assert.AreEqual(0, readers.Count()); }
/// <summary> /// Adds the index to a <see cref="ChannelDataBlock"/> instance from a <see cref="Witsml200.ComponentSchemas.ChannelIndex"/>. /// </summary> /// <param name="dataBlock">The channel data block.</param> /// <param name="channelIndex">Index of the channel.</param> public static void AddIndex(this ChannelDataBlock dataBlock, Witsml200.ComponentSchemas.ChannelIndex channelIndex) { dataBlock.AddIndex( channelIndex.Mnemonic, channelIndex.Uom.ToString(), [email protected](), channelIndex.IsIncreasing(), channelIndex.IsTimeIndex()); }
/// <summary> /// Creates a <see cref="ChannelIndexInfo"/> from a /// <see cref="Witsml200.ComponentSchemas.ChannelIndex"/> instance. /// </summary> /// <param name="channelIndex">Index of the channel.</param> /// <returns>A <see cref="ChannelIndexInfo"/> instance.</returns> public static ChannelIndexInfo ToChannelIndexInfo(this Witsml200.ComponentSchemas.ChannelIndex channelIndex) { return(new ChannelIndexInfo() { Mnemonic = channelIndex.Mnemonic, Unit = channelIndex.Uom.ToString(), Increasing = channelIndex.IsIncreasing(), IsTimeIndex = channelIndex.IsTimeIndex() }); }
public void EtpUris_GetUri_Can_Get_Channel_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 uri = channelIndex.GetUri(channel); Assert.IsTrue($"eml://witsml20/Channel({channel.Uuid})/ChannelIndex({channelIndex.Mnemonic})".EqualsIgnoreCase(uri.ToString())); Assert.AreEqual(ObjectTypes.ChannelIndex, uri.ObjectType); Assert.AreEqual(channelIndex.Mnemonic, uri.ObjectId); }
public void ChannelDataExtensions_AddChannel_Adds_Channel_To_Datablock() { var log = new Witsml200.Log { Uuid = "uid", Citation = new Witsml200.ComponentSchemas.Citation(), Wellbore = new Witsml200.ComponentSchemas.DataObjectReference(), SchemaVersion = "2.0" }; Witsml200.ComponentSchemas.ChannelIndex mdChannelIndex = _log20Generator.CreateMeasuredDepthIndex(Witsml200.ReferenceData.IndexDirection.increasing); DevKit.InitHeader(log, Witsml200.ReferenceData.LoggingMethod.MWD, mdChannelIndex); Assert.AreEqual(1, log.ChannelSet.Count); log.ChannelSet[0].Channel[1].DataType = null; var dataBlock = new ChannelDataBlock("eml://witsml20/well(1)/wellbore(1)/log(1)"); var channelId = 1; foreach (var channel in log.ChannelSet[0].Channel) { dataBlock.AddChannel(channelId++, channel); } Assert.AreEqual(3, dataBlock.ChannelIds.Count); Assert.AreEqual(3, dataBlock.Mnemonics.Count); Assert.AreEqual(3, dataBlock.Units.Count); Assert.AreEqual(3, dataBlock.DataTypes.Count); Assert.AreEqual(3, dataBlock.NullValues.Count); log.ChannelSet[0].Channel.ForEach((x, i) => Assert.AreEqual(x.Mnemonic, dataBlock.Mnemonics[i])); log.ChannelSet[0].Channel.ForEach((x, i) => Assert.AreEqual(x.Uom.ToString(), dataBlock.Units[i])); log.ChannelSet[0].Channel.ForEach((x, i) => Assert.AreEqual((x.DataType == null ? null : x.DataType.ToString()), dataBlock.DataTypes[i])); }
/// <summary> /// Determines whether this <see cref="Witsml200.ComponentSchemas.ChannelIndex"/> instance is increasing. /// </summary> /// <param name="channelIndex">Index of the channel.</param> /// <returns>true if increasing, false otherwise.</returns> public static bool IsIncreasing(this Witsml200.ComponentSchemas.ChannelIndex channelIndex) { return(channelIndex.Direction.GetValueOrDefault(Witsml200.ReferenceData.IndexDirection.increasing) == Witsml200.ReferenceData.IndexDirection.increasing); }
/// <summary> /// Determines whether this <see cref="Witsml200.ComponentSchemas.ChannelIndex"/> instance is a time index. /// </summary> /// <param name="channelIndex">Index of the channel.</param> /// <param name="includeElapsedTime">if set to <c>true</c> [include elapsed time].</param> /// <returns>true if index is time, false otherwise</returns> public static bool IsTimeIndex(this Witsml200.ComponentSchemas.ChannelIndex channelIndex, bool includeElapsedTime = false) { return(channelIndex.IndexType.GetValueOrDefault() == Witsml200.ReferenceData.ChannelIndexType.datetime || (channelIndex.IndexType.GetValueOrDefault() == Witsml200.ReferenceData.ChannelIndexType.elapsedtime && includeElapsedTime)); }
/// <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)); }
/// <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="channel">The channel.</param> /// <returns>An <see cref="EtpUri"/> instance.</returns> public static EtpUri GetUri(this Witsml200.ComponentSchemas.ChannelIndex entity, Witsml200.Channel channel) { return(channel.GetUri() .Append(ObjectTypes.ChannelIndex, entity.Mnemonic)); }