Jun-19-2020, 03:03 PM
On the site Yr (www.yr.no) you can download the weather forecast in XML format. For example, we can download the hourly forecast using the address in the form:
https:// www. yr. no/ place/ Country/ Region/ Place/ forecast_hour_by_hour.xml.
For example, for the city of Boston, in United States, Massachusetts, it will be:
https://www.yr.no/place/United_States/Ma...y_hour.xml
I would like to write a python script that, based on an XML file, for example:
https://www.yr.no/place/United_States/Ma...y_hour.xml,
displays the following data:
- place name,
- longitude, latitude and altitude,
- Forecasts for cloudiness / precipitation (for example "Partly cloudy" or "Light rain") and temperature for each hour.
I would like the program in the console to ask the user about the path to the xml file, and then the program should display the forecast in the form I wrote earlier.
I don't care if the console in Spyder will display information from the downloaded .xml file to the disk, for example: C:\Users\John_pl\Downloads\forecast_hour_by_hour_Boston.xml,
or directly from the website: https://www.yr.no/place/United_States/Ma...y_hour.xml
At the moment I went to the Yr website and downloaded the xml file using the ctrl + s keyboard shortcut. This file can be downloaded here: https://www97.zippyshare.com/v/2ltYcl3R/file.html
When you download this file and write a python script in Spyder specifically for this file, the console (output) in Spyder is to look exactly like this:
I need a script in which, after providing a link to the xml file from the Yr page, or entering the path to the xml file on the disk, the program will display information in the console in the form as in the "Output" window above.
If you helped me write a script in Spyder, I would save a lot of time in my work. I would write this month myself, maybe it will be a matter of minutes for you. Please help!
https:// www. yr. no/ place/ Country/ Region/ Place/ forecast_hour_by_hour.xml.
For example, for the city of Boston, in United States, Massachusetts, it will be:
https://www.yr.no/place/United_States/Ma...y_hour.xml
I would like to write a python script that, based on an XML file, for example:
https://www.yr.no/place/United_States/Ma...y_hour.xml,
displays the following data:
- place name,
- longitude, latitude and altitude,
- Forecasts for cloudiness / precipitation (for example "Partly cloudy" or "Light rain") and temperature for each hour.
I would like the program in the console to ask the user about the path to the xml file, and then the program should display the forecast in the form I wrote earlier.
I don't care if the console in Spyder will display information from the downloaded .xml file to the disk, for example: C:\Users\John_pl\Downloads\forecast_hour_by_hour_Boston.xml,
or directly from the website: https://www.yr.no/place/United_States/Ma...y_hour.xml
At the moment I went to the Yr website and downloaded the xml file using the ctrl + s keyboard shortcut. This file can be downloaded here: https://www97.zippyshare.com/v/2ltYcl3R/file.html
When you download this file and write a python script in Spyder specifically for this file, the console (output) in Spyder is to look exactly like this:
Output:Location: Boston
Longitude: -71.05977
Latitude: 42.35843
Altitude: 14
From 2020-06-19 04:00:00 to: 2020-06-19 05:00:00
Cloudiness/precipitation: Cloudy, Temperature: 20
From 2020-06-19 05:00:00 to: 2020-06-19 06:00:00
Cloudiness/precipitation: Cloudy, Temperature: 20
From 2020-06-19 06:00:00 to: 2020-06-19 07:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 20
From 2020-06-19 07:00:00 to: 2020-06-19 08:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 21
From 2020-06-19 08:00:00 to: 2020-06-19 09:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 23
From 2020-06-19 09:00:00 to: 2020-06-19 10:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 25
From 2020-06-19 10:00:00 to: 2020-06-19 11:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 26
From 2020-06-19 11:00:00 to: 2020-06-19 12:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 28
From 2020-06-19 12:00:00 to: 2020-06-19 13:00:00
Cloudiness/precipitation: Clear sky, Temperature: 29
From 2020-06-19 13:00:00 to: 2020-06-19 14:00:00
Cloudiness/precipitation: Clear sky, Temperature: 30
From 2020-06-19 14:00:00 to: 2020-06-19 15:00:00
Cloudiness/precipitation: Clear sky, Temperature: 31
From 2020-06-19 15:00:00 to: 2020-06-19 16:00:00
Cloudiness/precipitation: Clear sky, Temperature: 31
From 2020-06-19 16:00:00 to: 2020-06-19 17:00:00
Cloudiness/precipitation: Clear sky, Temperature: 31
From 2020-06-19 17:00:00 to: 2020-06-19 18:00:00
Cloudiness/precipitation: Clear sky, Temperature: 31
From 2020-06-19 18:00:00 to: 2020-06-19 19:00:00
Cloudiness/precipitation: Clear sky, Temperature: 30
From 2020-06-19 19:00:00 to: 2020-06-19 20:00:00
Cloudiness/precipitation: Clear sky, Temperature: 27
From 2020-06-19 20:00:00 to: 2020-06-19 21:00:00
Cloudiness/precipitation: Clear sky, Temperature: 25
From 2020-06-19 21:00:00 to: 2020-06-19 22:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 24
From 2020-06-19 22:00:00 to: 2020-06-19 23:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 23
From 2020-06-19 23:00:00 to: 2020-06-20 00:00:00
Cloudiness/precipitation: Fair, Temperature: 22
From 2020-06-20 00:00:00 to: 2020-06-20 01:00:00
Cloudiness/precipitation: Fair, Temperature: 21
From 2020-06-20 01:00:00 to: 2020-06-20 02:00:00
Cloudiness/precipitation: Fair, Temperature: 21
From 2020-06-20 02:00:00 to: 2020-06-20 03:00:00
Cloudiness/precipitation: Fair, Temperature: 21
From 2020-06-20 03:00:00 to: 2020-06-20 04:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 20
From 2020-06-20 04:00:00 to: 2020-06-20 05:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 20
From 2020-06-20 05:00:00 to: 2020-06-20 06:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 20
From 2020-06-20 06:00:00 to: 2020-06-20 07:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 20
From 2020-06-20 07:00:00 to: 2020-06-20 08:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 22
From 2020-06-20 08:00:00 to: 2020-06-20 09:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 24
From 2020-06-20 09:00:00 to: 2020-06-20 10:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 26
From 2020-06-20 10:00:00 to: 2020-06-20 11:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 29
From 2020-06-20 11:00:00 to: 2020-06-20 12:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 30
From 2020-06-20 12:00:00 to: 2020-06-20 13:00:00
Cloudiness/precipitation: Fair, Temperature: 32
From 2020-06-20 13:00:00 to: 2020-06-20 14:00:00
Cloudiness/precipitation: Clear sky, Temperature: 33
From 2020-06-20 14:00:00 to: 2020-06-20 15:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 33
From 2020-06-20 15:00:00 to: 2020-06-20 16:00:00
Cloudiness/precipitation: Fair, Temperature: 32
From 2020-06-20 16:00:00 to: 2020-06-20 17:00:00
Cloudiness/precipitation: Fair, Temperature: 33
From 2020-06-20 17:00:00 to: 2020-06-20 18:00:00
Cloudiness/precipitation: Fair, Temperature: 32
From 2020-06-20 18:00:00 to: 2020-06-20 19:00:00
Cloudiness/precipitation: Fair, Temperature: 31
From 2020-06-20 19:00:00 to: 2020-06-20 20:00:00
Cloudiness/precipitation: Clear sky, Temperature: 30
From 2020-06-20 20:00:00 to: 2020-06-20 21:00:00
Cloudiness/precipitation: Fair, Temperature: 28
From 2020-06-20 21:00:00 to: 2020-06-20 22:00:00
Cloudiness/precipitation: Clear sky, Temperature: 26
From 2020-06-20 22:00:00 to: 2020-06-20 23:00:00
Cloudiness/precipitation: Clear sky, Temperature: 25
From 2020-06-20 23:00:00 to: 2020-06-21 00:00:00
Cloudiness/precipitation: Fair, Temperature: 24
From 2020-06-21 00:00:00 to: 2020-06-21 01:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 23
From 2020-06-21 01:00:00 to: 2020-06-21 02:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 22
From 2020-06-21 02:00:00 to: 2020-06-21 03:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 21
From 2020-06-21 03:00:00 to: 2020-06-21 04:00:00
Cloudiness/precipitation: Partly cloudy, Temperature: 21
I am a meteorologist (not a programmer). In my daily work, I open a raw xml file and manually convert the data from the XML file to the appearance as in the "Output" window above. So I'm just copying the information I need - Location, Longitude, Latitude, Altitude, Hourly Forecast (From, to, Cloudiness/precipitation, Temperature). I need a script in which, after providing a link to the xml file from the Yr page, or entering the path to the xml file on the disk, the program will display information in the console in the form as in the "Output" window above.
If you helped me write a script in Spyder, I would save a lot of time in my work. I would write this month myself, maybe it will be a matter of minutes for you. Please help!