Skip to content

Latest commit

 

History

History
76 lines (47 loc) · 4.42 KB

README.MD

File metadata and controls

76 lines (47 loc) · 4.42 KB

Precipitation data extractor

This is a prototype that I'm currently developing in my scientific initiation. Its purpose is to place data stations from multiple climate agencies (such as ANA, SUDENE etc) on a GeoTIFF image using RasterIO library, and then extract its precipitation data to a .csv file using their geographic coordinates.

Current progress

  1. Acquire GeoTIFF images. [:white_check_mark:]
  2. Create a feature to allow the script to obtain data from multiple stations without having to run it again for each city (it's the standard behavior of hydrobr library) [:white_check_mark:]
  3. Create a Gantt chart to display the data availability for each selected station. [:white_check_mark:]
  4. Display the selected stations together with the GeoTIFF image. [:white_check_mark:]
  5. Iterate the last step over each .TIF image available. [ ]
  6. Extract the rainfall data for each station from all images generated in the previous step to a .csv file. [ ]

Installation

It's expected to use Google Colab to run the script, since

a) a local installation would require installing another package manager besides pip;

b) part of this code expects to access Google Drive to found the necessary files (but it's possible to change that to get those files from your local machine)

However, it's possible to run it locally by installing the libraries via pip by the following commands:

pip install hydrobr
pip install rasterio
pip install pandas
pip install matplotlib.pyplot

However, there is another library still needed ( geopandas ) that is easily installed using Conda package manager. It's actually possible to install it via pip, but it'd require manually installing its dependencies.

Using Conda, run the following commands:

conda update --all
conda install geopandas

Usage

Firstly, you need a GeoTIFF image so the data can be extracted. Images of that type may be obtained from ClimateSERV.

Rainfall image

Rainfall GeoTIFF image obtained via ClimateSERV, from UCSB CHIRPS database.

Then, place all GeoTIFF images in the same folder.

Parameters

city_list = Choose the cities to analyse, writing their names inside quotation marks and separating each one with commas. Leave the list empty to get all cities from the select state below.

state = Choose the state that contains the selected cities. The script supports only one state per time due to how much time would take to extract that amount of data.

raster = Type your images' path inside quotation marks. Currently, it's supporting just one image each time, so type one image's name too.

data = The second argument should be 0 or 1. Select 0 for displaying the station names on the Gantt chart, or 1 for displaying their codes.

Current results

By now, you can get a raster image displaying the data stations from the selected cities and the GeoTIFF image used.

Data stations of Bahia

All data stations from the state of Bahia. The GeoTIFF image used was the same shown on the "Usage" section.

Mucuri data availability (codes)

Availability of each data station from "Mucuri" (displaying their codes).

Mucuri data availability (names)

Availability of each data station from "Mucuri" (displaying their names).