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 LogExtensions_GetByMnemonic_Returns_200_Channel_By_Mnemonic() { var log = new Energistics.DataAccess.WITSML200.Log { Uuid = "uid", Citation = new Witsml200.ComponentSchemas.Citation(), Wellbore = new Witsml200.ComponentSchemas.DataObjectReference(), SchemaVersion = "2.0" }; // Create channel set var channelSet = _log20Generator.CreateChannelSet(log); channelSet.Index.Add(_log20Generator.CreateMeasuredDepthIndex(Witsml200.ReferenceData.IndexDirection.increasing)); channelSet.Channel = null; var channel = channelSet.Channel.GetByMnemonic("gr"); Assert.IsNull(channel); channelSet.Channel = new List <Energistics.DataAccess.WITSML200.Channel>(); channel = channelSet.Channel.GetByMnemonic("gr"); Assert.IsNull(channel); // Add curves channelSet.Channel.Add(_log20Generator.CreateChannel(log, channelSet.Index, "HKLD", "HKLD", Witsml200.ReferenceData.UnitOfMeasure.klbf, "hookload", Witsml200.ReferenceData.EtpDataType.@double, new List <Witsml200.ComponentSchemas.PointMetadata>())); var gammaChannel = _log20Generator.CreateChannel(log, channelSet.Index, "GR", "GR", Witsml200.ReferenceData.UnitOfMeasure.gAPI, "gamma_ray", Witsml200.ReferenceData.EtpDataType.@double, new List <Witsml200.ComponentSchemas.PointMetadata>()); channelSet.Channel.Add(gammaChannel); channel = channelSet.Channel.GetByMnemonic("gr"); Assert.IsNotNull(channel); Assert.AreEqual(gammaChannel, channel); }
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_IsIncreasing_Returns_If_ChannelSet_Is_Increasing_Correctly() { var log = new Witsml200.Log { Uuid = "uid", Citation = new Witsml200.ComponentSchemas.Citation(), Wellbore = new Witsml200.ComponentSchemas.DataObjectReference(), SchemaVersion = "2.0" }; var channelSet = _log20Generator.CreateChannelSet(log); channelSet = null; var isIncreasing = channelSet.IsIncreasing(); Assert.IsTrue(isIncreasing); // Create channel set channelSet = _log20Generator.CreateChannelSet(log); channelSet.Index.Add(_log20Generator.CreateMeasuredDepthIndex(Witsml200.ReferenceData.IndexDirection.decreasing)); isIncreasing = channelSet.IsIncreasing(); Assert.IsFalse(isIncreasing); channelSet.Index.Clear(); channelSet.Index.Add(_log20Generator.CreateMeasuredDepthIndex(Witsml200.ReferenceData.IndexDirection.increasing)); isIncreasing = channelSet.IsIncreasing(); Assert.IsTrue(isIncreasing); }
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()); }
public void EtpUris_GetUri_Can_Get_Log_200_Uri() { var log = new Witsml200.Log { Uuid = _data.Uid() }; var uri = log.GetUri(); Assert.IsTrue($"eml://witsml20/Log({ log.Uuid })".EqualsIgnoreCase(uri.ToString())); Assert.AreEqual("Log", uri.ObjectType); Assert.AreEqual(log.Uuid, uri.ObjectId); }
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); }
/// <summary> /// Gets multiple readers for a <see cref="Witsml200.Log"/> instance. /// </summary> /// <param name="log">The log.</param> /// <returns>An <see cref="IEnumerable{ChannelDataReader}"/>.</returns> public static IEnumerable <ChannelDataReader> GetReaders(this Witsml200.Log log) { if (log?.ChannelSet == null) { yield break; } _log.DebugFormat("Creating ChannelDataReaders for {0}", log.GetType().FullName); foreach (var channelSet in log.ChannelSet) { var reader = channelSet.GetReader(); if (reader == null) { continue; } yield return(reader); } }
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); }
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> /// 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.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)); }
/// <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)); }