예제 #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(Witsml131.Log log, bool keepGridData, Action <WitsmlException> errorHandler)
 {
     ClearDataTable(log.GetUri(), keepGridData);
     Task.Run(() =>
     {
         try
         {
             SetChannelData(log.GetReader());
         }
         catch (WitsmlException ex)
         {
             _log.WarnFormat("Error setting log data: {0}", ex);
             errorHandler(ex);
         }
     });
 }
예제 #2
0
        /// <summary>
        /// Gets a <see cref="ChannelDataReader" /> for a <see cref="Witsml131.Log" />.
        /// </summary>
        /// <param name="log">The <see cref="Witsml131.Log" /> instance.</param>
        /// <returns>A <see cref="ChannelDataReader" />.</returns>
        public static ChannelDataReader GetReader(this Witsml131.Log log)
        {
            if (log?.LogData == null || !log.LogData.Any())
            {
                return(null);
            }

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

            var isTimeIndex = log.IsTimeLog();
            var increasing  = log.IsIncreasing();

            // Split index curve from other value curves
            var indexCurve    = log.LogCurveInfo.GetByMnemonic(log.IndexCurve?.Value);
            var logCurveInfos = log.LogCurveInfo.Where(x => x != indexCurve).OrderBy(x => x.ColumnIndex.GetValueOrDefault()).ToList();
            var mnemonics     = logCurveInfos.Select(x => x.Mnemonic).ToArray();
            var units         = logCurveInfos.Select(x => x.Unit).ToArray();
            var dataTypes     = logCurveInfos.Select(x => x.TypeLogData?.ToString()).ToArray();
            var nullValues    = logCurveInfos.Select(x => x.NullValue).ToArray();

            return(new ChannelDataReader(log.LogData, mnemonics.Length + 1, mnemonics, units, dataTypes, nullValues, log.GetUri())
                   // Add index curve to separate collection
                   .WithIndex(indexCurve.Mnemonic, indexCurve.Unit, increasing, isTimeIndex));
        }
예제 #3
0
 /// <summary>
 /// Gets the <see cref="EtpUri"/> for a given <see cref="Energistics.DataAccess.WITSML131.ComponentSchemas.LogCurveInfo"/>.
 /// </summary>
 /// <param name="entity">The <see cref="Energistics.DataAccess.WITSML131.ComponentSchemas.LogCurveInfo"/> entity.</param>
 /// <param name="log">The log.</param>
 /// <returns>An <see cref="EtpUri"/> instance.</returns>
 public static EtpUri GetUri(this Witsml131.ComponentSchemas.LogCurveInfo entity, Witsml131.Log log)
 {
     return(log.GetUri()
            .Append(ObjectTypes.LogCurveInfo, entity.Mnemonic, true));
 }