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.
- Acquire GeoTIFF images. [:white_check_mark:]
- 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:]
- Create a Gantt chart to display the data availability for each selected station. [:white_check_mark:]
- Display the selected stations together with the GeoTIFF image. [:white_check_mark:]
- Iterate the last step over each .TIF image available. [ ]
- Extract the rainfall data for each station from all images generated in the previous step to a .csv file. [ ]
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
Firstly, you need a GeoTIFF image so the data can be extracted. Images of that type may be obtained from ClimateSERV.
Then, place all GeoTIFF images in the same folder.
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.
By now, you can get a raster image displaying the data stations from the selected cities and the GeoTIFF image used.