private void buttonMsheExt_Click(object sender, EventArgs e) { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { HeadObservations.WriteExtractionDFS0(folderBrowserDialog1.SelectedPath, listBoxAnlaeg.Items.Cast <Plant>(), dateTimeStartExt.Value, dateTimeEndExt.Value); } }
private void buttonReadMshe_Click(object sender, EventArgs e) { openFileDialog2.Filter = "Known file types (*.she)|*.she"; openFileDialog2.ShowReadOnly = true; openFileDialog2.Title = "Select a .she file with MikeShe setup"; if (openFileDialog2.ShowDialog() == DialogResult.OK) { LC.MikeSheFileName = openFileDialog2.FileName; if (Wells == null) { Wells = new IWellCollection(); foreach (IWell W in HeadObservations.ReadInDetailedTimeSeries(LC.MShe)) { Wells.Add(W); } LC.Wells = Wells; } LC.DistributeIntakesOnLayers(); if (LC.WellsOutSideModelDomain.Count > 0) { if (DialogResult.Yes == MessageBox.Show(LC.WellsOutSideModelDomain.Count + " wells found outside horizontal MikeShe model domain.\n Remove these wells from list?", "Wells outside model domain", MessageBoxButtons.YesNo)) { foreach (IWell W in LC.WellsOutSideModelDomain) { Wells.Remove(W.ID); } } } UpdateListsAndListboxes(); } }
private void buttonLSFile_Click_1(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() == DialogResult.OK) { bool WriteAll = (DialogResult.Yes == MessageBox.Show("Press \"Yes\" if you want to write all values for individual time series.\nPress \"No\" if you want to write the average value of the time series.", "Average or all?", MessageBoxButtons.YesNo)); HeadObservations.WriteToLSInput(saveFileDialog1.FileName, listBoxIntakes.Items.Cast <IIntake>(), dateTimePicker1.Value, dateTimePicker2.Value, WriteAll); } }
private void WriteNovanaShape(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() == DialogResult.OK) { JupiterReader.AddDataForNovanaPejl(listBoxIntakes.Items.Cast <JupiterIntake>()); HeadObservations.WriteShapeFromDataRow(saveFileDialog1.FileName, listBoxIntakes.Items.Cast <JupiterIntake>()); } }
private void SelectExtrations() { double MinVal; if (!double.TryParse(textBoxMeanYearlyExt.Text, out MinVal)) { MinVal = 0; textBoxMeanYearlyExt.Text = "0"; } if (DPlants != null) { listBoxAnlaeg.Items.Clear(); if (MinVal == 0) { listBoxAnlaeg.Items.AddRange(DPlants.OrderBy(var => var.Name).ToArray()); } else { List <Plant> Slist = new List <Plant>(); foreach (Plant P in DPlants) { if (P.Extractions.Items.Count > 0) { var ReducedList = P.Extractions.Items.Where(var2 => HeadObservations.InBetween2(var2, dateTimeStartExt.Value, dateTimeEndExt.Value)); if (ReducedList.Count() > 0) { if (ReducedList.Average(var => var.Value) >= MinVal) { Slist.Add(P); } } } } listBoxAnlaeg.Items.AddRange(Slist.OrderBy(var => var.ToString()).ToArray()); } textBoxPlantCount.Text = listBoxAnlaeg.Items.Count.ToString(); } }
private void buttonMSheObs_Click(object sender, EventArgs e) { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { IEnumerable <IIntake> SelectedWells = listBoxIntakes.Items.Cast <IIntake>(); int TotalDfs0 = SelectedWells.Count(); progressBar1.Maximum = TotalDfs0; progressBar1.Value = 0; progressBar1.Visible = true; labelProgBar.Visible = true; this.Refresh(); foreach (IIntake I in SelectedWells) { progressBar1.Value++; HeadObservations.WriteToDfs0(folderBrowserDialog1.SelectedPath, I, dateTimePicker1.Value, dateTimePicker2.Value); } HeadObservations.WriteToMikeSheModel(folderBrowserDialog1.SelectedPath, SelectedWells, dateTimePicker1.Value, dateTimePicker2.Value); HeadObservations.WriteToDatFile(Path.Combine(folderBrowserDialog1.SelectedPath, "Timeseries.dat"), SelectedWells, dateTimePicker1.Value, dateTimePicker2.Value); } progressBar1.Visible = false; labelProgBar.Visible = false; }
private void button3_Click(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() == DialogResult.OK) { IEnumerable <Plant> plants = listBoxAnlaeg.Items.Cast <Plant>(); IEnumerable <JupiterIntake> intakes = JupiterReader.AddDataForNovanaExtraction(plants, dateTimeStartExt.Value, dateTimeEndExt.Value); HeadObservations.WriteShapeFromDataRow(saveFileDialog1.FileName, intakes); IEnumerable <Plant> PlantWithoutIntakes = plants.Where(var => var.PumpingIntakes.Count == 0); if (PlantWithoutIntakes.Count() > 0) { if (DialogResult.Yes == MessageBox.Show("The list contains plants with no intakes attached. Should these be written to a new shape-file?", "Plants without intakes!", MessageBoxButtons.YesNo)) { if (saveFileDialog1.ShowDialog() == DialogResult.OK) { NovanaTables.IndvindingerDataTable dt = JupiterReader.FillPlantData(PlantWithoutIntakes, dateTimeStartExt.Value, dateTimeEndExt.Value); ShapeWriter PSW = new ShapeWriter(saveFileDialog1.FileName); PSW.WritePointShape(dt, dt.ANLUTMXColumn.ColumnName, dt.ANLUTMYColumn.ColumnName); PSW.Dispose(); } } } } }
/// <summary> /// Opens a point shape /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { openFileDialog2.Filter = "Known file types (*.shp)|*.shp"; this.openFileDialog2.ShowReadOnly = true; this.openFileDialog2.Title = "Select a shape file with data for wells or intakes"; if (openFileDialog2.ShowDialog() == DialogResult.OK) { string FileName = openFileDialog2.FileName; ShapeReader SR = new ShapeReader(FileName); DataTable FullDataSet = SR.Data.Read(); //Launch a data selector DataSelector DS = new DataSelector(FullDataSet); if (DS.ShowDialog() == DialogResult.OK) { if (ShpConfig == null) { XmlSerializer x = new XmlSerializer(typeof(ShapeReaderConfiguration)); string InstallationPath = Path.GetDirectoryName(this.GetType().Assembly.Location); string config = Path.Combine(InstallationPath, "ShapeReaderConfig.xml"); using (FileStream fs = new FileStream(config, FileMode.Open)) { ShpConfig = (ShapeReaderConfiguration)x.Deserialize(fs); if (CheckColumn(FullDataSet, ShpConfig.WellIDHeader, config)) { if (CheckColumn(FullDataSet, ShpConfig.IntakeNumber, config)) { if (CheckColumn(FullDataSet, ShpConfig.XHeader, config)) { if (CheckColumn(FullDataSet, ShpConfig.YHeader, config)) { if (CheckColumn(FullDataSet, ShpConfig.TOPHeader, config)) { if (CheckColumn(FullDataSet, ShpConfig.BOTTOMHeader, config)) { Wells = new IWellCollection(); if (FullDataSet.Columns.Contains(ShpConfig.PlantIDHeader)) { DPlants = new IPlantCollection(); HeadObservations.FillInFromNovanaShape(DS.SelectedRows, ShpConfig, Wells, DPlants); } else { HeadObservations.FillInFromNovanaShape(DS.SelectedRows, ShpConfig, Wells); } UpdateListsAndListboxes(); } } } } } } } } } SR.Dispose(); } }