Beispiel #1
0
        public static void SetStartEndYears(int years)
        {
            GeoData.GetStartEndYears(rainSourceIndex);
            int yrs = endYear - startYear + 1;

            if (yrs >= years)
            {
                yrs = years;
            }
            startYear = endYear - yrs + 1;
        }
        // Finds adjustments to monthly average rainfall depths for a choice of
        // precip. station location and climate projection year.
        private static void UpdateRainfallAdjustments()
        {
            // Get rainfall adjustments for each scenario
            string rainID = GeoData.GetStationID(SiteData.rainSourceIndex);

            double[] y = new double[12];
            string   precTable;

            rainDelta1.Clear();
            if (SiteData.climateYear == 2035)
            {
                precTable = StormwaterCalculator.Properties.Resources.PREC2035Hot;
            }
            else
            {
                precTable = StormwaterCalculator.Properties.Resources.PREC2060Hot;
            }
            if (GetRainfallAdjustments(precTable, rainID, ref y))
            {
                rainDelta1.Add(null, y);
            }

            rainDelta2.Clear();
            if (SiteData.climateYear == 2035)
            {
                precTable = StormwaterCalculator.Properties.Resources.PREC2035Med;
            }
            else
            {
                precTable = StormwaterCalculator.Properties.Resources.PREC2060Med;
            }
            if (GetRainfallAdjustments(precTable, rainID, ref y))
            {
                rainDelta2.Add(null, y);
            }

            rainDelta3.Clear();
            if (SiteData.climateYear == 2035)
            {
                precTable = StormwaterCalculator.Properties.Resources.PREC2035Wet;
            }
            else
            {
                precTable = StormwaterCalculator.Properties.Resources.PREC2060Wet;
            }
            if (GetRainfallAdjustments(precTable, rainID, ref y))
            {
                rainDelta3.Add(null, y);
            }
        }
Beispiel #3
0
        public static void SaveEvapData(int stationIndex, string stationName)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter      = "Data files (*.dat)|*.dat|All files (*.*)|*.*";
            saveFileDialog1.FilterIndex = 1;
            saveFileDialog1.FileName    = "Evap - " + stationName + ".dat";
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                StreamWriter writer = new StreamWriter(saveFileDialog1.FileName);
                writer.WriteLine(GeoData.GetEvapData(evapSourceIndex, false));
                writer.Close();
            }
        }
Beispiel #4
0
        public static void SaveRainfallData(int stationIndex)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter      = "Data files (*.dat)|*.dat|All files (*.*)|*.*";
            saveFileDialog1.FilterIndex = 1;
            saveFileDialog1.FileName    =
                "Rain - " + GeoData.GetStationID(stationIndex) + ".dat";
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if (GeoData.GetSwmmRainfall(stationIndex) == 0)
                {
                    System.IO.File.Copy(SiteData.rainFile, saveFileDialog1.FileName, true);
                }
            }
        }
Beispiel #5
0
        public static void WriteLongTermInpFile()
        {
            File.Copy(inpFile1, inpFile, true);
            using (StreamWriter sw = File.AppendText(inpFile))
            {
                sw.WriteLine("[RAINGAGES]");
                string stationID = GeoData.GetStationID(SiteData.rainSourceIndex);
                string fname     = rainFile;
                sw.WriteLine(
                    "RainGage1  INTENSITY  1:00  1.0  FILE  \"" + fname + "\" " + stationID + " IN");
                sw.WriteLine();

                // Rainfall adjustments
                if (climateScenarioIndex > 0)
                {
                    sw.WriteLine("[ADJUSTMENTS]");
                    sw.WriteLine(Climate.GetPrecipData(climateScenarioIndex));
                    sw.WriteLine();
                }
            }
        }
        //------------------------------------------------------------------------
        // Retrieves the SCS design storm distribution type for a precip. station.
        //------------------------------------------------------------------------
        public static string GetScsType()
        {
            string rainID = GeoData.GetStationID(SiteData.rainSourceIndex);
            string table  = StormwaterCalculator.Properties.Resources.PREC_SCS_Types;
            string line;

            try
            {
                using (StringReader sr = new StringReader(table))
                {
                    line = sr.ReadLine();
                    while (true)
                    {
                        line = sr.ReadLine();
                        if (line == null)
                        {
                            return("II");
                        }
                        if (line.StartsWith(rainID))
                        {
                            string[] values = line.Split(default(Char[]),
                                                         StringSplitOptions.RemoveEmptyEntries);
                            if (values.Length >= 2)
                            {
                                return(values[1]);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "File Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return("II");
            }
        }
        // Finds adjustments to monthly evap. rates for a choice of evap. station
        // and climate projection year.
        private static void UpdateEvapAdjustments()
        {
            // Get evap values for each scenario
            string evapID = GeoData.GetEvapStationID(SiteData.evapSourceIndex);

            double[] y = new double[12];
            string   evapTable;

            evap1.Clear();
            if (SiteData.climateYear == 2035)
            {
                evapTable = StormwaterCalculator.Properties.Resources.Pmet2035Hot;
            }
            else
            {
                evapTable = StormwaterCalculator.Properties.Resources.Pmet2060Hot;
            }
            if (GetEvapAdjustments(evapTable, evapID, ref y))
            {
                evap1.Add(null, y);
            }

            evap2.Clear();
            if (SiteData.climateYear == 2035)
            {
                evapTable = StormwaterCalculator.Properties.Resources.Pmet2035Med;
            }
            else
            {
                evapTable = StormwaterCalculator.Properties.Resources.Pmet2060Med;
            }
            if (GetEvapAdjustments(evapTable, evapID, ref y))
            {
                evap2.Add(null, y);
            }

            evap3.Clear();
            if (SiteData.climateYear == 2035)
            {
                evapTable = StormwaterCalculator.Properties.Resources.Pmet2035Wet;
            }
            else
            {
                evapTable = StormwaterCalculator.Properties.Resources.Pmet2060Wet;
            }
            if (GetEvapAdjustments(evapTable, evapID, ref y))
            {
                evap3.Add(null, y);
            }

            evap0.Clear();
            string evapData = GeoData.GetEvapData(SiteData.evapSourceIndex, false);

            string[] values = evapData.Split(default(Char[]), StringSplitOptions.RemoveEmptyEntries);
            if (values.Length >= 12)
            {
                for (int i = 0; i < 12; i++)
                {
                    y[i] = Double.Parse(values[i]);
                }
                evap0.Add(null, y);
            }
        }