Planning a relaxing vacation in Honolulu, Hawaii? Here's how to analyse the climate data and design a Flask API to help make your trip unforgettable.
Utilise Python, SQLAlchemy, Pandas, and Matplotlib to explore climate data and gain insights. Follow these steps using the provided files (climate_starter.ipynb and hawaii.sqlite):
- Connect to the SQLite database with create_engine().
- Reflect tables into classes using automap_base() and create references for station and measurement.
- Establish a SQLAlchemy session to interact with the database.
- Identify the most recent date in the dataset.
- Retrieve the last 12 months of precipitation data from this date.
- Select only "date" and "prcp" values.
- Load query results into a Pandas DataFrame and set the index to "date".
- Sort DataFrame values by "date".
- Create a plot of the results using the DataFrame plot method.
- Print summary statistics for the precipitation data.
- Calculate the total number of stations in the dataset.
- Identify the most-active station (highest observation count).
- List stations and observation counts in descending order.
- Design a query to calculate the lowest, highest, and average temperatures for the most-active station.
- Obtain the previous 12 months of temperature observation (TOBS) data for the most-active station and plot it as a histogram.
After completing the data analysis, create a Flask API with the following routes:
- /: Start at the homepage and list all available routes.
- /api/v1.0/precipitation: Retrieve the last 12 months of precipitation data and return it as a JSON dictionary.
- /api/v1.0/stations: Return a JSON list of stations from the dataset.
- /api/v1.0/tobs: Query temperature observations for the most-active station from the previous year and return a JSON list.
- /api/v1.0/ and /api/v1.0//: Return a JSON list containing minimum, average, and maximum temperatures for specified date ranges. For a single start date or a start-end range.
With this climate data analysis and Flask API, you can confidently plan your vacation in Honolulu. Explore historical weather patterns and access valuable insights to make the most of your trip!'