Skip to content

Project using SQLAlchemy in Jupyter Notebook to analyze weather in Hawaii from different stations over one year. Then design and create a Flask app based on the queries from the Jupyter Notebook.

Notifications You must be signed in to change notification settings

SteveTuttle/hawaii-climate-analysis-with-app

Repository files navigation

hawaii-climate-analysis-with-app

UNC_data_bootcamp_module_10

Challenge Description

Background

Congratulations! You've decided to treat yourself to a long holiday vacation in Honolulu, Hawaii. To help with your trip planning, you decide to do a climate analysis about the area. The following sections outline the steps that you need to take to accomplish this task.

from the UNC Bootcamp instructions for this challenge

Deliverables

This challenge consists of two parts. For Part-1 we'll use resource file data to create a Jupyter notebook to calculate the precipitation and temperature in Hawaii within a given date range. Then for Part-2 we will use the data from that Jupyter notebook to create a Flask API to output those statistics as JSON style webpages.

Part-1: Analyze and Explore the Climate Data

For this part, we are using Python and SQLAlchemy to do a basic climate analysis in a Jupyter notebook called climate_analysis_SDT.ipynb using SQLAlchemy (ORM queries), Pandas, and Matplotlib. We are using the provided starter code files (climate_starter.ipynb and hawaii.sqlite) along with the Resource folder files to analyze this data. When finished, we will use this data to perform a Precipitation analysis and as well as a Station analysis in two subsections and plot our findings on a chart. Chart data will be provided for each subsection.

Precipitation Analysis

This analysis is to be performed in the following steps per the instructions:

  1. Find the most recent date in the dataset.

  2. Using that date, get the previous 12 months of precipitation data by querying the previous 12 months of data.

  3. Select only the "date" and "prcp" values.

  4. Load the query results into a Pandas DataFrame. Explicitly set the column names.

  5. Sort the DataFrame values by "date".

  6. Plot the results by using the DataFrame plot method:

Hawaii Precipitation Chart

HI-prcp-chart

  1. Use Pandas to print the summary statistics for the precipitation data.

Station Analysis

This analysis is to be performed in the following steps per the instructions:

  1. Design a query to calculate the total number of stations in the dataset.

  2. Design a query to find the most-active stations, meaning:

  • List the stations and observation counts in descending order.
  • Determine which station id has the greatest number of observations.
  1. Design a query that calculates the lowest, highest, and average temperatures that filters on the most-active station id found in the previous query.

  2. Design a query to get the previous 12 months of Temperature Observation (TOBS) data as follows:

  • Filter by the station that has the greatest number of observations.
  • Query the previous 12 months of TOBS data for that station.
  • Plot the results as a histogram with bins=12:

12 Months of Temperature Observation Chart

12-mos-TOBS

Part-2: Design Your Climate App

For this part, we will design a Flask API called app_SDT.py based on the queries created with Jupyter notebook.

Per the challenge instructions, we are creating the following routes as well as specific parameters:

  1. Home Route

/

  • Start at the homepage.
  • List all the available routes.
  1. Precipitation Route

/api/v1.0/precipitation

  • Convert the query results from your precipitation analysis (only the last 12 months of data) to a dictionary using date as the key and prcp as the value.
  • Return the JSON representation of your dictionary.
  1. Stations Route

/api/v1.0/stations

  • Return a JSON list of stations from the dataset.
  1. Temperature Observation Route

/api/v1.0/tobs

  • Query the dates and temperature observations of the most-active station for the previous year of data.
  • Return a JSON list of temperature observations for the previous year.
  1. Start date OR Start & End date Route

/api/v1.0/<start> and /api/v1.0/<start>/<end>

  • Return a JSON list of the minimum, average, and maximum temperature for a specified start or start-end range.
  • For a specified start, calculate TMIN, TAVG, and TMAX for all the dates greater than or equal to the start date.
  • For a specified start date and end date, calculate TMIN, TAVG, and TMAX for the dates from the start date to the end date, inclusive.

Resources

Bootcamp References

Module 10 Instructions

starter_code:

  • app.py
  • climate_starter.ipynb

Resources folder:

  • hawaii_measurements.csv
  • hawaii_stations.csv
  • hawaii.sqlite

Special Thanks:

  • Jamie Miller
  • Mounika Mamindla
  • Lisa Shemanciik

External References

About

Project using SQLAlchemy in Jupyter Notebook to analyze weather in Hawaii from different stations over one year. Then design and create a Flask app based on the queries from the Jupyter Notebook.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published