Coder Social home page Coder Social logo

inmet-scrap's Introduction

INMET-Scrap

Static Badge Static Badge

About this project

The objective of this project is to collect real-time meteorological data from the website of the National Institute of Meteorology of Brazil (INMET) in real time.

Tecnologies and requeriments

  • Conda 23.7.4
  • Selenium
  • Selenium WebDriver
  • Pandas

Related links

About INMET real-time data

The INMET provides on its portal several types of data in many differents modes. The real-time data is updated hourly and when you access you can see this data in a HTML table by station. The problem on the data collect is that there is a JS script that generate these tables. As the tables is a dynamic generated, I can't use Pandas or BeautifulSoup4 for extract this data.

The solution: Collect data after the JS script run.

How does this program work?

Basically, his program follow this steps:

  1. Access a specific station table.
  2. Wait for JS script run.
  3. Collect the data from the HTML table.
  4. Transform this data in a Data Frame.
  5. Export to CSV.
  6. Loop for the chosen stations.

Configuring the program

Setting the stations:

To set which stations you want do download data, verify the file stations.py. I configured the stations of Mato Grosso do Sul, but you can view the station codes on the Related Links section in this README.

Once you have configured the stations you can select datas that you want to download.

In the file spider-inmet.py, in the section "Collecting data" you can comment the lines of the column names that you don't want to download.

Example:

data = browser.find_elements(By.XPATH, '//tbody/tr/td[1]')
hora = browser.find_elements(By.XPATH, '//tbody/tr/td[2]')
# temp_inst = browser.find_elements(By.XPATH, '//tbody/tr/td[3]')
temp_max = browser.find_elements(By.XPATH, '//tbody/tr/td[4]')
temp_min = browser.find_elements(By.XPATH, '//tbody/tr/td[5]')

Doing this, the data from collumn Instantaneous Temperature will be not collected

inmet-scrap's People

Contributors

rafaelpsdv avatar

Watchers

 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.