Coder Social home page Coder Social logo

weather-history's Introduction

Weather History

(This was inspired by John Resig's post about weather data: http://ejohn.org/blog/historical-weather-data/)

This tool uses history weather data from Weather Underground to analyze the number of snow or rain days historically. I built it to answer the question: How many days of the year in NYC have never had rain. In other words, is there any day, like October 12th, on which it has never rained in NYC in the past?

The answer to that question is: No. Since 1984 (first year for which comprehensive data is available through the WU site), it has rained at least once on every day of the calendar year (at least at JFK airport).

In Logan, UT, (airport code LGU) these days have never had rain: Jan 6, Jan 12, Jan 13, Feb 2, Feb 27, Feb 29, July 8, July 12, July 27, Aug 9, Sep 25, and Dec 5.

Here's an example URL for the data: http://www.wunderground.com/history/airport/jfk/1984/1/1/CustomHistory.html?dayend=1&monthend=1&yearend=1985&req_city=NA&req_state=NA&req_statename=NA&MR=1

To use:

$ gem install bundler
$ bundle
$ irb -r ./config/boot.rb
>> airport_code = 'JFK'
>> 1984.upto(2010) {|year| $COLL.insert(WeatherHistory.parse(y, airport_code))};
>> analyzer = WeatherHistory::Analyzer.new(airport_code)
>> $DB['weather_analysis'].insert(analyzer.analyze)

This loads the weather history data into a mongodb collection 'weather' in a db named 'weatherhistory_development' (configurable in config/mongo.yml), and loads the analyzed data in a collection 'weather_analysis'. You can then query it for days which historically have had no rain by doing:

>> $DB['weather_analysis'].find(:rain_count => 0, :airport_code => airport_code).to_a

It also stores the min and max temperature for that calendar day, so if you want to find what the min and max temperatures on your birthday were:

>> $DB['weather_analysis'].find(:airport_code => airport_code, :day => 27, :month => 3).to_a

weather-history's People

Contributors

bantic avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.