Prior to a trip to Honolulu, Hawaii, a climate analysis about the area was performed. The two major components consisted of a Climate Analysis and Exploration and Climate App.
Through the use of Python and SQLAlchemy, a basic climate analysis and data exploration of the climate database was completed. Specifically, SQLAlchemy ORM queries, Pandas and Matplotlib was utilized.
The following steps were completed prior to analysis:
- Utilized the SQLAlchemy create_engine() function to connect to the SQLite database.
- Utilized the SQLAlchemy automap_base() function to reflect tables into classes, station and measurement.
- Linked Python to the database by creating a SQLAlchemy session.
- Performed preciptiation analysis and station analysis in the following two subsections.
Preciptation Analysis
- Found the most recent date in the dataset.
- Utilizing the most recent date, retrieved the previous 12 months of precipitation data by querying the previous 12 months of data.
- Selected only the "date" and "prcp" (precipitation) values.
- Loaded the query results into a Pandas DataFrame and set index to "date" column.
- Sorted DataFrame values by "date".
- Plotted the precipitation results over the last year by using the DataFrame plot method.
- Utilized Pandas to print summary statistics for the precipitation data.
Station Analysis
- Designed a query to calculate the total number of stations in the dataset.
- Designed a query to find the most-active weather stations and list the stations and observation counts in descending order.
- Answered the following question: Which station id has the greatest number of observations?
- Designed a query that calculates the lowest, highest and average temperatures that filters on the most-active station ID found in the previous query.
- Designed a query to retrieve the previous 12 months of temperature observation (TOBS) data. Then plotted these results as a histogram with bins=12.
- Closed session.
Designed a Flask API based on the queries above using several SQLAlchemy precipitation and temperature queries in an API using a Python Flask App. Dates can only be chosen between 01-01-2010 and 08-23-2017.
/
- Home page
/api/v1.0/precipitation
- JSON representation of the dictionary of the yearly precipitation analysis from the most recent date
/api/v1.0/stations
- JSON list of all the weather stations and their characteristics from the dataset
/api/v1.0/tobs
- JSON list of temperature observations for the previous year
/api/v1.0/MM-DD-YYYY
- JSON list of minimum, average & maximum temperatures for the range beginning with the provided start date through to 08-23-2017
/api/v1.0/MM-DD-YYYY/MM-DD-YYYY
- JSON list of minimum, average & maximum temperatures for the range beginning with the provided start and end date range
Menne, M.J., I. Durre, R.S. Vose, B.E. Gleason, and T.G. Houston, 2012: An overview of the Global Historical Climatology Network-Daily Database. Journal of Atmospheric and Oceanic Technology, 29, 897-910, https://doi.org/10.1175/JTECH-D-11-00103.1
- Dataset provided by edX UofT Data Analytics, which had been generated by Trilogy Education Services, LLC.