Predicting Storms in 1794

Michael Winfield
Posted on May 20, 2016

Contributed by Michael Winfield. Michael is currently in the NYC Data Science Academy 12-week full time Data Science Bootcamp program taking place between April 11th to July 1st, 2016. This post is based on his second class project – building a Shiny App in R.

Click on images to enlarge.

The CLIWOC Dataset: Weather and Location Measurements from 1750-1850

The CLIWOC Dataset consists of 18th-19th century ship logs from European ships traveling around the world. Those ship logs – of course, organized by date – contain longitude and latitude measurements for a particular ship on a given date with corresponding temperature measurements and weather conditions. The dataset entries are in multiple languages and there is a fair amount of corruption (missing data), particularly in earlier years in the century’s worth of data.

To deal with the data corruption, I tried multiple approaches before I realized that the missing data was Missing Completely At Random. I had missing temperature measurements and missing positional data.  With respect to missing temperature measurements, (a) I tried mean imputation, but, as one can imagine, that skewed the temperature readings; (b) next, I tried random imputation, but that resulted in temperature readings that make no sense for their time frame and geographic location; and, last, (c) I simply omitted the observations lacking temperature measurements, given that out of over 200,000 observations, this left me with over 50,000. With respect to missing positional data, I tried both random and mean imputation, but, as one can imagine, the random imputation created ship positions on land masses and the mean imputation clustered values in the most traveled ship lanes, thus obscuring the actual patterns in the dataset! I again opted for omitting corrupted observations, as this left me with over 50,000 observations, and the missing data was missing completely at random.

After dealing with the missing data issues, I took a step back and thought about my goal for my second project. For my second project, I wanted to create an interactive way of visualizing the location of occurrences of rain, storms, and fog. Looking at the dataset, I wondered: What is the most user friendly way to conceptualize ancient century ship logs recording position (longitude and latitude) and related records of weather and temperature? My first idea was to code an interactive map.

An interactive map, I reasoned, would:

  1. Allow the user to eyeball the geographic distribution of each type of weather condition, across a century’s worth of time.


  1. Determine quickly by selecting between drop-down items whether the geographic clustering of the positions of the weather events over a century’s worth of time was similar or different.


  1. Zoom in on and identify a particular weather event of a particular type and acquire knowledge of its corresponding temperature and date (for example, to learn that some of the storms have high temperatures and thus are tropical storms).


Beyond building that interactive feature, I also wanted to investigate temperature measurements in the dataset with greater focus. The questions I had were:

  1. How does temperature vary over the dataset?


Given that I had already taken care of data corruption, the graphs likely indicate a smaller number of ships taking temperature readings earlier in time. The variation in the range of temperatures observed likely indicates different ship travel patterns (e.g., different months of departure), and there is very little variation in the range of temperatures observed on a month-to-month basis.


This is likely a result of ships travelling from high temperature areas to high temperature areas.


  1. Where do particular temperature measurements cluster in this dataset?



The highest temperature observations cluster around the 0 in Latitude (the Equator) and 0, 50, and 100 for Longitude (all of which bisect population dense areas – North America, South America, Africa, and Europe).


  1. How does average temperature in this dataset vary with the various weather conditions on a month-to-month basis?


To answer this question, I built an animated slider barplot that plots average temperature readings in a given month over every year in 1750-1850 against the total occurrences of rain, storms, and fog in that month over all years. Through a quick 30-second animation, this portion of the app visually demonstrates that across a century’s worth of data, the amount of rain, fog, and storms varies on a month-to-month basis greatly, but average temperatures from month-to-month do not. The weather condition that varies the most on a monthly basis is rain.

Predicting 18th-Century Weather Conditions

Lastly, I wanted to test out logistic regressions for rain, storms, and fog to see if I could predict the occurrence of a given type of weather event based on this ancient dataset. I used David Roberts’ method of calculating the AUC in R, via use of the ROCR library.

Above is the code for the logistic regressions I conducted for the occurrence of a storm, rain, and fog, and below are their respective AUC calculations, all of which are above .5, meaning my models perform better than randomness (or a coin toss).



About Author

Michael Winfield

Michael Winfield

Michael has a passion for finding strategic insights for businesses, managers, and organizations engaged in competitive dynamics. With a background in corporate litigation and white collar criminal defense, as well as graduate-level education in strategic management, Michael is...
View all posts by Michael Winfield >

Related Articles

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp