예제 #1
0
        private void loadModelStructure()
        {
            _structure = new ScenarioResultStructure(this);

            _units.Clear();
            _unitIds.Clear();

            //subbasin first and then HRUs to add hru to subbasin
            _subbasins  = readUnitBasicInfo(SWATUnitType.SUB);
            _hrus       = readUnitBasicInfo(SWATUnitType.HRU);
            _reaches    = readUnitBasicInfo(SWATUnitType.RCH);
            _reservoirs = readUnitBasicInfo(SWATUnitType.RES);
            _watershed  = new Watershed(this);

            //check HRU area percentage in subbasin and watershed
            double watershedPercent = 0.0;

            foreach (HRU hru in _hrus.Values)
            {
                watershedPercent += hru.AreaFractionWatershed;
            }
            if (Math.Abs(watershedPercent - 1.0) > 0.01)
            {
                string msg = "The area of HRUs is not correct in result " + ModelType.ToString() +
                             ". They are not added to 1. The total is " + watershedPercent.ToString("F4") + ".Please check .hru files.";
                System.Diagnostics.Debug.WriteLine(msg);
                //SWAT_SQLite.showInformationWindow(msg);
            }


            foreach (Subbasin sub in _subbasins.Values)
            {
                double subbasinPercent = 0.0;
                foreach (HRU hru in sub.HRUs.Values)
                {
                    subbasinPercent += hru.AreaFractionSub;
                }
                if (Math.Abs(subbasinPercent - 1.0) > 0.01)
                {
                    string msg = "The area of HRUs is not correct for subbasin " + sub.ID.ToString() +
                                 " in result " + ModelType.ToString() + ". The total is " + subbasinPercent.ToString("F4") + ". Please check .hru files.";
                    System.Diagnostics.Debug.WriteLine(msg);
                    //SWAT_SQLite.showInformationWindow(msg); seems for swat2009 models there are too many warnings, just comment it. Or could just give one combined message. This is intent to give user some warning mesage.
                }
            }
        }
예제 #2
0
        private void loadModelStructure()
        {
            _structure = new ScenarioResultStructure(this);

            _units.Clear();
            _unitIds.Clear();

            //subbasin first and then HRUs to add hru to subbasin
            _subbasins = readUnitBasicInfo(SWATUnitType.SUB);
            _hrus = readUnitBasicInfo(SWATUnitType.HRU);
            _reaches = readUnitBasicInfo(SWATUnitType.RCH);
            _reservoirs = readUnitBasicInfo(SWATUnitType.RES);
            _watershed = new Watershed(this);

            //check HRU area percentage in subbasin and watershed
            double watershedPercent = 0.0;
            foreach (HRU hru in _hrus.Values)
                watershedPercent += hru.AreaFractionWatershed;
            if (Math.Abs(watershedPercent - 1.0) > 0.01)
            {
                string msg = "The area of HRUs is not correct in result " + ModelType.ToString() +
                    ". They are not added to 1. The total is " + watershedPercent.ToString("F4") + ".Please check .hru files.";
                System.Diagnostics.Debug.WriteLine(msg);
                //SWAT_SQLite.showInformationWindow(msg);
            }

            foreach (Subbasin sub in _subbasins.Values)
            {
                double subbasinPercent = 0.0;
                foreach (HRU hru in sub.HRUs.Values)
                    subbasinPercent += hru.AreaFractionSub;
                if (Math.Abs(subbasinPercent - 1.0) > 0.01)
                {
                    string msg = "The area of HRUs is not correct for subbasin " + sub.ID.ToString() +
                        " in result " + ModelType.ToString() + ". The total is " + subbasinPercent.ToString("F4") + ". Please check .hru files.";
                    System.Diagnostics.Debug.WriteLine(msg);
                    //SWAT_SQLite.showInformationWindow(msg); seems for swat2009 models there are too many warnings, just comment it. Or could just give one combined message. This is intent to give user some warning mesage.
                }
            }
        }