Esempio n. 1
0
        /// <summary>
        /// Checks the data endpoints for the Sub-Surface Flow component.
        /// </summary>
        /// <returns></returns>
        public static async Task <Dictionary <string, Dictionary <string, string> > > CheckSubsurfaceEndpoints()
        {
            Dictionary <string, Dictionary <string, string> > endpoints = new Dictionary <string, Dictionary <string, string> >();
            List <SubSurfaceFlow.SubSurfaceFlow> subsurfaces            = new List <SubSurfaceFlow.SubSurfaceFlow>();
            List <string> sources = new List <string>()
            {
                "nldas", "gldas"
            };
            ITimeSeriesInput testInput = new TimeSeriesInput()
            {
                Source       = "nldas",
                DateTimeSpan = new DateTimeSpan()
                {
                    StartDate = new DateTime(2005, 01, 01),
                    EndDate   = new DateTime(2005, 01, 05)
                },
                Geometry = new TimeSeriesGeometry()
                {
                    Point = new PointCoordinate()
                    {
                        Latitude  = 33.925673,
                        Longitude = -83.355723
                    },
                    GeometryMetadata = new Dictionary <string, string>()
                }
            };
            ITimeSeriesInputFactory iFactory = new TimeSeriesInputFactory();

            foreach (string source in sources)
            {
                SubSurfaceFlow.SubSurfaceFlow subsurface = new SubSurfaceFlow.SubSurfaceFlow();
                testInput.Source = source;
                subsurface.Input = iFactory.SetTimeSeriesInput(testInput, new List <string>()
                {
                    "subsurfaceflow"
                }, out string errorMsg);
                subsurfaces.Add(subsurface);
            }

            Parallel.ForEach(subsurfaces, (SubSurfaceFlow.SubSurfaceFlow subsurface) =>
            {
                endpoints.Add(subsurface.Input.Source, subsurface.CheckEndpointStatus());
            });
            return(endpoints);
        }