This project has two parts one used an API request, and Python script to visualize the weather date of 500+ cities across the world of varying distance from the equator, and sourced under WeatherPy folder. To accomplish this, I utilized a simple Python library, the OpenWeatherMap API, and created a representative model of weather across world cities. The cities dataset found in output_data folder which includes the following columns City_ID
,City
,Cloudines
,Country
,Date
, Humidity
,Lat
,Lng
,Max
,Temp
,Wind Speed
. The data analyzed, and displayed on WeatherPy jupyter notebook, and the results are exported in CSV format city_weather_data.csv, and the regression plots in the output folder.
The other project VacationPy is used the output data from the previous task city_weather_data.csv, and investigate the data to plan for future vacations, and to select hotels. For this part of the analysis the a jupyter-gmaps, and the Google Places were used, and the results are displayed in VacationPy jupyter notebook. The analysis covers humidity heatmap in the cities that sourced from the weather data, and spot the hotels on top of the humidity heatmap. You can look at the images in the output folder for both the heatmap and the hotel heatmap images.
For both parts to communicate the analysis report the following links are created in Jupyter viewer:
WeatherPy Analysis: WeatherPy Analysis
VacationPy Analysis: VacationPy Analysis
To run locally the python files for both WeatherPy, and VacationPy projects you need to obtain API keys. For part one, you will need to obtain an API key for the OpenWeatherMap API, which can be obtained here. After you have the OpenWeatherMap API key, in the WeatherPy folder, config.py file add the API key there, and it looks as follows:
weather_api_key="API_KEY_HERE"
For part two, you will need to obtain a Google API key from the Google Cloud Platform at https://cloud.google.com and enable the Places API. After you have the Google API key, in the VacationPy folder, config.py file add the API key there, and it looks as follows:
g_key="API_KEY_HERE"
-
The findings of these analysis showed that there is a higher temperature for cities that found near to the equator (Latitude 0), however, when we go farther from the equator towards the north the temperature decreases highly. However, when we go to the south the temperature decreases but it is much lower comparing to the north. The regression analysis and plot also showed that there is a strong negative correlation between temperature, and latitude in the northern hemisphere however, the correlation between temperature and latitude in the south Hemisphere is negative but very week to conclude.
-
The findings from the data, plots, and the regression line in the case of testing if there is a relation between humidity and cloudiness of cities nearer or farther to the equator (latitude 0) doesn't show any significant results. The correlation between humidity and latitude for both northern and southern hemisphere cities is very week, a negative correlation, and the result for cloudiness and latitude also very week and negative. Therefore, We can infer that humidity can be fairly distributed in both northern and southern hemisphere cities regardless of their distance from the equator.
-
The finding from the analysis of the relationship between wind speed (mph), and latitude showed that the lower wind speed when the cities closer to the equater (latitude 0), and somehow the wind speed increase for the cities farther from the equater. The regression analysis also showed that there is a very week, posetive correlation between Wind Speed (mph (%) and Latitude in the Northern Hemisphere cities.
-
In the second task VacationPy, I understand that creating an exploratory-interactive geospatial, Weather information, heat maps, and visualization through Google API, and other similar API applications play a remarkable role to exploit the potential socio-economic value buried inside monotonously large datasets.
-
linear regression & Scatter Plotting
- Northern Hemisphere - Temperature (F) vs. Latitude
- Southern Hemisphere - Temperature (F) vs. Latitude
- Northern Hemisphere - Humidity (%) vs. Latitude
- Southern Hemisphere - Humidity (%) vs. Latitude
- Northern Hemisphere - Cloudiness (%) vs. Latitude
- Southern Hemisphere - Cloudiness (%) vs. Latitude
- Northern Hemisphere - Wind Speed (mph) vs. Latitude
- Southern Hemisphere - Wind Speed (mph) vs. Latitude
In this part, a Python script to visualize the weather of 500+ cities across the world of varying distances from the equator was created. After performing the API call from OpenWeatherMap API the following dataframe was created:
City | Lat | lng | Max Temp | Humidity | Cloudiness | Wind Speed | Country | Date | |
---|---|---|---|---|---|---|---|---|---|
0 | pierre | 44.37 | -100.35 | 77.00 | 47.0 | 40.0 | 13.87 | US | 1.592704e+09 |
1 | salalah | 17.02 | 54.09 | 82.40 | 88.0 | 75.0 | 4.70 | OM | 1.592704e+09 |
2 | kununurra | -15.77 | 128.73 | 84.20 | 30.0 | 31.0 | 13.87 | AU | 1.592704e+09 |
3 | upernavik | 72.79 | -56.15 | 39.76 | 73.0 | 0.0 | 8.52 | GL | 1.592704e+09 |
4 | seybaplaya | 19.65 | -90.67 | 86.00 | 84.0 | 40.0 | 11.41 | MX | 1.592704e+09 |
After that a series of scatter plots were created to showcase the following relationships:
After generating the data a series of scatter plots were created to showcase the following relationships:
The above scatter plot showcase the relationship between Latitude at x-axis vs Max Temperature (F) at the y-axis. This result indicates that there is a higher temperature for cities that found near to the equater (Latitude 0),however when you go farther from the equator towrads to the north and south the temprature will decrease.
The above scatter plot displayed the relationship between Humidity (%) vs. Latitude. From this result we can infer that humidity is fairly distributed troughout the plot, so we can say that high humidity occer for both cities found farther or near to the equator.
The above scatter plot showed that the relationship between the cities cloudness, and latitude. From this result we can tell that the data is evenly distributed, and there is no difference in Cloudiness when the cities farther or nearer to the equater(Latitude 0)
The above scatter plot showed the relationship between wind speed (mph), and latitude. The plot displayed the lower wind speed when the cities closer to the equater (latitude 0) and somehow the wind speed increase for the cities farther from the equater.
A linear regression was conducted on each relationship, only this time separating them into Northern Hemisphere (greater than or equal to 0 degrees latitude) and Southern Hemisphere (less than 0 degrees latitude):
The above plot is a linear regression model between Maximum tempreture and latitude for Northern Hemisphere cities. The result from the data showed that there is a strong, negative correlation between Maximum tempreture and latitude. These means when we go farther away to the north from the equater(latitude 0) the maximum Temperature (F) will decrease. Northern_Hemisphere_Humidity _Latitude_Linear.png
The above plot is a linear regression model between Maximum tempreture and latitude for Southern Hemisphere cities. The result from the data showed that there is a very week negative correlation between Maximum Tempreture and latitude in the Southern Hemisphere cities.
The above plot is a linear regression model between Humidity (%) and Latitude for Northern Hemisphere cities. The result from the data showed that there is a very week negative correlation between Humidity (%) and Latitude in the Northern Hemisphere cities.
The above plot is a linear regression model between Humidity (%) and Latitude for Southern Hemisphere cities. The result from the data showed that there is a very week, negative correlation between Humidity (%) and Latitude in the Southern Hemisphere cities.
The above plot is a linear regression model between Cloudiness (%) and Latitude for Northern_Hemisphere cities. The result from the data showed that there is a very week,negative correlation between Cloudiness (%) and Latitude in the Southern Hemisphere cities.
The above plot is a linear regression model between Cloudiness (%) and for Southern Hemisphere cities. The result from the data showed that there is a very week,negative correlation between Cloudiness (%) and Latitude in the Southern Hemisphere cities.
The above plot is a linear regression model between Wind Speed (mph), and latitude for Northern_Hemisphere cities. The result from the data showed that there is a very week, posetive correlation between Wind Speed (mph (%) and Latitude in the Northern Hemisphere cities.
The above plot is a linear regression model between Wind Speed (mph), and latitude for Southern Hemisphere. The result from the data showed that there is a very week, negative correlation between Wind Speed (mph (%) and Latitude in the Northern Hemisphere cities.
In this part I used a jupyter-gmaps, and the Google Places API for displaying the maps try running humidity heatmap in the cities that sourced from the weather data, and spot the hotels on top of the humidity heatmap.
If gmaps is not working in your environment try to enable by using this code jupyter nbextension enable --py gmaps
.
-
A heat map that displays the humidity for every city from the part I was created.
-
A new dataFrame was created by narrow down the weather data to find the ideal weather condition.
-
Finally a gmap plot is created for hotels on top of the humidity heatmap with each pin containing the Hotel Name, City, and Country.
Trilogy Education Services © 2019. All Rights Reserved.