Пример #1
0
        public DataSet ServerProcess(DataSet ds)
        {
            if (ds == null)
            {
                throw new ArgumentNullException("ds");
            }

            string hash = DataSetDiskCache.ComputeHash(ds);

            var cachedDs = this.dataSetCache.Get(hash);

            if (cachedDs != null)
            {
                return(cachedDs);
            }

            else
            {
                var result = this.ServerProcessInternal(ds);

                if (FetchClimateRequestBuilder.IsProcessingSuccessful(result))
                {
                    this.dataSetCache.Add(result);
                }
                return(result);
            }
        }
Пример #2
0
 public FetchClimateSingleResponce FetchClimate(ClimateParameter parameter, double latmin, double latmax, double lonmin, double lonmax, int starthour, int stophour, int startday, int stopday, int startyear, int stopyear, FetchingOptions options)
 {
     AssertFcParameters(latmin, latmax, lonmin, lonmax, starthour, stophour, startday, stopday, startyear, stopyear);
     using (var requestDs = DataSet.Open("msds:memory"))
     {
         FetchClimateRequestBuilder.FillDataSetWithRequest(requestDs, parameter, latmin, latmax, lonmin, lonmax, starthour, stophour, startday, stopday, startyear, stopyear, options);
         using (var result = ServerProcess(requestDs))
         {
             return(FetchClimateRequestBuilder.BuildSingleCellResult(result));
         }
     }
 }
Пример #3
0
        public FetchClimateBatchResponce FetchClimate(ClimateParameter parameter, double[] latmin, double[] latmax, double[] lonmin, double[] lonmax, int[] starthour, int[] stophour, int[] startday, int[] stopday, int[] startyear, int[] stopyear, FetchingOptions options, ResearchVariationType variationType)
        {
            if (startday == null)
            {
                startday = Enumerable.Repeat(GlobalConsts.DefaultValue, latmin.Length).ToArray();
            }
            if (stopday == null)
            {
                stopday = Enumerable.Repeat(GlobalConsts.DefaultValue, latmin.Length).ToArray();
            }
            if (starthour == null)
            {
                starthour = Enumerable.Repeat(GlobalConsts.DefaultValue, latmin.Length).ToArray();
            }
            if (stophour == null)
            {
                stophour = Enumerable.Repeat(GlobalConsts.DefaultValue, latmin.Length).ToArray();
            }
            if (startyear == null)
            {
                startyear = Enumerable.Repeat(GlobalConsts.StartYear, latmin.Length).ToArray();
            }
            if (stopyear == null)
            {
                stopyear = Enumerable.Repeat(GlobalConsts.EndYear, latmin.Length).ToArray();
            }

            for (int i = 0; i < latmin.Length; i++)
            {
                AssertFcParameters(latmin[i], latmax[i], lonmin[i], lonmax[i], starthour[i], stophour[i], startday[i], stopday[i], startyear[i], stopyear[i]);
            }

            using (var requestDs = DataSet.Open("msds:memory"))
            {
                FetchClimateRequestBuilder.FillDataSetWithRequest(requestDs, parameter, latmin, latmax, lonmin, lonmax, starthour, stophour, startday, stopday, startyear, stopyear, options);
                requestDs.Metadata[Namings.metadataNameVariationType] = variationType.ToString();
                requestDs.Commit();
                using (var result = ServerProcess(requestDs))
                {
                    return(FetchClimateRequestBuilder.BuildBatchResult(result));
                }
            }
        }
Пример #4
0
        internal double[] FetchClimate(ClimateParameter parameter, double[] latmin, double[] latmax, double[] lonmin, double[] lonmax, int[] starthour, int[] stophour, int[] startday, int[] stopday, int[] startyear, int[] stopyear)
        {
            if (startday == null)
            {
                startday = Enumerable.Repeat(GlobalConsts.DefaultValue, latmin.Length).ToArray();
            }
            if (stopday == null)
            {
                stopday = Enumerable.Repeat(GlobalConsts.DefaultValue, latmin.Length).ToArray();
            }
            if (starthour == null)
            {
                starthour = Enumerable.Repeat(GlobalConsts.DefaultValue, latmin.Length).ToArray();
            }
            if (stophour == null)
            {
                stophour = Enumerable.Repeat(GlobalConsts.DefaultValue, latmin.Length).ToArray();
            }
            if (startyear == null)
            {
                startyear = Enumerable.Repeat(GlobalConsts.StartYear, latmin.Length).ToArray();
            }
            if (stopyear == null)
            {
                stopyear = Enumerable.Repeat(GlobalConsts.EndYear, latmin.Length).ToArray();
            }

            for (int i = 0; i < latmin.Length; i++)
            {
                AssertFcParameters(latmin[i], latmax[i], lonmin[i], lonmax[i], starthour[i], stophour[i], startday[i], stopday[i], startyear[i], stopyear[i]);
            }
            using (var requestDs = DataSet.Open("msds:memory"))
            {
                FetchClimateRequestBuilder.FillDataSetWithRequest(requestDs, parameter, latmin, latmax, lonmin, lonmax, starthour, stophour, startday, stopday, startyear, stopyear, new FetchingOptions());
                using (var result = ServerProcess(requestDs))
                {
                    return(FetchClimateRequestBuilder.BuildBatchResult(result).Values.Select(v => v.GetValueInDefaultClientUnits()).ToArray());
                }
            }
        }