public static ItemJSJL parseLine(string line) { string[] split = line.Trim().Split(new char[] { ' ', '\t', ',' }, StringSplitOptions.RemoveEmptyEntries); ItemJSJL item = new ItemJSJL(); if (split.Length >= 9) { item.sJH = split[0]; item.fDS1 = 0.0f; float.TryParse(split[1], out item.fDS1); item.fDS2 = 0.0f; float.TryParse(split[2], out item.fDS2); item.fSandThickness = 0.0f; float.TryParse(split[3], out item.fSandThickness); item.fNetPaySand = 0.0f; float.TryParse(split[4], out item.fNetPaySand); item.fKXD = -999.0f; float.TryParse(split[5], out item.fKXD); item.fSTL = -999.0f; float.TryParse(split[6], out item.fSTL); item.fBHD = -999.0f; float.TryParse(split[7], out item.fBHD); string _sJSJL = split[8]; item.iJSJL = codeReplace.codeReplaceJSJL2int(_sJSJL); } return(item); }
static List <ItemJSJL> readInputFile(string _sJH) { List <ItemJSJL> listJSJLreturn = new List <ItemJSJL>(); string filePath = Path.Combine(cProjectManager.dirPathWellDir, _sJH, cProjectManager.fileNameInputJSJL); if (File.Exists(filePath)) { using (StreamReader sr = new StreamReader(filePath, Encoding.UTF8)) { String line; int iLine = 0; while ((line = sr.ReadLine()) != null) //delete the line whose legth is 0 { iLine++; if (iLine > 0) { if (line.TrimEnd() != "") { ItemJSJL sttJSJL = ItemJSJL.parseLine(line); if (sttJSJL.sJH != null) { listJSJLreturn.Add(sttJSJL); } } } } } } return(listJSJLreturn); }
public static void write2File(string filePath, List <ItemJSJL> listItemJSJL) { StreamWriter swNew = new StreamWriter(filePath, false, Encoding.UTF8); foreach (ItemJSJL item in listItemJSJL) { swNew.WriteLine(ItemJSJL.item2string(item)); } swNew.Close(); }
public static string selectJSJL2String(string sJH) { string sReturn = ""; foreach (var item in readJSJL2Struct(sJH)) { sReturn += ItemJSJL.item2string(item) + "\t"; } return(sReturn); }
public static void creatWellGeoFile(string _sJH) { string filePath = Path.Combine(cProjectManager.dirPathWellDir, _sJH, cProjectManager.fileNameWellJSJL); List <ItemJSJL> ltJSJL = readInputFile(_sJH); creatWellGeoHeadFile(_sJH); List <string> ltStrLine = new List <string>(); foreach (ItemJSJL _item in ltJSJL.FindAll(p => p.sJH == _sJH)) { ltStrLine.Add(ItemJSJL.item2string(_item)); } cIOGeoEarthText.addDataLines2GeoEarTxt(filePath, ltStrLine); }
public static string item2string(ItemJSJL item) { List <string> ltStrWrited = new List <string>(); ltStrWrited.Add(item.sJH); ltStrWrited.Add(item.fDS1.ToString()); ltStrWrited.Add(item.fDS2.ToString()); ltStrWrited.Add(item.fSandThickness.ToString()); ltStrWrited.Add(item.fNetPaySand.ToString()); ltStrWrited.Add(item.fKXD.ToString()); ltStrWrited.Add(item.fSTL.ToString()); ltStrWrited.Add(item.fBHD.ToString()); ltStrWrited.Add(item.iJSJL.ToString()); return(string.Join("\t", ltStrWrited.ToArray())); }
public static List <ItemJSJL> readJSJL2Struct(string _sJH) { string filePath = Path.Combine(cProjectManager.dirPathWellDir, _sJH, cProjectManager.fileNameWellJSJL); List <ItemJSJL> listJSJLreturn = new List <ItemJSJL>(); if (File.Exists(filePath)) { List <string> ltLines = cIOGeoEarthText.getDataLineListStringFromGeoText(filePath); foreach (string line in ltLines) { if (line.TrimEnd() != "") { ItemJSJL sttJSJL = ItemJSJL.parseLine(line); if (sttJSJL.sJH != null) { listJSJLreturn.Add(sttJSJL); } } } } return(listJSJLreturn); }
//劈分测井解释 public static void splitJSJL2Layer(string _sJH) { List <ItemJSJL> listJSJLinput = readInputFile(_sJH); List <ItemDicLayerDepth> listLayerDepth = cIOinputLayerDepth.readLayerDepth2Struct(_sJH); string filePath = Path.Combine(cProjectManager.dirPathWellDir, _sJH, "#jsjlSplit.txt"); List <string> ltStrHeadColoum = new List <string>(); ltStrHeadColoum.Add("井号"); ltStrHeadColoum.Add("顶深"); ltStrHeadColoum.Add("底深"); ltStrHeadColoum.Add("砂厚"); ltStrHeadColoum.Add("有效厚度"); ltStrHeadColoum.Add("孔隙度"); ltStrHeadColoum.Add("渗透率"); ltStrHeadColoum.Add("饱和度"); ltStrHeadColoum.Add("测井解释"); ltStrHeadColoum.Add("小层名"); string sFirstLine = _sJH + "#劈分测井解释"; cIOGeoEarthText.creatFileGeoHeadText(filePath, sFirstLine, ltStrHeadColoum); List <string> ltStrLine = new List <string>(); foreach (ItemJSJL item in listJSJLinput) { string _topXCM = ""; string _botXCM = ""; int mark = 0; for (int i = 0; i < listLayerDepth.Count; i++) { if (item.fDS1 >= listLayerDepth[i].fDS1 && item.fDS1 <= listLayerDepth[i].fDS2) { _topXCM = listLayerDepth[i].sXCM; mark = 1; } if (item.fDS2 >= listLayerDepth[i].fDS1 && item.fDS2 <= listLayerDepth[i].fDS2) { _botXCM = listLayerDepth[i].sXCM; mark = 2; break; } } if (mark == 0) { ltStrLine.Add(ItemJSJL.item2string(item)); } else if (mark == 2) { if (_topXCM == _botXCM) { ltStrLine.Add(ItemJSJL.item2string(item) + " " + _topXCM); } else if (_topXCM == "" || _botXCM == "") { ltStrLine.Add(ItemJSJL.item2string(item) + " " + _topXCM + "_" + _botXCM); } else { int _iStart = cProjectData.ltStrProjectXCM.IndexOf(_topXCM); int _iEnd = cProjectData.ltStrProjectXCM.IndexOf(_botXCM); for (int k = _iStart; k < _iEnd; k++) { //需要改写。。。。 ltStrLine.Add(ItemJSJL.item2string(item) + " " + _topXCM); } } } else { ltStrLine.Add(ItemJSJL.item2string(item) + " " + _topXCM); } ltStrLine.Add(ItemJSJL.item2string(item) + " " + _topXCM + "_" + _botXCM); } cIOGeoEarthText.addDataLines2GeoEarTxt(filePath, ltStrLine); }
//把解释结果归到小层 public static void matchJSJL2Layer(string _sJH) { creatWellGeoHeadFile(_sJH); List <ItemJSJL> listJSJLinput = readInputFile(_sJH); List <ItemDicLayerDepth> listLayerDepth = cIOinputLayerDepth.readLayerDepth2Struct(_sJH); List <ItemLayerDepthInput> listLayerDepthInput = cIOinputLayerDepth.readInputFile(_sJH); if (listLayerDepthInput.Count == 0) { return; } List <string> layerInput = listLayerDepthInput.Select(p => p.sXCM).ToList(); string filePath = Path.Combine(cProjectManager.dirPathWellDir, _sJH, cProjectManager.fileNameWellJSJL); List <string> ltStrLine = new List <string>(); foreach (ItemJSJL item in listJSJLinput) { string _topXCM = ""; string _botXCM = ""; int mark = 0; for (int i = 0; i < listLayerDepth.Count; i++) { if (item.fDS1 >= listLayerDepth[i].fDS1 && item.fDS1 <= listLayerDepth[i].fDS2) { _topXCM = listLayerDepth[i].sXCM; mark = 1; } if (item.fDS2 >= listLayerDepth[i].fDS1 && item.fDS2 <= listLayerDepth[i].fDS2) { _botXCM = listLayerDepth[i].sXCM; mark = 2; break; } } string _xcm = ""; if (mark == 0) { _xcm = "-"; } else if (mark == 2) { if (_topXCM == _botXCM) { _xcm = _topXCM; } else if (_topXCM == "" || _botXCM == "") { _xcm = _topXCM + "-" + _botXCM; } else { int _iStart = layerInput.IndexOf(_topXCM); if (_iStart < 0) { _iStart = 0; _xcm = "-"; } else { int _count = layerInput.IndexOf(_botXCM) - _iStart + 1; if (_count <= 0) { _count = 0; } _xcm = string.Join("+", layerInput.GetRange(_iStart, _count).ToArray()); } } } else { _xcm = _topXCM + "-" + _botXCM; } ltStrLine.Add(ItemJSJL.item2string(item) + " " + _xcm); } cIOGeoEarthText.addDataLines2GeoEarTxt(filePath, ltStrLine); }