Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abhy-kumar/raydium
This program aims to develop a solar potential map of India.
https://github.com/abhy-kumar/raydium
api branca folium geopandas matplotlib nasa-power python tqdm
Last synced: 7 days ago
JSON representation
This program aims to develop a solar potential map of India.
- Host: GitHub
- URL: https://github.com/abhy-kumar/raydium
- Owner: abhy-kumar
- License: mit
- Created: 2024-10-28T05:52:43.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-11T17:01:55.000Z (about 1 month ago)
- Last Synced: 2024-11-11T18:18:31.334Z (about 1 month ago)
- Topics: api, branca, folium, geopandas, matplotlib, nasa-power, python, tqdm
- Language: HTML
- Homepage:
- Size: 38 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# π Raydium - Solar Potential Analysis for India
Raydium aims to map India's solar potential using high-resolution data and advanced processing techniques. This project is actively being developed, and contributions are highly appreciated! π
## π Features
- **Solar Potential Mapping**: Fetches and calculates solar potential using NASA POWER API data π
- **Interactive Visualization**: Displays solar potential over India with interactive maps πΌοΈ
- **High-Resolution Interpolation**: Generates detailed solar potential maps using grid sampling and interpolation πΊοΈ
- **Optimized Data Fetching**:
- **Rate Limiting**: Ensures respectful API usage by limiting request rates β±οΈ
- **Caching**: Stores fetched data locally to minimize redundant API calls πΎ
- **Concurrency**: Utilizes asynchronous processing for efficient data handling β‘
- **Automated with GitHub Actions**: Automatically runs daily or on-demand using GitHub Actions π
- **Comprehensive Logging**: Tracks the process flow and errors with detailed logs π## π οΈ Setup
### Prerequisites
- **Python**: Version 3.8 or higher
- **Required Packages**: Listed in `requirements.txt`
- **GeoJSON File**: Ensure you have the `india-soi.geojson` file in the root directory. You can obtain it from [DataMeet](https://github.com/datameet/maps/blob/master/Country/india-soi.geojson).### 1οΈβ£ Clone the Repository
```bash
git clone https://github.com/your-username/raydium.git
cd raydium
```### 2οΈβ£ Install Dependencies
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
```Or manually install dependencies with:
```bash
pip install numpy pandas geopandas folium pvlib requests beautifulsoup4 shapely scipy branca matplotlib tqdm```
```
### 3οΈβ£ Run the Scripts Locally
The project is now split into two separate scripts for better modularity and efficiency:Data Collection: Fetches and processes solar data.
Visualization: Generates visualizations based on the collected data.## π GitHub Actions Workflow
To automate the solar analysis daily or on-demand, Raydium uses GitHub Actions! π
1. **Enable GitHub Actions**:
- The workflow is defined in `.github/workflows/run_raydium.yml`.
2. **Triggers**:
- Run daily at midnight UTC (modifiable by editing the `cron`).
- Or trigger manually from the **Actions** tab.#### π Workflow Overview
```yaml
name: Generate Solar Potential Dataon:
schedule:
- cron: '0 0 * * *' # Run daily at midnight UTC
workflow_dispatch: # Allow manual triggerjobs:
collect-data:
name: Data Collection - ${{ matrix.region }}
runs-on: ubuntu-latest
strategy:
matrix:
region: [north, south, east, west] # Define regions based on your GeoJSON filessteps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0- name: Set Up Python Environment
uses: actions/setup-python@v4
with:
python-version: '3.10'- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgeos-dev libproj-dev- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt- name: Run Data Collection for ${{ matrix.region }}
run: |
python data_collection.py --region ${{ matrix.region }}
env:
PYTHONUNBUFFERED: 1- name: Upload Solar Data Artifact
uses: actions/upload-artifact@v3
with:
name: solar-data-${{ matrix.region }}
path: india_solar_data_${{ matrix.region }}.csvgenerate-visualization:
name: Generate Visualization
runs-on: ubuntu-latest
needs: collect-data
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0- name: Download All Solar Data Artifacts
uses: actions/download-artifact@v3
with:
name: solar-data-north
path: ./data/north
- uses: actions/download-artifact@v3
with:
name: solar-data-south
path: ./data/south
- uses: actions/download-artifact@v3
with:
name: solar-data-east
path: ./data/east
- uses: actions/download-artifact@v3
with:
name: solar-data-west
path: ./data/west- name: Combine Solar Data
run: |
cat ./data/north/india_solar_data_north.csv ./data/south/india_solar_data_south.csv ./data/east/india_solar_data_east.csv ./data/west/india_solar_data_west.csv > india_solar_data.csv- name: Set Up Python Environment
uses: actions/setup-python@v4
with:
python-version: '3.10'- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgeos-dev libproj-dev- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt- name: Run Visualization
run: |
python visualization.py
env:
PYTHONUNBUFFERED: 1- name: Upload Visualization Artifacts
uses: actions/upload-artifact@v3
with:
name: visualization
path: |
india_solar_potential.html
solar_potential_high_res.pngcommit-data:
name: Commit and Push Generated Files
runs-on: ubuntu-latest
needs: generate-visualization
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0- name: Download Solar Data Artifacts
uses: actions/download-artifact@v3
with:
name: solar-data-north
path: ./data/north
- uses: actions/download-artifact@v3
with:
name: solar-data-south
path: ./data/south
- uses: actions/download-artifact@v3
with:
name: solar-data-east
path: ./data/east
- uses: actions/download-artifact@v3
with:
name: solar-data-west
path: ./data/west- name: Download Visualization Artifacts
uses: actions/download-artifact@v3
with:
name: visualization
path: ./visualization- name: Configure Git Credentials
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"- name: Combine Solar Data
run: |
cat ./data/north/india_solar_data_north.csv ./data/south/india_solar_data_south.csv ./data/east/india_solar_data_east.csv ./data/west/india_solar_data_west.csv > india_solar_data.csv- name: Copy Generated Files to Repository
run: |
cp india_solar_data.csv india_solar_potential.html solar_potential_high_res.png .- name: Commit and Push Changes
run: |
git add india_solar_data.csv india_solar_potential.html solar_potential_high_res.png
git diff --cached --quiet || (
git commit -m "Update solar potential data [skip ci]" &&
git push
)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```## π Output
- **india_solar_potential.html**: Interactive map showcasing solar potential across India.
- **solar_potential_high_res.png**: High-resolution image of the solar potential map.
- **india_solar_data.csv**: Raw solar potential data for each grid point sampled.## π File Structure
```plaintext
.
βββ data_collection.py # Script for fetching and processing solar data
βββ visualization.py # Script for generating visualizations
βββ requirements.txt # Python dependencies
βββ india-soi.geojson # GeoJSON file of India's boundaries
βββ .github
β βββ workflows
β βββ run_raydium.yml # GitHub Actions workflow
βββ README.md # Project documentation
βββ solar_data.log # Log file for the data collection process
βββ visualization.log # Log file for the visualization process
βββ india_solar_data.csv # Aggregated solar potential data
βββ india_solar_potential.html # Interactive solar potential map
βββ solar_potential_high_res.png # High-resolution solar potential image
```## π Credits
Special thanks to [DataMeet](https://github.com/datameet/maps/blob/master/Country/india-soi.geojson) for the GeoJSON boundary file of India and to [NASA POWER API](https://power.larc.nasa.gov/docs/services/api/) for the data required to calculate the solar potential.