Welcome to the Sicily Precipitation Data Analysis repository! π§οΈπ Dive into comprehensive precipitation data from Sicily's agrometeorological stations, meticulously processed and ready for your geospatial analysis and environmental monitoring projects.
snapshot-final-result.mp4
- π Description
- π Project Structure
- π Getting Started
- βοΈ Usage
- π Accessing the Data
- π§ Extending the Project
- π Data Source
- π License
- π€ Contributing
- π¬ Contact
- π Acknowledgements
The sicily-precip
project is designed to retrieve, convert, and analyze precipitation data from Sicily's agrometeorological stations (SIAS). Leveraging the CKAN API from the Region Siciliana Data Portal, this repository transforms raw hourly precipitation CSV data into monthly aggregated totals. The processed data is then converted into versatile formats like JSON, GeoJSON, and SHP, organized by year for seamless integration into geospatial tools and mapping applications.
Additionally, the repository includes methodologies for downscaling Satellite Precipitation Products (SPP) to a finer resolution, enhancing the granularity and usability of precipitation data for detailed environmental analyses.
sicily-precip/
β
βββ datasets/ # Raw precipitation data in CSV format
βββ preprocessed_datasets/ # Cleaned and aggregated monthly data
βββ geoDataframes/ # GeoDataFrames with geocoded station data
βββ ee_fc/ # JSON files for Google Earth Engine Feature Collections
βββ SPP_downscaling/ # Downscaling of Satellite Precipitation Products
β βββ charts/ # Generated charts from downscaling analysis
β βββ maps/ # Maps visualizing downscaled precipitation data
β βββ scripts_ipynb/ # Jupyter notebooks for downscaling processes
β βββ SPP_downscaling_1Km.ipynb # Notebook for 1 km resolution downscaling
βββ scripts/
β βββ fetch_data_sicily.py
β βββ fetch_stations.py
β βββ preproc_precipitations.py
β βββ merge_geocode.py
β βββ populate_datasets.py
β βββ testSHP.py
βββ LICENSE
βββ README.md
βββ requirements.txt
Follow these steps to set up the project on your local machine for development and analysis.
Ensure you have the following installed:
- Python 3.x: Download Python
- Conda: Install Conda
-
Clone the Repository
git clone https://github.com/fener95/sicily-precip.git cd sicily-precip
-
Create a Conda Environment
Create and activate a new Conda environment named
sicily
:conda create -n sicily python=3.x conda activate sicily
-
Install Dependencies
Install the required Python libraries:
conda install pandas geopandas pip install earthengine-api geemap requests
Alternatively, install all dependencies at once:
pip install -r requirements.txt
-
Authenticate Google Earth Engine (GEE)
If you plan to use GEE features, authenticate your account:
earthengine authenticate
-
Verify Directory Structure
Ensure all folders (
datasets/
,preprocessed_datasets/
, etc.) are present. If not, create them:mkdir datasets preprocessed_datasets geoDataframes ee_fc scripts SPP_downscaling charts maps scripts_ipynb
Retrieve the latest precipitation data and station information from the Region Siciliana data portal.
-
Fetch Station Information
python scripts/fetch_stations.py
This script retrieves location details of all SIAS agrometeorological stations.
-
Fetch Precipitation Data
python scripts/fetch_data_sicily.py
This script downloads raw hourly precipitation CSV files for each station.
Aggregate and process the raw data for analysis.
-
Aggregate Precipitation Data
python scripts/preproc_precipitations.py
This script aggregates hourly data into monthly totals per station.
-
Merge and Geocode Data
python scripts/merge_geocode.py
Combines aggregated data with station locations and prepares GeoDataFrames.
-
Organize Datasets
python scripts/populate_datasets.py
Structures the processed data into yearly folders and converts them into JSON, GeoJSON, and SHP formats.
-
Test SHP Conversion
python scripts/testSHP.py
Validates the SHP file conversion process.
Enhance precipitation data resolution using the downscaling methodology outlined in the SPP_downscaling_1Km.ipynb
notebook.
Perform downscaling of Satellite Precipitation Products (SPP) to a 1 km resolution using Google Earth Engine (GEE). The end result is an ImageCollection representing monthly precipitation data for Sicily, providing high-resolution insights into rainfall patterns over the past two decades.
-
Setup and Authentication
- Initialize GEE and authenticate the environment within the notebook.
- Import necessary libraries (
geemap
,ee
).
import ee ee.Authenticate(auth_mode='notebook') ee.Initialize(project='mapping-applications') import geemap
-
Define the Study Area
- Define Sicily by filtering the FAO GAUL dataset.
- Specify a polygon geometry for processing.
gaul = ee.FeatureCollection('FAO/GAUL/2015/level2') region = gaul.filter(ee.Filter.eq('ADM1_NAME', 'Sicilia')) geometry = region.geometry()
-
Data Source and Precipitation Product Selection
- Utilize a long-term precipitation dataset (e.g., CHIRPS, ERA5) available through GEE.
- Set the temporal range to 2001-2020.
-
Downscaling Methodology
- Spatial Downscaling: Resample or reproject precipitation data to 1 km resolution using interpolation or statistical methods.
- Temporal Aggregation: Aggregate data monthly to derive long-term precipitation patterns.
-
Processing Workflow
- Filtering by Date and Region: Filter the dataset for 2001-2020 and clip to Sicily.
- Resampling and Interpolation: Use
reduceResolution
orresample
methods for finer-grained estimates. - Conversion to ImageCollection: Convert downscaled data to an ImageCollection for analysis in GEE.
-
Export and Visualization
- Export the downscaled ImageCollection to Google Drive or display directly using
geemap
.
Map = geemap.Map() Map.centerObject(region, 7)
- Export the downscaled ImageCollection to Google Drive or display directly using
- A Google Earth Engine ImageCollection representing 20 years of monthly precipitation data for Sicily, downscaled to 1 km resolution.
- Useful for:
- Hydrological modeling
- Agricultural planning
- Climate studies and environmental monitoring
- Use of GEE for Downscaling: Leveraging GEEβs computing resources and geospatial data.
- Focus on Sicily: Targeting detailed analysis for Sicily.
- Comprehensive 20-Year Period: Providing long-term precipitation insights.
For detailed methodology and code, refer to the SPP_downscaling_1Km.ipynb notebook.
Once preprocessing is complete, access the data in the following directories:
preprocessed_datasets/
: Cleaned and aggregated monthly precipitation data.geoDataframes/
: Geocoded dataframes for spatial analysis.ee_fc/
: JSON files formatted for Google Earth Engine Feature Collections.SPP_downscaling/
:charts/
: Generated charts from downscaling analysis.maps/
: Maps visualizing downscaled precipitation data.scripts_ipynb/
: Jupyter notebooks for downscaling processes.
You can directly utilize these files in GIS applications, mapping tools, or integrate them into your environmental monitoring workflows.
Enhance the repository by:
- Forking the Repository: Apply similar data processing methods to other public APIs or datasets.
- Adding Additional Data Types: Incorporate other meteorological data such as temperature, humidity, or wind speed.
- Improving Data Visualizations: Create interactive maps or dashboards using libraries like
geemap
orPlotly
. - Expanding Downscaling Methods: Implement advanced downscaling techniques or explore different spatial resolutions.
Contributions are highly encouraged! See the Contributing section for more details.
- Primary Data Provider: Region Siciliana Data Portal
- SIAS Agrometeorological Stations: SIAS Network
- API Access: CKAN API from Region Siciliana
Data Attribution: Region Siciliana
Data License: Creative Commons Attribution 4.0 International (CC BY 4.0)
This project is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) License. You are free to share and adapt the material for any purpose, even commercially, as long as appropriate credit is given.
Contributions are welcome! Whether you're fixing bugs, improving documentation, or adding new features, your help is appreciated.
-
Fork the Repository
-
Create a New Branch
git checkout -b feature/YourFeature
-
Commit Your Changes
git commit -m "Add your message"
-
Push to the Branch
git push origin feature/YourFeature
-
Open a Pull Request
For major changes, please open an issue first to discuss your ideas.
Have questions or feedback? Reach out to me at:
π§ [email protected]
- Data Provider: Thanks to the Region Siciliana for providing open access to precipitation data (2019-2022).
- Libraries and Tools: Special thanks to the developers of
pandas
,geopandas
,earthengine-api
, andgeemap
for their invaluable tools that made this project possible. - Google Earth Engine: For providing a robust platform for geospatial analysis and downscaling methodologies.
Happy analyzing! ππ¦οΈ