コード例 #1
0
 public OutputData getOutputData()
 {
     if (dataOut == null)
     {
         dataOut = new OutputData(processor, saveToFolderName);
     }
     return(dataOut);
 }
コード例 #2
0
        //adjust button
        private void btnAdjust_Click(object sender, EventArgs e)
        {
            OutputData dataOut = output.getOutputData();
            DateTime   date    = default(DateTime);

            if (saveToFolderName == "")
            {
                MessageBox.Show("Please specify an output folder.");
                return;
            }

            if (forcingFileName == "")
            {
                MessageBox.Show("Please specify an forcing file to adjust.");
                return;
            }

            dataOut.setSaveToFolderName(saveToFolderName);

            var format = (ForcingFormat)Enum.Parse(typeof(ForcingFormat),
                                                   comboBoxFormat.SelectedItem.ToString());

            if (format == ForcingFormat.VIC)
            {
                try {
                    date = DateTime.Parse(textBoxVICstart.Text);
                } catch (Exception) {
                    MessageBox.Show("Date is not in the correct format.");
                    return;
                }
            }

            if (checkBox2.Checked)
            {
                string   folder = Path.GetDirectoryName(forcingFileName);
                string[] files  = Directory.GetFiles(folder);
                foreach (string s in files)
                {
                    try {
                        dataOut.adjustForcingFile(s, format, chkPisces.Checked, date);
                    } catch (Exception) {
                        MessageBox.Show("Error parsing: " + s);
                    }
                }
            }
            else
            {
                dataOut.adjustForcingFile(forcingFileName, format, chkPisces.Checked, date);
            }

            this.Hide();

            //open output folder
            Process.Start(saveToFolderName);
        }
コード例 #3
0
        //create files button
        private void button2_Click(object sender, EventArgs e)
        {
            //check to make sure inputs are correct
            if (textBox1.Text != saveToFolderName || textBox1.Text == "")
            {
                MessageBox.Show("Please specify an output folder before creating files.");
                return;
            }

            //check to see if any outputs have been selected
            if (!(checkBox1.Checked || checkBox2.Checked || checkBox3.Checked || checkBox4.Checked || checkBox5.Checked))
            {
                MessageBox.Show("Please specify a file to create.");
                return;
            }

            dataOut = new OutputData(processor, saveToFolderName);

            processor.generateDeltas();

            if (checkBox1.Checked)
            {
                dataOut.writeHybridDeltaEnsemble();
            }
            if (checkBox2.Checked)
            {
                dataOut.writeHybridEnsemble();
            }
            if (checkBox3.Checked)
            {
                dataOut.writeDeltaEnsemble();
            }
            if (checkBox4.Checked)
            {
                dataOut.writeProjectionSummaries();
            }
            if (checkBox5.Checked)
            {
                graph.drawGraph(null, 0);
                graph.saveGraph(saveToFolderName);
            }

            this.Hide();

            //open output folder
            Process.Start(saveToFolderName);
        }