public void get_all_temperatures_for_a_position_a_given_day()
        {
            var service = new SmhiService();
            var result  = service.GetMeteorologicalForecast(11.9751M, 57.7087M).Result;

            List <TimeTemp> timeTemps = service.FilterTemperature(result, DateTime.Now);
        }
        public void ExtractInfoFromForecast()
        {
            var service = new SmhiService();

            decimal longitud = 11.9751m;
            decimal latitud  = 57.7087m;

            Rootobject result = service.GetMeteorologicalForecast(longitud, latitud).Result;
            //Parameter param = rootObject.timeSeries[0].parameters.Single(p => p.name == "t");
            //decimal temp = param.values[0];
            DateTime time = result.timeSeries[0].validTime;
            decimal  temp = result.timeSeries[0].parameters[11].values[0];
        }
Example #3
0
        public async Task <Rootobject> GetMeteorologicalForecast(decimal longitude, decimal latitude)
        {
            string sLongitude = Math.Round(longitude, 3).ToString(new CultureInfo("en"));
            string sLatitude  = Math.Round(latitude, 3).ToString(new CultureInfo("en"));

            string page = $"https://opendata-download-metfcst.smhi.se/api/category/pmp3g/version/2/geotype/point/lon/{sLongitude}/lat/{sLatitude}/data.json";

            var smhi = new SmhiService();

            var result = await smhi.Get(page);

            return(JsonConvert.DeserializeObject <Rootobject>(result));
        }
 public void GetForecastAsStringSmhiServiceAsync()
 {
     var    smhi     = new SmhiService();
     string forecast = smhi.Get("https://opendata-download-metfcst.smhi.se/api/category/pmp3g/version/2/geotype/point/lon/18.07/lat/59.33/data.json").Result;
 }