QuestionQuestion

Transcribed TextTranscribed Text

Weather/Train Prognostication Diviner There are many online services such as weather prediction, that can be combined with other forms of data (mashups) to provide valuable services. This assignment will combine weather forecasting information with hourly predictions with Melbourne train timetabling information and will be split into several stages. You are to implement the following stages of the program. Stage 1 - 8% Allow the user to specify a train station name and approximate arrival date/time via the command line, and have the program extract a weather report specifying temperature, rain probability and quantity, wind speed and direction. You can specify more data than that if you want to. Example usages would be... The general format is... python stage1.py station {date} time date => {n day{s} from} day_specifier (where n is a positive integer) day_specifier => days_of_the_week | tomorrow | now | today | next week days_of_the_week => Monday | Tuesday ...| Sunday | Mon | Tue | ... | Sun time => hours:minutes{am|pm} today and now are synonyms. The values can be in upper or lower case. The only input you can expect to be in quotation marks (i.e. presented as a single command line argument) is the station name. All other values will be individual command line arguments. See the section “Data Sources” below for more information. Stage 2 - 4% Using the webserver, routes.py file provided, create a locally hosted server on your computer that will create a web page with a list of Melbourne train stations, date/time options comparable to those in Stage 1, and provide a weather forecast as per Stage 1. The web requests can be done via a web submit (using GET and POST). The backend must be based on the program from Stage 1. Stage 3 - 2% Overlay an image of Melbourne with the locations and names of the suburban stations (using the Python Pillow library http://python-pillow.org), with a visible box drawn around the selected station. This should be served up as part of the web page. Stage 4 - 2% Allow the user to specify a start location and time and a destination location, and calculate the earliest arrival time at the destination based on a given start date/time (as per Stage 2). You must have completed Stage 3 before attempting this. Note that this stage may be quite difficult to do. Data sources 1. You should utilise the forecasting system from https://developer.forecast.io. This requires setting up a free account, and will provide you with a personalised key that you can use to access the data from their site. You should keep this key in a file named “forecastKey” (no suffix) to allow easy testing by staff. Note that you will need to follow the requirement to show a “Powered by Forecast” link on your website to meet the terms of the license. You will also need to ensure you don’t call the API more than 1000 times in one day if you wish to use the service for free. 2. PTV (Public Transport Victoria) have released their full timetable data in General Transport Feed Specification (GTFS) format. At the moment this is a collection of static files that specify information about trains, trams and buses (we’ll only deal with trains in this assignment). This information is available from the Victorian government’s data site The static data can be downloaded and incorporated into your program, which should read the appropriate sections of data each time the program starts up, rather than you encoding the data directly in the source code. Once again note that you will need to follow the licensing terms for the data.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#!/usr/bin/python
import stage1
import stage2
import stage3
from PIL import Image
import time as t

# this is suitable for a GET - it has no parameters
def initialPage():
       stations = stage2.getStations()
       days = stage2.getDays()
       data = "<html><head><title>Demonstration of a webserver</title></head><body>\n"
       data += '<form action="http://127.0.0.1:34567/" method="POST">\n'
       data += '<h1>Generate Weather Report for:</h1><br>'
       data += '<label for="station">Station:</label>\n'
       data += '<select name="station">\n'
       for station in stations:
                data += '<option value="'+station+'">'+station+'</option>\n'
       data += '</select>\n'
       data += '<label for="delta"> in </label>\n'
       data += '<input type="text" name="delta" value="" size="2" />\n'...
$75.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats