示例#1
0
        private void KrigGage(KrigIndexSite gage)
        {
            Double[,] invertedCovarianceMatrix = null;
            Double[,] ungagedCovarianceMatrix  = null;
            //kriging multiplies the transposed covariance matrix by the matrix of covariances between the ungaged catchment and the gages
            //to obtain a set of weights. The weights are multiplied by each of the respective r values to obtain the unbiased minimum variance
            //estimate of the correlation between the given study streamgage and the ungaged catchament.
            //Archfield S.A. and Vogel R.M 2010 Map correlation method: Selection of a reference streamgage
            //		to estimate daily streamflow at ungaged catchments, Water Resources Research Vol. 46
            //Isaaks, E. H., and R. M. Srivastava (1989), An Introduction to Applied
            //		Geostatistics, 1st ed., Oxford Univ. Press, New York. pg287-296
            try
            {
                //remove SitesNotIncluded

                invertedCovarianceMatrix = MathOps.InvertMatrixGJ(BuildCovarianceMatrix(ResizeDistanceMatrix(gage.Correlations.Keys), gage.rangeParameterA, gage.partialSillSigma));
                ungagedCovarianceMatrix  = BuildCovarianceMatrix(ResizeSiteMatrix(gage.Correlations.Keys), gage.rangeParameterA, gage.partialSillSigma);

                Double val = GetKrigedGageCorrelations(invertedCovarianceMatrix, ungagedCovarianceMatrix, gage.Correlations.Select(v => v.Value).ToList());

                AddCorrelationGage(new GageCorrelationStruc(val, gage));
            }
            catch (Exception e)
            {
                throw;
            }
        }//end KrigGage
示例#2
0
        }//end GetCorrelatedGages

        private Boolean LoadIndexProperties(IEnumerable <List <String> > file, IEnumerable <List <String> > correlationFile)
        {
            KrigIndexSite gage = null;

            try
            {
                IndexGages = new List <KrigIndexSite>();

                foreach (var item in file.Skip(1).ToList())
                {
                    gage = new KrigIndexSite(item[0], item[1], Convert.ToDouble(item[7]),
                                             Convert.ToDouble(item[6]), this.SR, Convert.ToDouble(item[8]),
                                             Convert.ToDouble(item[2]), Convert.ToDouble(item[3]),
                                             GetCorrelatedGages(item[0], correlationFile));

                    IndexGages.Add(gage);
                }//next line

                return(true);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            } //end try
        }     //end LoadIndexProperties
示例#3
0
        }//end AddCorrelationGage
        private Boolean CorrelatedGagesExists(string siteID)
        {
            KrigIndexSite gage = TopCorrelatedGages.FirstOrDefault(g => g.Value.ID == siteID).Value;

            if (gage == null) return false;

                return true;          
        }//end CorrelatedGagesExists
示例#4
0
 public GageCorrelationStruc(double c, KrigIndexSite g)
 {
     gage        = g;
     Correlation = c;
 }