Teacher's Choice

Weather App Project (Teacher's Choice)

There are several different mini-projects on this page. You can build them all, or your teacher may only ask you to work on one or two.

For each activity, you will scrape a weather website for data to build an algorithm for a weather app.
34 degrees in New York UMBRELLA? block returning true SUNSET TIME block with output

Building Current Temperature and Current Weather Reporters

Many websites provide current weather and forecast data. Some, such as Weather Underground, give location-specific information through the use of URL tags. Weather Underground can accept locations and ZIP codes.

    Note that there is no space between city and state: Boston,MA. For cities with multiple words, add a plus: New+York,NY. These requirements are particular to this website, not general to the entire Web.
  1. First read and then click these URLs:
  2. Follow the same pattern to create a URL that links to the weather for a different city.
  3. Note that the degrees symbol (°) is written with an HTML character code: °.
  4. Use your browser to view the source (HTML) for the resulting page. Where in the HTML is the current temperature shown? How could you most easily locate this specific line?
  5. Remember not to include the "http://" in the http block input slot. Don't include the 'http://' in the http block input slot.
    Starting from the U4L3-HttpBlock project, design a Current Temperature In block block that accepts a ZIP code or a city and state as input and reports the current temperature in degrees Fahrenheit:
    34 degrees in New York
    "U4L3-WeatherApp"save your work as U4L3-WeatherApp
  6. Build a similar block to give the current weather conditions for the location you specified.

Building A Multi-City Weather Report App

You can query wunderground.com for current temperature and weather conditions in a list of cities like this...

As part of this work you can choose to create "cleaner" entry of city names. To do this, you'll need to convert names like New York, NY to New+York,NY. Snap! blocks that convert words to lists, and lists to words, can make this possible.
It's ok if yours doesn't look like this.
List of cities

...to produce a report like this:
Weather report for cities

  1. Use the methods you used in the shopping list app to build an Add Location command that lets the user populate the list of locations.
  2. Then use your current temperature and current weather reporters to build a weather report table (a list of lists) for multiple cities.
      Talk with Your Partner
    1. First plan the design; if there were only one city in the list, how would you produce this list as the report?
      weather-report watcher: {New York, NY, 60, Fair}
    2. Use list operations to produce the weather report table for all cities entered.
    3. Then test it by adding more cities and requesting the report again.
  1. You could a weather reporter sprite:
    Spoken weather report
  1. Modify the weather report so that it will also include the forecasted temperature and conditions for tomorrow.

Building an Umbrella? Predicate

You can build an algorithm to tells you if you'll need an umbrella today.

  1. Build an umbrella? predicate that takes a location as input. You'll need to figure out what information should make the block report .
  2. To make UMBRELLA? block know the user's location automatically, use an IP address reporter.
  1. Change the UMBRELLA? block to a reporter that can return a wider variety of information, including outputs such as tonight, tomorrow, it's complicated, and wear boots instead.
  2. SUNSET TIME block with output
  3. Build a SUNSET TIME block reporter that returns the sunset time at a given location; if no location is provided, use the current location.