public static void creatWellGeoFile(string _sJH) { creatWellGeoHeadFile(_sJH); List <ItemDicInjectProfile> listInjectionProfile = new List <ItemDicInjectProfile>(); List <itemInputProfile> listInputProfile = readInputFile(_sJH); foreach (string _YM in listInputProfile.Select(p => p.sYM).Distinct()) { List <itemInputProfile> listInputCurrentYM = listInputProfile.FindAll(p => p.sYM == _YM); float fZZRL = listInputCurrentYM.Sum(p => p.fZRL);; //当前年月总注入量 foreach (itemInputProfile _item in listInputCurrentYM) { ItemDicInjectProfile itemOut = new ItemDicInjectProfile(); itemOut.sJH = _item.sJH; itemOut.sYM = _item.sYM; itemOut.fDS1 = _item.fDS1; itemOut.fDS2 = _item.fDS2; itemOut.fZRL = _item.fZRL; itemOut.fPercentZR = (_item.fZRL / fZZRL) * 100; itemOut.fXSHD = _item.fDS2 - _item.fDS1; itemOut.FXSQD = _item.fZRL / itemOut.fXSHD; itemOut.sXCM = cIOinputLayerDepth.getXCMByJHAndDepthInterval(_sJH, _item.fDS1, _item.fDS2); listInjectionProfile.Add(itemOut); } } List <string> ltStrLine = new List <string>(); foreach (ItemDicInjectProfile _item in listInjectionProfile) { ltStrLine.Add(ItemDicInjectProfile.item2string(_item)); } string filePath = Path.Combine(cProjectManager.dirPathWellDir, _sJH, cProjectManager.fileNameWellProfile); cIOGeoEarthText.addDataLines2GeoEarTxt(filePath, ltStrLine); }
public static ItemDicInjectProfile getItemByJHandXCM(string _sJH, string _xcm) { ItemDicInjectProfile itemReturn = new ItemDicInjectProfile(); string filePath = Path.Combine(cProjectManager.dirPathWellDir, _sJH, cProjectManager.fileNameWellPerforation); 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 > 10) //geofile 从8开始 { if (line.TrimEnd() != "") { ItemDicInjectProfile sttItem = ItemDicInjectProfile.parseLine(line); if (sttItem.sJH != null) { if (sttItem.sJH == _sJH && sttItem.sXCM == _xcm) { return(sttItem); } } } } } } } return(itemReturn); }
public static ItemDicInjectProfile parseLine(string line) { string[] split = line.Trim().Split(new char[] { ' ', '\t', ',' }, StringSplitOptions.RemoveEmptyEntries); ItemDicInjectProfile item = new ItemDicInjectProfile(); if (split.Length >= 9) { item.sJH = split[0]; item.sYM = split[1]; item.fDS1 = 0.0f; float.TryParse(split[2], out item.fDS1); item.fDS2 = 0.0f; float.TryParse(split[3], out item.fDS2); item.fZRL = 0.0f; float.TryParse(split[4], out item.fZRL); item.fPercentZR = 0.0f; float.TryParse(split[5], out item.fPercentZR); item.fXSHD = 0.0f; float.TryParse(split[6], out item.fXSHD); item.FXSQD = 0.0f; float.TryParse(split[7], out item.FXSQD); item.sXCM = split[8]; } return(item); }
private void btnCalResult_Click(object sender, EventArgs e) { sSelectedLayer = cbbSelectedLayerName.SelectedItem.ToString(); List <ItemDicLayerDataStatic> listDicLayer = cIODicLayerDataStatic.readDicLayerData2struct(); ItemDicLayerDataStatic wellInjectLayerdata = listDicLayer.Find(p => p.sJH == this.cbbWellInject.SelectedItem.ToString() && p.sXCM == sSelectedLayer); for (int i = 0; i < dgvInj2Pro.RowCount - 1; i++) { string sJHProdcut = dgvInj2Pro.Rows[i].Cells[1].Value.ToString(); ItemDicLayerDataStatic wellProductLayerdata = listDicLayer.Find(p => p.sJH == sJHProdcut && p.sXCM == sSelectedLayer); //计算井距 double distance = cCalDistance.calDistance2D(wellInjectLayerdata.dbX, wellInjectLayerdata.dbY, wellProductLayerdata.dbX, wellProductLayerdata.dbY); dgvInj2Pro.Rows[i].Cells[2].Value = distance.ToString("0.0"); //根据井号和小层名查累积射开厚度 ItemDicPerforation performItem = cIOinputWellPerforation.getItemByJHandXCM(sJHProdcut, sSelectedLayer); dgvInj2Pro.Rows[i].Cells[3].Value = performItem.fSKHD.ToString("0.0"); //根据井号和小层名查吸水比例 ItemDicInjectProfile profileItem = cIOinputInjectProfile.getItemByJHandXCM(sJHProdcut, sSelectedLayer); dgvInj2Pro.Rows[i].Cells[4].Value = profileItem.fPercentZR.ToString("0.0"); dgvInj2Pro.Rows[i].Cells[5].Value = profileItem.fXSHD.ToString("0.0"); //小层数据表选项 dgvInj2Pro.Rows[i].Cells[6].Value = wellProductLayerdata.fKXD.ToString("0.0"); dgvInj2Pro.Rows[i].Cells[7].Value = wellProductLayerdata.fSTL.ToString("0.0"); dgvInj2Pro.Rows[i].Cells[8].Value = sSelectedLayer; } // cCalDistance.calWellHeadWellDistance(sInjectWellSelected, ltStrSelectedJH, fileName); //cPublicMethodForm.read2DataGridViewByTextFile(fileName, this.dgvInj2Pro); }
public static void selectSectionDrawData2File(string sJH, string filePath) { StreamWriter sw = new StreamWriter(filePath, false, Encoding.UTF8); string sReturn = ""; foreach (var item in readInjectionProfile2Struct(sJH)) { sReturn += ItemDicInjectProfile.item2string(item) + "\t"; } sw.Write(sReturn); sw.Close(); }
public static string item2string(ItemDicInjectProfile item) { List <string> ltStrWrited = new List <string>(); ltStrWrited.Add(item.sJH); ltStrWrited.Add(item.sYM); ltStrWrited.Add(item.fDS1.ToString()); ltStrWrited.Add(item.fDS2.ToString()); ltStrWrited.Add(item.fZRL.ToString()); ltStrWrited.Add(item.fPercentZR.ToString("0.0")); ltStrWrited.Add(item.fXSHD.ToString("0.0")); ltStrWrited.Add(item.FXSQD.ToString("0.0")); ltStrWrited.Add(item.sXCM); return(string.Join("\t", ltStrWrited.ToArray())); }
/// <summary> /// /// </summary> public static List <ItemDicInjectProfile> readInjectionProfile2Struct(string sJH) { List <ItemDicInjectProfile> listItems = new List <ItemDicInjectProfile>(); string inputFilePath = Path.Combine(cProjectManager.dirPathWellDir, sJH, cProjectManager.fileNameWellProfile); if (File.Exists(inputFilePath)) { List <string> ltLines = cIOGeoEarthText.getDataLineListStringFromGeoText(inputFilePath); foreach (string line in ltLines) { if (line.TrimEnd() != "") { ItemDicInjectProfile item = ItemDicInjectProfile.parseLine(line); listItems.Add(item); } } } return(listItems); }