Example #1
0
        /// <summary>
        /// BASEGRID
        /// Returns a localization hash table.
        /// For each observation point, calculate the gaussian distance to all other points in the model grid.
        /// </summary>
        /// <param name="exchangeItemId">The exchange ID string</param>
        /// <param name="observationCount">The number of observation points</param>
        /// <param name="locDistance">The localization distance (for Gaussian distance)</param>
        /// <param name="xpos">array of observation X coordinates</param>
        /// <param name="ypos">array of observation Y coordinates</param>
        /// <returns></returns>
        private double[][] GetLocalized2D(string exchangeItemId, int observationCount, double locDistance, double[] xpos, double[] ypos)
        {
            double[][] localized2D = new double[observationCount][];

            var mshe = base.WMEngine;
            // BASEGRID
            int n = mshe.Grid.ElementCount;

            IDictionary <int, ISpatialDefine> modelCoord = GetModelCoordinates(exchangeItemId);

            for (int obsC = 0; obsC < observationCount; obsC++)
            {
                localized2D[obsC] = new double[n];
                IXYLayerPoint obsPoint = new XYLayerPoint(xpos[obsC], ypos[obsC], 0);
                if (XYZGeometryTools.IsPointInModelPlain(obsPoint, modelCoord, false))
                {
                    for (int i = 0; i < modelCoord.Count; i++)
                    {
                        if (Convert.ToInt32(obsPoint.Layer) == modelCoord[i].Layer)
                        {
                            double distanceC = XYZGeometryTools.CalculatePointToPointDistance2D(modelCoord[i].MidPoint, obsPoint);
                            localized2D[obsC][i] = normalCooefs(distanceC, locDistance);
                        }
                    }
                }
            }
            return(localized2D);
        }
Example #2
0
        /// <summary>
        /// For 3D SZ (hydraulic head).
        /// Returns a localization hash table.
        /// For each observation point, calculate the gaussian distance to all other points in the model grid.
        /// </summary>
        /// <param name="exchangeItemId">The exchange ID string</param>
        /// <param name="observationCount">The number of observation points</param>
        /// <param name="locDistance">The localization distance (for Gaussian distance)</param>
        /// <param name="xpos">array of observation X coordinates</param>
        /// <param name="ypos">array of observation Y coordinates</param>
        /// <param name="layer">array of observation Z heights (layer in the model)</param>
        /// <returns></returns>
        private double[][] GetLocalized3DSZ(string exchangeItemId, int observationCount, double locDistance, double[] xpos, double[] ypos, int[] layer)
        {
            double[][] localized2D = new double[observationCount][];

            var mshe = base.WMEngine;

            IDictionary <int, ISpatialDefine> modelCoord = GetModelCoordinates(exchangeItemId);

            // SZGrid
            int n = modelCoord.Count;

            for (int obsC = 0; obsC < observationCount; obsC++)
            {
                // int countNormalizedCheck = 0;

                localized2D[obsC] = new double[n];
                IXYLayerPoint obsPoint = new XYLayerPoint(xpos[obsC], ypos[obsC], 0);
                if (XYZGeometryTools.IsPointInModelPlain(obsPoint, modelCoord, true))
                {
                    for (int i = 0; i < n; i++)
                    {
                        double distanceC = XYZGeometryTools.CalculatePointToPointDistance2D(modelCoord[i].MidPoint,
                                                                                            obsPoint);
                        double normalized = normalCooefs(distanceC, locDistance);

                        if (normalized > 0.001)
                        {
                            localized2D[obsC][i] = normalized;
                            //countNormalizedCheck = countNormalizedCheck + 1;
                        }
                    }
                }

                //Console.WriteLine("Number of normalized for observation:{0} is {1}", obsC,countNormalizedCheck);
            }
            return(localized2D);
        }