Exemplo n.º 1
0
        private void RunGcd_Click(object sender, EventArgs e)
        {
            AllInOneForm frmParent = (AllInOneForm)this.MdiParent;

            frmParent.BusyState();
            try
            {
                path = FileTxt.Text;
                var inputs = "";
                var models = ModelChk.CheckedItems.Cast <object>().Aggregate("", (current, model) => current + (model + ","));
                models = models.Remove(models.Length - 1);
                var sens = ScenarioChk.CheckedItems.Cast <object>().Aggregate("", (current, sen) => current + (sen + ","));
                sens    = sens.Remove(sens.Length - 1);
                inputs += "Main Database Folder : " + Environment.NewLine + FileTxt.Text + Environment.NewLine;
                inputs += "Historic Climate Data : " + Environment.NewLine + CruModel.Checked + Environment.NewLine;
                inputs += "Future Climate Models : " + Environment.NewLine + models + Environment.NewLine;
                inputs += "Carbon Emission Scenarios : " + Environment.NewLine + sens + Environment.NewLine;
                inputs += "Precipitation : " + Environment.NewLine + Precipitation.Checked + Environment.NewLine;
                inputs += "Temperature : " + Environment.NewLine + Temperature.Checked + Environment.NewLine;
                OutputRun(false);
                File.WriteAllText(outputPath + "/inputs.txt", inputs);

                MessageBox.Show("end!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            frmParent.ReadyState();
        }
 private void CorrectionForm_Load(object sender, EventArgs e)
 {
     frmParent           = (AllInOneForm)this.MdiParent;
     curentDir           = System.IO.Directory.GetCurrentDirectory();
     ManualFilesTxt.Text = StaticData.UserProjectFolder + @"\UserDatabase";
     OutputTxt.Text      = StaticData.UserProjectFolder + @"\Bias-Corrected";
 }
Exemplo n.º 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            frmParent         = (AllInOneForm)this.MdiParent;
            cdaInputTxt.Text  = StaticData.UserProjectFolder + @"\InputCCDA\DataAnalyzer";
            cdaOutputTxt.Text = StaticData.UserProjectFolder + @"\InputCCDA\DataAnalyzerOutput";

            FileTxt.Text   = StaticData.UserProjectFolder + @"\UserDatabase";
            OutputTxt.Text = StaticData.UserProjectFolder + @"\InputCCDA";
        }
Exemplo n.º 4
0
        private void cdaRunBtn_Click(object sender, EventArgs e)
        {
            AllInOneForm frmParent = (AllInOneForm)this.MdiParent;

            frmParent.BusyState();
            try
            {
                var preName        = PreNameTxt.Text;
                var daysCount      = Convert.ToInt32(DaysTxt.Text);
                var point          = PointsTxt.Text;
                var startDate      = dateTimePicker1.Value;
                var priodStartDate = PriodStartDate.Value;
                var priodEndDate   = PriodEndDate.Value;
                var opr            = oprTxt.Text;
                var path           = cdaInputTxt.Text;
                var outputPath     = cdaOutputTxt.Text;
                var sumCheck       = SumChk.Checked;
                var totalsTxt      = TotalsTxt.Text;
                if (String.IsNullOrEmpty(outputPath))
                {
                    outputPath        = path.Split(new[] { @"\InputCCDA" }, StringSplitOptions.None).FirstOrDefault();
                    outputPath        = outputPath + @"\CCDA\CCDA";
                    cdaOutputTxt.Text = outputPath;
                }
                AnalyzeManager.path    = path;
                AnalyzeManager.outPath = outputPath;
                AnalyzeManager.Analyze(daysCount, preName, point, startDate, opr, priodStartDate, priodEndDate, sumCheck, totalsTxt);

                var inputs = "";

                inputs += "Variables Names : " + Environment.NewLine + preName + Environment.NewLine;
                inputs += "File Start Date : " + Environment.NewLine + dateTimePicker1.Text + Environment.NewLine;
                inputs += "Priod Start Date : " + Environment.NewLine + PriodStartDate.Text + Environment.NewLine;
                inputs += "Priod End Date : " + Environment.NewLine + PriodEndDate.Text + Environment.NewLine;
                inputs += "Critical Length : " + Environment.NewLine + DaysTxt.Text + Environment.NewLine;
                inputs += "Variable Thresholds : " + Environment.NewLine + PointsTxt.Text + Environment.NewLine;
                inputs += "Operation : " + Environment.NewLine + PriodStartDate.Text + Environment.NewLine;
                inputs += "Priod End Date : " + Environment.NewLine + oprTxt.Text + Environment.NewLine;


                File.WriteAllText(outputPath + "/inputs.txt", inputs);
                MessageBox.Show("execute successfully");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            frmParent.ReadyState();
        }
Exemplo n.º 5
0
        private void twoBtn_Click(object sender, EventArgs e)
        {
            AllInOneForm frmParent = (AllInOneForm)this.MdiParent;

            frmParent.BusyState();
            try
            {
                CcdaBtn_Click(sender, e);
                MessageBox.Show("End!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }


            frmParent.ReadyState();
        }
Exemplo n.º 6
0
        private void twoBtn_Click(object sender, EventArgs e)
        {
            AllInOneForm frmParent = (AllInOneForm)this.MdiParent;

            frmParent.BusyState();
            try
            {
                curentDir  = System.IO.Directory.GetCurrentDirectory();
                outputPath = OutputTxt.Text;
                inputPath  = FileTxt.Text;
                var inputs = "";
                var models = ModelChk.CheckedItems.Cast <object>().Aggregate("", (current, model) => current + (model + ","));
                models = models.Remove(models.Length - 1);
                var sens = ScenarioChk.CheckedItems.Cast <object>().Aggregate("", (current, sen) => current + (sen + ","));
                sens    = sens.Remove(sens.Length - 1);
                inputs += "Main Database Folder : " + Environment.NewLine + FileTxt.Text + Environment.NewLine;
                inputs += "Historic Climate Data : " + Environment.NewLine + CruModel.Checked + Environment.NewLine;
                inputs += "Future Climate Models : " + Environment.NewLine + models + Environment.NewLine;
                inputs += "Carbon Emission Scenarios : " + Environment.NewLine + sens + Environment.NewLine;
                inputs += "Precipitation : " + Environment.NewLine + Precipitation.Checked + Environment.NewLine;
                inputs += "Temperature : " + Environment.NewLine + Temperature.Checked + Environment.NewLine;
                inputs += "Latitude From : " + Environment.NewLine + LatFrom.Text + Environment.NewLine;
                inputs += "Latitude To : " + Environment.NewLine + LatTo.Text + Environment.NewLine;
                inputs += "Longitude From : " + Environment.NewLine + LongFrom.Text + Environment.NewLine;
                inputs += "Longitude To : " + Environment.NewLine + LongFrom.Text + Environment.NewLine;
                inputs += "Start Date : " + Environment.NewLine + (SelectedPeriod.Checked ? Environment.NewLine + SimStartDate.Text : "") + Environment.NewLine;
                inputs += "End Date : " + Environment.NewLine + (SelectedPeriod.Checked ? Environment.NewLine + SimEndDate.Text : "") + Environment.NewLine;
                inputs += "User Project Folder : " + Environment.NewLine + OutputTxt.Text + Environment.NewLine;
                StaticData.UserProjectFolder = OutputTxt.Text;
                File.WriteAllText(outputPath + "/inputs.txt", inputs);
                // CcdaBtn_Click(sender, e);
                swatBtn_Click(sender, e);
                MessageBox.Show("End!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            frmParent.ReadyState();
        }
Exemplo n.º 7
0
        private void RunPPUBtn_Click(object sender, EventArgs e)
        {
            AllInOneForm frmParent = (AllInOneForm)this.MdiParent;

            frmParent.BusyState();
            try
            {
                var fileName  = ppuFileTxt.Text;
                var steps     = Convert.ToInt32(StepTxt.Text);
                var zones     = Convert.ToInt32(ZoneTxt.Text);
                var variables = Convert.ToInt32(VarsTxt.Text);
                var path      = ppuOutputTxt.Text;
                if (String.IsNullOrEmpty(path))
                {
                    path = fileName.Split(new[] { @"\InputCCDA" }, StringSplitOptions.None).FirstOrDefault();
                    path = path + @"\CCDA\PPU";
                    ppuOutputTxt.Text = path;
                }
                PpuManager.path     = path;
                PpuManager.fileName = fileName;
                PpuManager.ReadPpu(steps, zones, variables);
                var inputs = "";

                inputs += "Number of time steps : " + Environment.NewLine + StepTxt.Text + Environment.NewLine;
                inputs += "Number of SUBs/HRUs : " + Environment.NewLine + ZoneTxt.Text + Environment.NewLine;
                inputs += "Number of variables : " + Environment.NewLine + VarsTxt.Text + Environment.NewLine;

                File.WriteAllText(path + "/inputs.txt", inputs);

                MessageBox.Show("execute successfully");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            frmParent.ReadyState();
        }
Exemplo n.º 8
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //::  It is the main Function to start                              :::
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        private void RunBtn_Click(object sender, EventArgs e)
        {
            AllInOneForm frmParent = (AllInOneForm)this.MdiParent;

            frmParent.BusyState();
            try
            {
                commentLbl.Text = "Starting...";
                var fileFolders = "";
                if (DirectRb.Checked)
                {
                    fileFolders = DirectFilesTxt.Text;
                    MainRun(fileFolders);
                }
                else
                {
                    var parentFolder = ManualFilesTxt.Text;
                    foreach (var model in ModelChk.CheckedItems)
                    {
                        var modelDirectory = parentFolder + @"\" + model;
                        Directory.CreateDirectory(modelDirectory);
                        foreach (var senario in ScenarioChk.CheckedItems)
                        {
                            var senarioDirectory = modelDirectory + @"\" + senario;
                            Directory.CreateDirectory(senarioDirectory);
                            if (Precipitation.Checked)
                            {
                                var pcpDirectory = senarioDirectory + @"\pcp";
                                Directory.CreateDirectory(pcpDirectory);

                                MainRun(pcpDirectory);
                            }
                            if (Temperature.Checked)
                            {
                                var tmpDirectory = senarioDirectory + @"\tmp";
                                Directory.CreateDirectory(tmpDirectory);

                                MainRun(tmpDirectory);
                            }
                        }
                    }
                }
                var inputs = "";
                var models = ModelChk.CheckedItems.Cast <object>().Aggregate("", (current, model) => current + (model + ","));
                models = models.Remove(models.Length - 1);
                var sens = ScenarioChk.CheckedItems.Cast <object>().Aggregate("", (current, sen) => current + (sen + ","));
                sens    = sens.Remove(sens.Length - 1);
                inputs += "Main Database Folder : " + Environment.NewLine + ManualFilesTxt.Text + Environment.NewLine;
                inputs += "Historic Climate Data : " + Environment.NewLine + CruModel.Checked + Environment.NewLine;
                inputs += "Future Climate Models : " + Environment.NewLine + models + Environment.NewLine;
                inputs += "Carbon Emission Scenarios : " + Environment.NewLine + sens + Environment.NewLine;
                inputs += "Precipitation : " + Environment.NewLine + Precipitation.Checked + Environment.NewLine;
                inputs += "Temperature : " + Environment.NewLine + Temperature.Checked + Environment.NewLine;
                inputs += "Output Folder  : " + Environment.NewLine + OutputTxt.Text + Environment.NewLine;
                inputs += "Simulation File : " + Environment.NewLine + AnomalyTxt.Text + Environment.NewLine;
                inputs += "Measured File : " + Environment.NewLine + MeasuredTxt.Text + Environment.NewLine;
                inputs += "Correction Method : " + Environment.NewLine + (RatioRb.Checked ? RatioRb.Text : PlusRb.Text) + Environment.NewLine;

                File.WriteAllText(ManualFilesTxt.Text.Replace(@"\UserDatabase", @"\Bias-Corrected") + "/inputs.txt", inputs);

                MessageBox.Show("End!");
                commentLbl.Text = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            frmParent.ReadyState();
        }
Exemplo n.º 9
0
 private void GCD_Load(object sender, EventArgs e)
 {
     frmParent    = (AllInOneForm)this.MdiParent;
     curentDir    = System.IO.Directory.GetCurrentDirectory();
     FileTxt.Text = StaticData.UserProjectFolder + @"\UserDatabase";
 }
        private void RunBtn_Click(object sender, EventArgs e)
        {
            AllInOneForm frmParent = (AllInOneForm)this.MdiParent;

            frmParent.BusyState();
            Directory.CreateDirectory(curentDir + @"\backup");
            File.Copy(curentDir + @"\positionDB.mdb", curentDir + @"\backup\" + DateTime.Now.Ticks + "-positionDB.mdb", true);
            try
            {
                var fileFolders = "";
                if (DirectRb.Checked)
                {
                    fileFolders = DirectFilesTxt.Text;
                    MainRun(fileFolders);
                }
                else
                {
                    var parentFolder = ManualFilesTxt.Text;
                    foreach (var model in ModelChk.CheckedItems)
                    {
                        var modelDirectory = parentFolder + @"\" + model;
                        Directory.CreateDirectory(modelDirectory);
                        foreach (var senario in ScenarioChk.CheckedItems)
                        {
                            var senarioDirectory = modelDirectory + @"\" + senario;
                            Directory.CreateDirectory(senarioDirectory);
                            if (Precipitation.Checked)
                            {
                                var pcpDirectory = senarioDirectory + @"\pcp";
                                Directory.CreateDirectory(pcpDirectory);

                                MainRun(pcpDirectory);
                            }
                            if (Temperature.Checked)
                            {
                                var tmpDirectory = senarioDirectory + @"\tmp";
                                Directory.CreateDirectory(tmpDirectory);

                                MainRun(tmpDirectory);
                            }
                        }
                    }
                }
                var inputs = "";
                var models = ModelChk.CheckedItems.Cast <object>().Aggregate("", (current, model) => current + (model + ","));
                models = models.Remove(models.Length - 1);
                var sens = ScenarioChk.CheckedItems.Cast <object>().Aggregate("", (current, sen) => current + (sen + ","));
                sens    = sens.Remove(sens.Length - 1);
                inputs += "Main Database Folder : " + Environment.NewLine + ManualFilesTxt.Text + Environment.NewLine;
                inputs += "Historic Climate Data : " + Environment.NewLine + CruModel.Checked + Environment.NewLine;
                inputs += "Future Climate Models : " + Environment.NewLine + models + Environment.NewLine;
                inputs += "Carbon Emission Scenarios : " + Environment.NewLine + sens + Environment.NewLine;
                inputs += "Precipitation : " + Environment.NewLine + Precipitation.Checked + Environment.NewLine;
                inputs += "Temperature : " + Environment.NewLine + Temperature.Checked + Environment.NewLine;
                inputs += "Latitude From : " + Environment.NewLine + LatFrom.Text + Environment.NewLine;
                inputs += "Latitude To : " + Environment.NewLine + LatTo.Text + Environment.NewLine;
                inputs += "Longitude From : " + Environment.NewLine + LongFrom.Text + Environment.NewLine;
                inputs += "Longitude To : " + Environment.NewLine + LongFrom.Text + Environment.NewLine;
                inputs += "Considering Elevation : " + elevChk.Checked + Environment.NewLine;
                inputs += "Current Grid Size : " + stepTxt.Text + Environment.NewLine;

                File.WriteAllText(ManualFilesTxt.Text.Replace("UserDatabase", "Interpolation").Replace("Bias-Corrected", "Interpolation") + "/inputs.txt", inputs);
                MessageBox.Show("end!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            frmParent.ReadyState();
        }
 private void FileCreator_Load(object sender, EventArgs e)
 {
     curentDir           = System.IO.Directory.GetCurrentDirectory();
     ManualFilesTxt.Text = StaticData.UserProjectFolder + @"\UserDatabase";
     frmParent           = (AllInOneForm)this.MdiParent;
 }
Exemplo n.º 12
0
 private void Form1_Load(object sender, EventArgs e)
 {
     frmParent = (AllInOneForm)this.MdiParent;
 }