/// <summary> /// Resamples all channels in a file /// </summary> public void Resample(Oilfield_File srcFile, Oilfield_File dstFile, int default_method) { for (int i = 1; i < dstFile.Channels.Count; i++) { Oilfield_Channel c = dstFile.GetChannel(i); if ((c.Name.ToLower().Contains("az") || c.Name.ToLower().Contains("ti")) && c.Unit.ToLower().StartsWith("deg")) { this.Resample(srcFile.GetChannel(i), c, LinearInterpolateAngle); continue; } if (c.Unit.ToLower().Equals("m") || c.Unit.ToLower().Equals("ft") || c.Unit.ToLower().Equals("ms") || c.Unit.ToLower().Equals("s")) { this.Resample(srcFile.GetChannel(i), c, LinearInterpolate); continue; } if (c.Unit.ToLower().StartsWith("ohm")) { this.Resample(srcFile.GetChannel(i), c, LogarithmicAverage); continue; } if (c.Unit.ToLower().StartsWith("mho")) { this.Resample(srcFile.GetChannel(i), c, HarmonicAverage); continue; } this.Resample(srcFile.GetChannel(i), c, default_method); } }
protected void GetDataFile(string source) { DirectoryInfo di = new DirectoryInfo(source); if (!di.Exists) { throw new Exception(source + " not found"); } FileInfo[] fis = di.GetFiles(Text); if (fis.Length == 0) { return; } string filename = fis[0].FullName; string extension = fis[0].Extension.ToLower(); if (LastLog != null && LastLog.FileName == filename) { return; } switch (extension) { case ".las": LastLog = new Petronode.OilfieldFileAccess.LAS.LAS_File(filename, true); break; default: LastLog = new Petronode.OilfieldFileAccess.CSV.CSV_File(filename, -999.25); break; } }
/// <summary> /// Constructor. Crates a merge class. Note: the merge is performed on memory only. /// </summary> /// <param name="source">File to take information from</param> /// <param name="destination">File to save the information into</param> public Data_Merge(Oilfield_File source, Oilfield_File destination) { m_src = source; m_dst = destination; double step = 0.0; double step2 = 0.0; try { step = Math.Abs(Convert.ToDouble(m_dst.GetConstant("STEP"))); step2 = Math.Abs(Convert.ToDouble(m_src.GetConstant("STEP"))); } catch (Exception) { } if (step < 0.001) { step = 0.001; } Oilfield_Channel src_Index = source.GetIndex(); Oilfield_Channel dest_Index = destination.GetIndex(); if (step2 < 0.001 && src_Index.Data.Count > 2) { step2 = Math.Abs(src_Index.Data[1] - src_Index.Data[0]); } step2 = 2.0 * Math.Max(step, step2); m_Resampler = new Channel_Resample(src_Index, dest_Index, step * 0.5, step2); }
/// <summary> /// Creates the same channes as in the given file /// </summary> /// <param name="file"></param> public override void CreateSameChannels(Oilfield_File file) { for (int i = 1; i < file.Channels.Count; i++) { Oilfield_Channel lc = file.Channels[i]; Oilfield_Channel tmp = this.GetChannel(lc.Name); if (tmp != null) { continue; } this.GetOrCreateChannel(lc.Name, lc.Unit, lc.Description, lc.Format); } }
/// <summary> /// Constructor. Crates a filter class. Note: the filter is performed on memory only. /// </summary> /// <param name="source">File to take information from</param> public Data_Filter(Oilfield_File source) { m_src = source; }
/// <summary> /// Resamples all channels in a file; cretaes channels in the destination as necessary /// </summary> public void ResampleCreateChannels(Oilfield_File srcFile, Oilfield_File dstFile, int default_method) { dstFile.CreateSameChannels(srcFile); Resample(srcFile, dstFile, default_method); }
/// <summary> /// Resamples all channels in a file; cretaes channels in the destination as necessary /// </summary> public void ResampleCreateChannels(Oilfield_File srcFile, Oilfield_File dstFile) { dstFile.CreateSameChannels(srcFile); Resample(srcFile, dstFile); }
/// <summary> /// Resamples all channels in a file /// </summary> public void Resample(Oilfield_File srcFile, Oilfield_File dstFile) { Resample(srcFile, dstFile, LinearInterpolate); }
/// <summary> /// Constructor; assigns the Oilfield file /// </summary> /// <param name="file">data file</param> public MinimumCurvatureAlgorithm(Oilfield_File file) { m_file = file; }