Beispiel #1
0
        public void get_all_temperature_for_a_position_a_given_day()
        {
            var service = new SmhiService();
            var result  = service.GetMeterologicalForecast(13.846M, 58.390M).Result;

            List <TimeTemp> timetemps = service.FilterTemperature(result, DateTime.Now);
        }
Beispiel #2
0
        public void get_temperature_for_first_timeserie_better()
        {
            var service = new SmhiService();
            var result  = service.GetMeterologicalForecast(13.846M, 58.390M).Result;

            DateTime  time        = result.timeSeries[0].validTime;
            Parameter param       = result.timeSeries[0].parameters.Single(p => p.name == "t");
            decimal   temperature = param.values[0];
        }
        public void get_temperature_for_first_timeserie()
        {
            var        service = new SmhiService();
            Rootobject result  = service.GetMetereologicalForecast(13.846M, 58.390M).Result; // Skövde

            Timesery firstTimeSeries = result.timeSeries[0];

            DateTime time      = result.timeSeries[0].validTime;                // klockslag
            decimal  value     = result.timeSeries[0].parameters[11].values[0]; //värde(temperatur) (om temperaturen fortfarande är på position 11)
            string   paramname = result.timeSeries[0].parameters[11].name;      // namn ("t")
        }
Beispiel #4
0
        public void Get_SMHI_In_Classes()
        {
            decimal longitude = 16.158m;
            decimal latitude  = 58.5812m;

            SmhiService service = new SmhiService();
            Rootobject  x       = service.GetMeterologicalForecast(longitude, latitude).Result;

            Timesery firstTimeSeries = x.timeSeries[0];

            DateTime time      = x.timeSeries[0].validTime;                // klockslag
            decimal  value     = x.timeSeries[0].parameters[11].values[0]; //värde(temperatur) (om temperaturen fortfarande är på position 11)
            string   paramname = x.timeSeries[0].parameters[11].name;      // namn ("t")
        }
Beispiel #5
0
 public void Get_SMHI_String()
 {
     SmhiService service    = new SmhiService();
     string      smhiString = "https://opendata-download-metfcst.smhi.se/api/category/pmp3g/version/2/geotype/point/lon/16.158/lat/58.5812/data.json";
     var         x          = service.Get(smhiString).Result;
 }
        public void get_forecast_as_object_longlat()
        {
            var service = new SmhiService();

            Rootobject forecast = service.GetMetereologicalForecast(57.84528M, 12.96771M).Result;
        }
 public void get_forecast_as_string()
 {
     var    service  = new SmhiService();
     string forecast = service.Get("https://opendata-download-metfcst.smhi.se/api/category/pmp3g/version/2/geotype/point/lon/16.158/lat/58.5812/data.json").Result;
 }