Git Product home page Git Product logo

dress-for-the-weather's Introduction

Dress for the weather

This resource has been archived and is no longer maintained

In this resource you're going to write a program that will allow a user to type in a city they're travelling to and the date they'll be arriving. The program will then use open data to find out what the weather is like in that city at that time, and advise the user on what they should wear when they arrive.

Licence

Unless otherwise specified, everything in this repository is covered by the following licence:

Creative Commons License

Dress for the weather by the Raspberry Pi Foundation is licensed under a Creative Commons Attribution 4.0 International Licence.

Based on a work at https://github.com/raspberrypilearning/dress-for-the-weather.

dress-for-the-weather's People

Contributors

aldreth avatar bennuttall avatar gregorywood avatar jameshay1 avatar lauraclay avatar lornalynch avatar louiserrr avatar marcscott avatar samalderhyde avatar shblythe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dress-for-the-weather's Issues

Maker day feedback #2

Step 6: The first command needs to read "cities = open('city.list.json', encoding="utf-8").read()"

Broken meta.yml

/learning couldn't parse the meta.yml file in en on draft branch.

closed string before end of string

Hi Mark, Tried this last night and line 4 produces an error as the ' is picked up between you and re and program treats this as the end of the string.

def get_city_id():
with open('city.list.json') as f:
data = [loads(line) for line in f]
city = input('Which is the closest city to the place you're travelling to?' )
city_id = False

get_readable_forecast

When selecting an hour that results in a single digit hour I get the message:
File "weather.py", line 48, in get_readable_forecast
weather['cloudiness'] = forecast['clouds']['all']
TypeError: 'NoneType' object is not subscriptable

I can fix this by padding - str(hour).rjust(2,'0')

I presume this will need to be done for the day also.

i have the same issue as above.

  1. pprint(forecast) is returning none
  2. File "weather.py", line 48, in get_readable_forecast
    weather['cloudiness'] = forecast['clouds']['all']
    TypeError: 'NoneType' object is not subscriptable

please help

Originally posted by @hchowd in #7 (comment)

Data format

Hey, I'm having difficulty with this tutorial and I suspect that the possible reason is that the format of the 'city.list.json' may have changed. Iv'e opened the 'city.list.json' file on my PC and it seems that it is formatted in some sort of an array, but i'm not experienced enough to do any re-formatting or conversion with it.
After running the weather.py file and entering the following into the shell:-

cities = open('city.list.json').readlines()
cities[0]

I get the following result:-

'[\n'

And if i enter:-

cities[1]

I get the following result:-

' {\n'

And if i enter:-

cities[2]

I get the following result:-

' "id": 707860, \n"

After doing all that and then entering:-

city = loads(cities[56325])

Well it just totally spits out the dummy then!
PLS see the attached image for a screenshot.
Thanks,
George
ashampoo_snap_2018 09 11_16h00m14s_001_georgepi3bench -georgepi3bench- - vnc viewer

Getting a 5-day forecast with Python

When I ran the following code:

def get_weather_data(city_id):
    weather_data = get('http://api.openweathermap.org/data/2.5/forecast?id={}&APPID={}'.format(city_id, KEY))
    return weather_data.json()

I received a TypeError: 'dict' object not callable. I removed the parens after json and it worked. Looks like one accesses the data returned by the get function through properties not functions?

Change in OpenWeatherMaps ? (Sept 2020)

Feedback form a user to say they struggled with one of the commands and wondered if the project is out of date.

Hi there, I'm not certain that the command:
forecast = owm.daily_forecast(location + ',' + COUNTRY)
...still works with OpenWeatherMaps, I've only had success when using the following:
url = "https://api.openweathermap.org/data/2.5/onecall?lat=%s&lon=%s&appid=%s&units=metric" % (lat, lon, api_key)

It would be useful to see any dates when the article was written, so for instance, if it's a recent article then I'm probably wrong, but if the article was from 2017/18/19 then perhaps the tutorial needs to be reviewed.

Maker day feedback

Step 7: The text says 'the ID 5091002 is different to the ID 2640354 you found earlier!' - but I don't think we did find anything about Peterborough or this ID earlier - would it be better for step 6 to refer to Peterborough rather than Hurzuf in Ukraine?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.