getweather package

Submodules

getweather.getweather module

getweather.getweather.CityCoord(name)[source]

Introduction: This functin allows users to input the city name and then return the longitude and latitude of that city.

Parameters: name: a city name

Output: a tuple (lon, lat) that contains longitude and latitude of a city.

Example: >>>CityCorrd(‘Taglag’) (44.98333, 38.450001)

getweather.getweather.CityId(name)[source]

Introduction: This function allows users to input the city name and then return the city id of that city.

Parameters: name: a city name

Output: a city id

Example: >>>CityId(‘Taglag’) 3245

getweather.getweather.CityIds(*args)[source]

Introduction: This function allows users to input any number of city names that they want and then return the city ids of these city.

Parameters: *args: any number of city names

Output: a string that contains the city ids of all the cities that you input

Example: >>>CityIds(‘London’,’Shanghai’,’New York’) ‘2643743,1796236,5128638’

getweather.getweather.CityInfo()[source]

Introduction: CityInfo()function aims to return a dataset that shows the information such as city id, city, state, country, latitude, longitude of all the cities in the world.

Parameters: No parameter.

Output: a dataset of city id, city, state, country, latitude, longitude covering all the cities in the world

getweather.getweather.getcities(api_key, *city_name)[source]

Introduction: This is a functio aims to return current weather data for any number of cities you want.

Parameters: api_key: your api key of the Openweather website. You can access your api key by creating an account on this website: https://home.openweathermap.org/api_keys *city_name: any number of city names

Output: The first part is a bar chart showing the current temperatures of all the cities you chose. The second part is a dataset showing the detailed current weather information of all the cities you chose.

getweather.getweather.getcitycircle(api_key, city_name, cnt=10)[source]

Introduction: This function aims to return weather data from cities laid within definite circle that is specified by center point(city that you input) and expected number of cities around this point.

Parameters: api_key: your api key of the Openweather website. You can access your api key by creating an account on this website: https://home.openweathermap.org/api_keys city_name: one city name cnt: the number of cities around the center point. The default value is 10.

Outputs: The output is a dataframe showing the detailed current weather information of all the cities laid withini a definite circle.

getweather.getweather.getonecity(api_key, city_name, status='current')[source]

Introduction: This function can return either current weather and air pollution information or the daily forecast data for 7 days.

Parameters: api_key: your api key of the Openweather website. You can access your api key by creating an account on this website: https://home.openweathermap.org/api_keys city_name: one city name status:status could be either ‘current’ or ‘forecast’. If status is set to ‘current’, this function will return the current weather data; otherwise, it will return the forecast weather data.

Output: If you set status to ‘current’, the output is dataset showing the detailed current weather information of the city you chose. If you set status to ‘forecast’, the output consists of two parts.

The first part is a graph showing the maximum, minimum, and day temperature trends and probability of precipitation in 7 days. The second part is a dataset showing the detailed forecast weather information of the city you chose.

Module contents