/weather_prediction_API

Travel companies can use this repository to target audience in bad weather through weather-targeted display or social campaigns. Offering flights, hotels, and resorts with aspirational creative highlighting sunny destinations increases the effectiveness of the strategy.

Primary LanguageJupyter NotebookMIT LicenseMIT


Overview of Project How to Use Results References


Overview of Project

          It’s true not everyone is as worldly-wise as someone who’s traveled to all four corners. but having an idea about weather conditions and access to finding a good place for a trip on every time is very helpful. In this case Travel companies advertising flights, hotels or resorts can adopt the strategy of segment-targeting an audience experiencing bad weather (such as cold temperatures, Cloudiness, high Wind Speed, etc. conditions). For display or social campaigns, weather targeting works best when coupled with aspirational creative showing sunny tropical vistas to enforce a yearning for warmth and sunshine.

Objective

          This project is broken down into two deliverables, WeatherPy and VacationPy.

  • WeatherPy:

    • Use the OpenWeatherMap API to retrieve weather data from the cities list generated with citipy Python library.
    • Create a series of scatter plots to showcase the relationships between Latitude and:
      Temperature Humidity Cloudiness Wind Speed
    • Linear regression scatter plot for Northern Hemisphere and Southern Hemisphere to showcase above relationships.
  • VacationPy:

    • Create a map that displays a point for every city in the WeatherPy section DataFrame.
    • Narrow down the DataFrame to find your ideal weather condition and make hotel DataFrame.
      • ideal weather condition: 21°C < temperature < 27°C Wind speed less than 4.5 m/s Zero cloudiness
    • Use the Geoapify API to find the first hotel located within 10,000 metres of every city coordinates.
    • Add the hotel name and the country as additional information for each city in the map.

Methods, Software and Attribution

  • The analyses were performed using the OpenWeatherMap Weather API in metric units and Geoapify Place API by accommodation.hotel category, and correlation checked by Linear Reression method.

  • Following programming languages, software, and libraries were used in this project:

python v.3.9.13
jupyter notebook v.6.4.12 Visual Studio v.1.73.1 PowerPoint v.16.0.14026.20298
pandas v.1.4.4 SciPy v.1.9.3 Matplotlib v.3.6.0 citipy v.0.0.5 NumPy v.1.23.4 GeoViews v.1.9.5 bokeh v.3.0.2 hvplot v.0.8.2

  • The project header GIF has been designed by powerpoint and photopea.com using assets from Freepik.com (include: grass, tourists and tree).

How to Use

          Before running WeatherPy and VacationPy, you will need API keys. Create an api_keys.py file in the same directory containing:
# OpenWeatherMap API Key
weather_api_key = "YOUR KEY HERE"

# Geoapify API Key
geoapify_key = "YOUR KEY HERE"

TOP PAGE


Results

          Corrolation Between latitute of 553 cities and their maximum temprature, humidity, cloudiness, and wind speed are shown in the following figures.

Fig [1]: Corrolation Between latitute and maximum temprature, humidity, cloudiness, and wind speed.

          Figures [2] to Figures [5] illustrate the relation of latitude for 553 cities and their maximum temperature, humidity, cloudiness, and wind speed with linear regression in the Northern Hemisphere and Southern Hemisphere.

Fig [2]: latitute vs. maximum temprature

The above figure shows a strong correlation with r2=0.84 for Northern Hemisphere and a moderate correlation with r2=0.57 for Southern Hemisphere. this means by moving away from the equator the temperature decreases.

Fig [3]: latitute vs. humidity
Fig [4]: latitute vs. cloudiness
Fig [5]: latitute vs. wind speed

Figure [3] to Figure [5] visualize a weak correlation between humidity, cloudiness, and wind speed with latitude for both Northern Hemisphere and Southern Hemisphere. Therefore, we cannot hypothesize that by increasing latitude these properties vary too significantly.

TOP PAGE

          Figures [6] exemplify every city in the WeatherPy section Data Frame.

Fig [6]: City Point

After narrow down the DataFrame to ideal weather condition, keep humidity ,and finding relative hotel located within 10,000 metres of every city coordinates , new DataFrame result shows in Table[1]. also, Figures [7] shows these detail.

Table [1]: Hotel in Good Condition

Fig [7]: Hotel in Good Condition

Table [2] and Figures [8] show the result after cleaning No hotel found city from DataFrame.

Table [2]: Final List of City and Hotel

Fig [8]: Hotel in Good Condition


References

[1] Trilogy Education Services, a 2U, Inc. brand.

TOP PAGE