A web-based interface for the NSRDB to EPW pipeline, replicating the workflow from NSRDB2EPW.ipynb.
- Web Interface: User-friendly browser-based form with interactive map
- Interactive Map: Click to place points or draw polygons to generate WKT geometry
- Multiple Datasets: Support for CONUS, full-disc, aggregated, and TMY datasets
- Automatic EPW Conversion: Convert CSV outputs to EPW files automatically
- REST API: Programmatic access to all functionality
- URL Query Interface: Direct URL-based job execution
- File Management: Organized output storage with job summaries
- Real-time Validation: Input validation and error handling
- Python 3.11 or higher
- NSRDB API key (get one from NREL)
-
Clone the repository
git clone https://github.com/your-org/openweather.git cd openweather -
Install dependencies
pip install -e . -
Run the development server
uvicorn openweather.main:app --reload --host 0.0.0.0 --port 8080
-
Open your browser
- Main app: http://localhost:8080
- API docs: http://localhost:8080/docs
- Health check: http://localhost:8080/health
# Build and run with Docker Compose
docker-compose up --build
# Or run in development mode
docker-compose --profile dev up --build# Make the script executable
chmod +x scripts/run_dev.sh
# Run the development server
./scripts/run_dev.sh- Navigate to the main page (http://localhost:8080)
- Enter WKT geometry or use the interactive map
- Select dataset and temporal resolution
- Enter years (comma-separated)
- Provide your NSRDB API key and email
- Submit to start the download and conversion process
Execute jobs directly via URL:
http://localhost:8080/q?wkt=POINT(-76.5+42.4)&dataset=nsrdb-GOES-full-disc-v4-0-0&years=2021&interval=60&apikey=YOUR_KEY&email=you@mail.com&as_epw=true
# Run a job
curl -X POST "http://localhost:8080/api/download" \
-H "Content-Type: application/json" \
-d '{
"wkt": "POINT(-76.5 42.4)",
"dataset": "nsrdb-GOES-full-disc-v4-0-0",
"interval": "60",
"years": ["2021"],
"api_key": "YOUR_API_KEY",
"email": "your@email.com",
"convert_to_epw": true
}'
# Get available datasets
curl "http://localhost:8080/api/datasets"
# Validate WKT
curl "http://localhost:8080/api/validate-wkt?wkt=POINT(-76.5+42.4)"| Dataset | Coverage | Temporal Resolution | Years |
|---|---|---|---|
| CONUS | USA Continental and Mexico | 5, 30, 60 min | 2021-2023 |
| Full-disc | USA and Americas | 10, 30, 60 min | 2018-2023 |
| Aggregated | USA and Americas | 30, 60 min | 1998-2023 |
| TMY | USA and Americas | 60 min | 2022-2023 |
OpenWeather/
βββ openweather/ # Main application
β βββ main.py # FastAPI app entry point
β βββ config.py # Settings and configuration
β βββ deps.py # FastAPI dependencies
β βββ routers/ # API and UI routes
β β βββ ui.py # Web interface routes
β β βββ api.py # REST API routes
β βββ services/ # Business logic
β β βββ nsrdb_wrapper.py # NSRDB pipeline wrapper
β β βββ geometry.py # WKT handling utilities
β β βββ storage.py # File management
β βββ templates/ # HTML templates
β βββ static/ # CSS, JS, and assets
βββ imported/ # Reference files (read-only)
β βββ nsrdb2epw.py # Original NSRDB pipeline
β βββ epw.py # EPW file handling
β βββ NSRDB2EPW.ipynb # Reference notebook
βββ tests/ # Test suite
βββ scripts/ # Utility scripts
βββ outputs/ # Generated files (created at runtime)
Environment variables (optional):
# Server settings
HOST=0.0.0.0
PORT=8080
DEBUG=false
# Logging
LOG_LEVEL=INFO
# File paths
OUTPUTS_DIR=outputs
STATIC_DIR=openweather/static
TEMPLATES_DIR=openweather/templates
# Security
SECRET_KEY=your-secret-key-change-in-production# Run all tests
pytest
# Run with coverage
pytest --cov=openweather --cov-report=html
# Run specific test file
pytest tests/test_api.py
# Run linting
ruff check .
black --check .
mypy openweather/The repository includes GitHub Actions workflows for:
- CI: Automated testing and linting on pull requests
- Deploy: Automated deployment preparation
- Fork this repository to your GitHub account
- Create a Render account at render.com
- Create a new Web Service:
- Connect your GitHub repository
- Set build command:
pip install -e . - Set start command:
uvicorn openweather.main:app --host 0.0.0.0 --port $PORT - Set environment variable:
PORT=10000
- Fork this repository to your GitHub account
- Create a Railway account at railway.app
- Deploy from GitHub:
- Connect your repository
- Railway will auto-detect the Python app
- Set environment variables as needed
-
Create a
Procfile:web: uvicorn openweather.main:app --host 0.0.0.0 --port $PORT -
Deploy using Heroku CLI:
heroku create your-app-name git push heroku main
# Required for production
HOST=0.0.0.0
PORT=8080
DEBUG=false
# Optional
LOG_LEVEL=INFO
OUTPUTS_DIR=outputs
SECRET_KEY=your-secret-key-here# Build the image
docker build -t openweather .
# Run the container
docker run -p 8080:8080 openweather# Start development environment
docker-compose --profile dev up --build
# Start production environment
docker-compose up --buildInteractive API documentation is available at:
- Swagger UI: http://localhost:8080/docs
- ReDoc: http://localhost:8080/redoc
GET /- Main web interfaceGET /q- URL query interfacePOST /run- Form submission handlerPOST /api/download- Run NSRDB jobPOST /api/convert-to-epw- Convert CSV to EPWGET /api/datasets- Get available datasetsGET /api/validate-wkt- Validate WKT geometryGET /health- Health check
- Input validation for all parameters
- Path traversal protection for file downloads
- CORS configuration for web security
- Environment-based configuration
- Secure file handling
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
# Install development dependencies
pip install -e ".[dev]"
# Set up pre-commit hooks
pre-commit install
# Run tests before committing
pytestThis project is licensed under the MIT License - see the LICENSE file for details.
- NSRDB2EPW.ipynb - Original workflow
- NREL NSRDB - Data source
- FastAPI - Web framework
- Leaflet - Interactive maps
- Tailwind CSS - Styling
- Issues: GitHub Issues
- Documentation: Wiki
- Email: team@openweather.com
- Initial release
- Web interface with interactive map
- NSRDB to EPW pipeline integration
- REST API with full documentation
- Docker support
- Comprehensive test suite
Note: This application replicates the exact workflow from NSRDB2EPW.ipynb. The imported files are reference-only and should not be modified. All functionality is implemented through the web interface and API endpoints.