示例#1
0
文件: Program.cs 项目: BjartN/wsklima
        static void GetVariousDataFromApi()
        {
            var st    = new[] { 50300, 50310 };
            var ds    = new MetDataService();
            var types = ds.getTimeserieTypesProperties("", "");

            var timeseriesTypeObs   = "T_ELEM_OBS";
            var timeseriesTypeObsId = "2";

            var stations = ds
                           .getStationsFromTimeserieType("2", "")
                           .Where(s => st.Any(x => x == s.stnr))
                           .OrderBy(x => x.name)
                           .ToArray();

            foreach (var s in stations)
            {
                Console.WriteLine($"{s.name} {s.fromYear}-{s.toYear} {s.stnr}");
            }

            Console.WriteLine();

            var parameters = ds
                             .getElementsFromTimeserieType(timeseriesTypeObsId)
                             .Where(x => x.description.ToLower().Contains("snø")) //snow
                             .ToArray();

            foreach (var p in parameters)
            {
                Console.WriteLine($"{p.name} {p.elemNo}");
            }

            Console.ReadLine();
        }
示例#2
0
        public object GetElements(string timeseriesType = defaultTimeseriesType)
        {
            var ds = new MetDataService();

            return(ds.getElementsFromTimeserieType(defaultTimeseriesType).Select(x => new
            {
                x.elemCode,
                x.elemGroup,
                x.elemNo,
                x.unit,
                x.description
            }));
        }