This project used Python scripting to visualize the weather of 500+ world cities at varying distances from the equator. Project focuses on using APIs to visualize weather across the world.
Languages and libraries used:
- Pandas
- Numpy
- Matplotlib
- SciPy
- Time
- OpenWeatherMap API
- Google Places API
If duplicating/running the Jupyter Notebook for this project, an OpenWeather and Google Place API key will be required and entered in the appropriate config.js file.
This analysis was performed in February 2021. Data and results will reflect the analysis being performed at this particular time of year.
When analyzing the world-wide weather:
-
There are more representative cities in the northern hemisphere, due to the northern hemisphere having more landmass.
-
Temperatures are the warmest in the cities closest to the equator, with the southern hemisphere being warmer than the northern hemisphere.
-
The northern hemisphere tends to be more humid than the southern.
-
There is generally no relationship for locations compared with cloud cover (cloudiness) and wind speed. This is verified in the regression analyses.
When analyzing the world-wide weather of the 15 cities that met the weather specifications:
- There are more ideal cities in the northern hempisphere, most of which are a coastal city or located on an island.
- My choice for a vacation spot would be the Abaco Beach Resort, in Marsh Harbour, the Bahamas.
(Image exports are located in the folder titled, Images and csv exports are located in the folder titled, Resources.)
A Python script was used to visualize the weather of 500+ randomly chosen cities across the world, at varying distances from the equator. Starter code with a simple Python library and the OpenWeatherMap API was provided.
- Out of the 625 randomly chosen cities, only 576 were used in the analysis. The remaining were eliminated due to incomplete data.
Linear regressions on each relationship for the northern and summer hemispheres were performed. The northern hemisphere was defined as greater than or equal to 0 degrees latitude, and southern hemisphere was defined as less than 0 degrees latitude.
Northern Hemisphere: Temperature vs. Latitude regression is showing the closer to the equator the warmer the temperature. The r-squared value of 0.78, this is the highest of the coefficients of determination (closest to 1). Southern Hemisphere: Temperature vs. Latitude regression is not showing as strong of a relationship between temperature and location as in the northern hemisphere. The r-squared value is 0.35. Northern Hemisphere: Humidity vs. Latitude regression is not showing a strong relationship between location and humidity levels, though the higher latitudes tend to be more humid. The r-squared value is 0.10. Southern Hemisphere: Humidity vs. Latitude regression, like for the northern hemisphere, is not showing a strong relationship. The r-squared value is 0.02. Northern Hemisphere: Cloud Cover (cloudiness) vs. Latitude regression is not showing a strong relationship between location and cloud cover. The r-squared value is 0.03. Southern Hemisphere: Cloud Cover (cloudiness) vs. Latitude regression is not showing a strong relationship between location and cloud cover. The r-squared value is 0.13. Northern Hemisphere: Wind Speed vs. Latitude regression is not showing a strong relationship between location and wind speed. The r-squared value is 0.008. Southern Hemisphere: Wind Speed vs. Latitude regression is not showing a strong relationship between location and wind speed. The r-squared value is 0.038.With the data from Part I, the ideal vacation locations were determined using the Google Places API.
A heat map was generated for the 585 cities.
The data was reduced to include these ideal conditions:
-
A max temperature lower than 80 degrees but higher than 70.
-
Wind speed less than 10 mph.
-
Zero cloud cover (cloudiness).
With these conditions, the first hotel within 5000 meters was located for each of the 15 cities.