Giter Club home page Giter Club logo

the-weather-scraper's Introduction

The Weather Scraper (๐ŸŒฉโ›ˆ๐ŸŒค๐ŸŒž๐ŸŒจ)

Need High-resolution Weather Data for Analytics or Machine-learning ? Seek no more.

Overview

The Weather Scraper downloads high-resolution weather data (often 5 min. intervals) from Wunderground's public weather stations around the world for you.

Install dependencies (use Python3)

pip install -r requirements.txt

TLDR

python weather_scraper.py

How to run TWS?

First, find the weather stations you are looking for.
Then you just have to update 2 config files before running TWS.

  1. Go to https://www.wunderground.com/wundermap and zoom in to your location
    ๐ŸŒž Click on a weather station and then click on the Station ID (the Station Summary page will open)
    ๐ŸŒž Open and copy all Station ID URLs you need

  2. Set the weather_station urls inside stations.txt
    ๐ŸŒž one url per line!

  3. Inside config.py
    ๐ŸŒž Set the date-range you want to download your data from
    ๐ŸŒž Set the unit system you need (metric / imperial)
    ๐ŸŒž Set FIND_FIRST_DATE to true if you want the weather scraper to use binary search to search for the first date with data, starting from START_DATE

If you want to download data from 2020/5/1 to 2020/6/1 in metric units your config.py will look like this:

from datetime import date

# Set Date format like: YYYY, MM, DD
START_DATE = date(2020, 5, 1)
END_DATE = date(2020, 6, 1)
# set to "metric" or "imperial"
UNIT_SYSTEM = "metric"

# Automatically find first date where data is logged
FIND_FIRST_DATE = False

Now you are read to run your downloads:

$ python weather_scraper.py

Wait until TWS finishes writing your data to files with this naming pattern station_name.csv!

You resulting CSV file will look something like this (if you give it a nice format)

CSV example

the-weather-scraper's People

Contributors

karlheinzniebuhr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

the-weather-scraper's Issues

station name invalid syntax

Hi Karl,

I try to understand the problem but I'm a newbie with python....

Followed all the indication, update the requirements.
Tested on mac and with linux, same problem.

Running the code I receive this error:


File "weather_scraper.py", line 45
file_name = f'{station_name}.csv'
^
SyntaxError: invalid syntax


I've also manually created the empty file, changed the code with a pre-choosed file name.
No way to solve

many thanks for your support

Python in Linux

Could be a good change to make the command python3 weather_scraper.py in the .md file? If some users just use 'python' it will assume 2.x in some cases.

Timezone information

Do you know if the data from WU includes timezone/dst information? I don't see it in
data_rows = Parser.parse_html_table(date_string, history_table), so guessing not, but this would be very useful.

Code only extracts header but doesn't extract data

I need to extract data for weather stations across Asia. I tried installing and running it as said in the README file. However, for some reason, the code is not extracting the data but is only extracting the headers. I don't get any error.

Binary search is implemented incorrectly

Binary search to find first data isn't implemented correctly. For example consider date range: 01.01.2019 - 01.01.2020 when both dates have data in table. In this situation expected first date is 01.01.2019 (after single check) but current implementation leads to first date not found.

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.