private void CreateWell(Well well, BoreholeCollection boreholeColl) { using (ITransaction tr = DataManager.NewTransaction()) { tr.Lock(boreholeColl); Borehole borehole = boreholeColl.CreateBorehole(well.Name); borehole.Comments = "Imported from FIELDPRO"; borehole.UWI = well.Uwi; var coordinates = well.CartesianCoordinates(); borehole.WellHead = new Point2(coordinates["X"], coordinates["Y"]); ReferenceLevel kb = new ReferenceLevel("KB", well.Z, "Kelly bushing"); borehole.WorkingReferenceLevel = kb; var trajectoryRecords = this.GetTrajectoryRecords(well); try { borehole.Trajectory.Records = trajectoryRecords; } catch (ArgumentOutOfRangeException ex) { PetrelLogger.InfoOutputWindow("Failed to set trajectory: " + ex.ToString()); } SetProperty("Field", well.Field, borehole, true); SetProperty("Area", well.Area, borehole, true); SetProperty("Country", well.Country, borehole, true); SetProperty("FIELDPRO ID", well.ID.ToString(), borehole, false); tr.Commit(); } }
private void LoadWellLogs() { WellRoot wellRoot = WellRoot.Get(PetrelProject.PrimaryProject); BoreholeCollection boreholeColl = wellRoot.BoreholeCollection; WellLogImporter importer = new WellLogImporter(); var files = importer.GetWellLogFiles(boreholeColl); SetWellLogsList(files); }
private void FindAllBoreholesRecursively(BoreholeCollection boreholeCollection, List <Borehole> boreholes) { foreach (Borehole borehole in boreholeCollection) { boreholes.Add(borehole); } // foreach (var childBoreholeCollection in boreholeCollection.BoreholeCollections) { FindAllBoreholesRecursively(childBoreholeCollection, boreholes); } }
private void tabPage4_Paint(object sender, PaintEventArgs e) { if (!bwellsshown) { bwellsshown = true; WellsList.Items.Clear(); WellRoot wellRoot = WellRoot.Get(PetrelProject.PrimaryProject); BoreholeCollection boreholeColl = wellRoot.BoreholeCollection; foreach (Borehole bh in boreholeColl) { WellsList.Items.Add(bh.Name, true); } } }
private void button1_Click(object sender, EventArgs e) { WellRoot wellRoot = WellRoot.Get(PetrelProject.PrimaryProject); BoreholeCollection boreholeColl = wellRoot.BoreholeCollection; string WellTextData = ""; string TrajTextData = ""; foreach (Borehole bh in boreholeColl) { bool bok = false; foreach (object itemChecked in WellsList.CheckedItems) { if (itemChecked.ToString() == bh.Name) { bok = true; break; } } if (!bok) { continue; } PetrelLogger.InfoOutputWindow("Loading: " + bh.Name); Well w = WellsImporter.Borehole2Well(bh); WellTextData += w.Serialize() + Environment.NewLine; IEnumerable <TrajectoryRecord> ie = bh.Trajectory.Records; foreach (TrajectoryRecord r in ie) { WellTrajectory t = new WellTrajectory(r); TrajTextData += t.Serialize(bh.Name) + Environment.NewLine; } } if (!string.IsNullOrEmpty(WellTextData)) { string datafile = System.IO.Path.GetTempPath() + "petrelwells.txt"; System.IO.File.WriteAllText(datafile, Well.TxtHeader + Environment.NewLine + WellTextData); WebImporterWrapper wi = new WebImporterWrapper(WebConfiguration.Current); int id = wi.UploadWells(datafile); } if (!string.IsNullOrEmpty(TrajTextData)) { string datafile = System.IO.Path.GetTempPath() + "petreltraj.txt"; System.IO.File.WriteAllText(datafile, WellTrajectory.TxtHeader + Environment.NewLine + TrajTextData); WebImporterWrapper wi = new WebImporterWrapper(WebConfiguration.Current); int id = wi.UploadTraj(datafile); } }
public List <WellLogFile> GetWellLogFiles(BoreholeCollection wells) { var files = new List <WellLogFile>(); BoreholePropertyCollection bhPropertyColl = wells.BoreholePropertyCollection; DictionaryBoreholeProperty dicProperty = DictionaryBoreholeProperty.NullObject; dicProperty = WellsImporter.FindDictionaryProperty(bhPropertyColl, "FIELDPRO ID"); foreach (Borehole well in wells) { string id = well.PropertyAccess.GetPropertyValue <string>(dicProperty); if (!String.IsNullOrEmpty(id.Trim())) { files.AddRange(WellLogFile.Broker.GetAllOfWell(id.Trim())); } } return(files); }
private void ImportWell(Well well, BoreholeCollection boreholeColl) { string uwi = well.Uwi; if (uwi.Trim().Length == 0) { PetrelLogger.InfoOutputWindow("Unable to import well: " + well.Name + " => UWI not defined."); return; } Borehole borehole = boreholeColl.FindWellByUWI(uwi); PetrelLogger.InfoOutputWindow("Importing well named: " + well.Name); if (borehole == null) { PetrelLogger.InfoOutputWindow("Creating well named: " + well.Name); CreateWell(well, boreholeColl); } else { PetrelLogger.InfoOutputWindow("Skip existing well: " + well.Name); } }
private void ListAllBoreholesRecursively(BoreholeCollection boreholeCollection, int indentationLevel) { string prefixIndentation = Enumerable .Range(0, indentationLevel) .Aggregate("", (acc, curr) => acc + "\t"); // // print borehole collection name PetrelLogger.InfoOutputWindow(prefixIndentation + "Borehole Collection: " + boreholeCollection.Name + " has " + boreholeCollection.Count + " wells"); // // print all of the boreholes in the borehole collection foreach (Borehole borehole in boreholeCollection) { PetrelLogger.InfoOutputWindow(prefixIndentation + "\t" + "Well: " + borehole.Name); } // foreach (var childBoreholeCollection in boreholeCollection.BoreholeCollections) { ListAllBoreholesRecursively(childBoreholeCollection, indentationLevel + 1); } }
private void PrintBoreholeCollection(BoreholeCollection boreholeCollection) { PetrelLogger.InfoOutputWindow("Borehole Collection: " + boreholeCollection.Name + " has " + boreholeCollection.Count.ToString() + " wells."); if (boreholeCollection.Count > 0) { foreach (Borehole well in boreholeCollection) { double min = PetrelUnitSystem.ConvertToUI(Domain.MD, well.MDRange.Min); double max = PetrelUnitSystem.ConvertToUI(Domain.MD, well.MDRange.Max); //PetrelLogger.InfoOutputWindow(" Well: " + well.Name + "\t MD range: " + min.ToString() + ", " + max.ToString()); PetrelLogger.InfoOutputWindow(" Well: " + well.Name); } } if (boreholeCollection.BoreholeCollectionCount > 0) { foreach (BoreholeCollection col in boreholeCollection.BoreholeCollections) { PrintBoreholeCollection(col); } } }
private void ImportWells(List <Well> wells, WebConfiguration wc) { WellRoot wellRoot = WellRoot.Get(PetrelProject.PrimaryProject); EnsureBoreholeCollection(wellRoot); BoreholeCollection boreholeColl = wellRoot.BoreholeCollection; IProgress p = PetrelLogger.NewProgress(0, wells.Count, ProgressType.Cancelable, Cursors.WaitCursor); using (p) { foreach (Well well in wells) { if (p.IsCanceled) { break; } p.SetProgressText("Importing well " + well.Name); Application.DoEvents(); ImportWell(well, boreholeColl); p.ProgressStatus = p.ProgressStatus + 1; } } }