Exemplo n.º 1
0
 /// <summary>
 /// Sets the log data.
 /// </summary>
 /// <param name="log">The log.</param>
 /// <param name="keepGridData">True if not clearing data when querying partial results</param>
 /// <param name="errorHandler">The error handler.</param>
 private void SetLogData(Witsml141.Log log, bool keepGridData, Action <WitsmlException> errorHandler)
 {
     ClearDataTable(log.GetUri(), keepGridData);
     Task.Run(() =>
     {
         try
         {
             log.GetReaders().ForEach(SetChannelData);
         }
         catch (WitsmlException ex)
         {
             _log.WarnFormat("Error setting log data: {0}", ex);
             errorHandler(ex);
         }
     });
 }
Exemplo n.º 2
0
        public void ChannelDataExtensions_GetReader_Returns_ChannelDataReader_For_141_Log()
        {
            var log = new Witsml141.Log();

            log = null;
            var readers = log.GetReaders();

            Assert.AreEqual(0, readers.Count());

            log     = new Witsml141.Log();
            readers = log.GetReaders();
            Assert.AreEqual(0, readers.Count());

            log.IndexType    = Witsml141.ReferenceData.LogIndexType.measureddepth;
            log.Direction    = Witsml141.ReferenceData.LogIndexDirection.increasing;
            log.LogCurveInfo = new List <Witsml141.ComponentSchemas.LogCurveInfo>
            {
                new Witsml141.ComponentSchemas.LogCurveInfo
                {
                    Mnemonic = new Witsml141.ComponentSchemas.ShortNameStruct("MD"),
                    Unit     = "m",
                },
                new Witsml141.ComponentSchemas.LogCurveInfo
                {
                    Mnemonic    = new Witsml141.ComponentSchemas.ShortNameStruct("A"),
                    Unit        = "ft",
                    TypeLogData = new Witsml141.ReferenceData.LogDataType?(Witsml141.ReferenceData.LogDataType.@double)
                },
                new Witsml141.ComponentSchemas.LogCurveInfo
                {
                    Mnemonic = new Witsml141.ComponentSchemas.ShortNameStruct("B"),
                    Unit     = "m/hr",
                },
            };
            log.LogData = new List <Witsml141.ComponentSchemas.LogData>()
            {
                new Witsml141.ComponentSchemas.LogData()
                {
                    Data = new List <string>()
                    {
                        "10,1,2",
                        "11,3,4"
                    },
                    MnemonicList = "DEPTH,A,B",
                    UnitList     = "m,ft,m/h"
                },
                new Witsml141.ComponentSchemas.LogData()
                {
                    MnemonicList = "DEPTH,A,B",
                    UnitList     = "m,ft,m/h"
                },
                new Witsml141.ComponentSchemas.LogData()
                {
                    Data         = new List <string>(),
                    MnemonicList = "DEPTH,A,B",
                    UnitList     = "m,ft,m/h"
                }
            };

            readers = log.GetReaders();
            var listOfReaders = readers.ToList();

            Assert.AreEqual(1, listOfReaders.Count);

            AssertReaderAndData(listOfReaders);
        }