Giter VIP home page Giter VIP logo

wunderground-station-history's Introduction

Retrieving historical weather data from wunderground

This Java class automatically retrieves weather data from wunderground.

Licence

None. Feel free to use it as you wish.

Context

Weather Underground (wunderground) is a website that provides weather-related reports, forecasts, maps, etc. Measurements from personal weather stations can also be uploaded to the website and be made available. An API also exists for retrieving data from the service.

There is however no built-in functionality to retrieve historical data over long periods (e.g., a year), which means that you need to write a script, either using the API, or using another method. In the following, I describe such a method.

Martin Benning developed wunderground-core, a Java API for weather data handling from wunderground weather stations. I used this API to build a Java class that retrieves historical data over a year from a specific weather station. Data includes temperature, wind speed, humidity, rain rate, etc., but unfortunately not solar radiation. Based on the examples provided at wunderground-core, I created the class available here.

Using the code

The parameters of the script are the following (see WUndergroundHistoData.java) in the source code:

  • The selected year;
  • A vector giving the number of days in a month, that only needs to be edited to account for leap years (February with 28 or 29 days);
  • The selected country;
  • The selected weather station ID, which can be obtained directly by browsing the wunderground website or by listing the available stations using the example code available from wunderground-core (or uncomment the corresponding code to display the full list). The default one is IBELFORT2.

If everything is operational (you need to import the wunderground-core JAR library), results should display in the console. At the end of the script, results are also written to a CSV file in the results folder.

Sample output

Sample measurements from the IBELFORT2 weather station, as plot automatically by wunderground:

Sample output plot

Limitations

  • The selected method is certainly not the most efficient, but it does the job.
  • The script sometimes fails randomly due a connection timeout, I don’t know why.

Contact

Robin Roche - robinroche.com

wunderground-station-history's People

Contributors

robinroche 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.