A comprehensive Python toolkit for analyzing NASA POWER satellite-derived solar irradiance data with professional statistical methods and visualization capabilities. This project provides scientific-grade analysis tools for solar resource assessment, climate research, and renewable energy applications.
Originally developed from Google Colab research code, now restructured as a professional, modular Python package with advanced features including multi-language support, document export, and comparative analysis capabilities.
Solar Irradiance Analysis/
βββ main.py # π Main interactive application
βββ README.md # π This documentation
βββ requirements.txt # π¦ Python dependencies
βββ backup/ # ποΈ Original code backup
β βββ original_colab_code.py # Original Google Colab code
β
βββ src/ # π Source code modules
β βββ __init__.py
β βββ core/ # βοΈ Core configuration
β β βββ __init__.py
β β βββ config.py # Configuration settings
β βββ data/ # π Data management
β β βββ __init__.py
β β βββ data_sets.py # Dataset definitions and utilities
β βββ analysis/ # π¬ Statistical analysis
β β βββ __init__.py
β β βββ analysis_functions.py # Analysis algorithms
β βββ visualization/ # π Data visualization
β β βββ __init__.py
β β βββ plotting_functions.py # Interactive plotting
β βββ export/ # π Document generation
β β βββ __init__.py
β β βββ document_exporter.py # DOCX/PDF export system
β βββ utils/ # π οΈ Utilities
β βββ __init__.py
β βββ i18n.py # Internationalization system
β
βββ docs/ # π Documentation
βββ tests/ # π§ͺ Test files
βββ reports/ # π Generated reports
βββ .venv/ # π Virtual environment
βββ __pycache__/ # ποΈ Python cache
# Activate virtual environment
.\.venv\Scripts\activate
# Install dependencies (if needed)
pip install -r requirements.txt
# Set execution policy (PowerShell)
Set-ExecutionPolicy Unrestricted -Scope Processpython main.pyThis launches an interactive menu with options:
- π₯οΈ Console Analysis: Complete analysis with interactive plots
- π Individual Export: Export specific dataset to documents
- π Comprehensive Export: All datasets in one document
- π Console + Export: Analysis + automatic document generation
- βοΈ Configuration: Language and display settings
- Basic statistics (mean, std, min, max)
- Linear trend analysis
- Anomaly detection
- Seasonal analysis
- Interannual variability
- Monthly time series
- Annual mean evolution
- Monthly climatology
- Relative anomalies
- Decade analysis
- Comparative analysis between datasets
- π Multi-language support (English/Spanish)
- π Dynamic scaling for all datasets
- π¨ Professional formatting with proper titles
- π High-quality plots (300 DPI)
- π Document export to DOCX and PDF
- π§ Interactive menu system
This project analyzes solar irradiance data from NASA's POWER (Prediction of Worldwide Energy Resources) project, accessed through the NASA POWER Data Access Viewer.
- π Global Coverage: Satellite-based data covering the entire Earth
- π High Quality: NASA's rigorous data validation and processing
- π°οΈ Long-term Records: Historical data spanning multiple decades
- π¬ Scientific Standards: Peer-reviewed methodologies and algorithms
- π Open Access: Free, publicly available data for research and analysis
- Parameter: Solar Irradiance (kWh/mΒ²/day)
- Temporal Resolution: Monthly averages
- Spatial Resolution: 0.5Β° x 0.625Β° (approximately 50km x 50km)
- Coverage Period: Multi-decade historical records
- Source: MERRA-2 reanalysis and satellite observations
- Quality: Validated against ground-based measurements worldwide
Solar irradiance analysis is crucial for:
- βοΈ Solar Energy Planning: Site assessment and energy potential
- π± Climate Research: Understanding long-term climate patterns
- π Trend Analysis: Detecting changes in solar resource availability
- β‘ Renewable Energy: Supporting sustainable energy transitions
- π Environmental Studies: Climate change impact assessment
The project handles multiple datasets with data organized as:
- Keys: Years (dynamically calculated from datasets)
- Values: Monthly arrays with 12 irradiance values
- Metadata: Location information and descriptions
- Source: NASA POWER satellite-derived data
Configure languages independently in src/core/config.py:
LANGUAGE_CONFIG = {
'print_language': 'en', # Console output: 'en' or 'es'
'plot_language': 'en' # Plot labels: 'en' or 'es'
}- English (both):
print: 'en', plot: 'en' - Spanish (both):
print: 'es', plot: 'es' - Mixed EN/ES:
print: 'en', plot: 'es' - Mixed ES/EN:
print: 'es', plot: 'en'
- Professional formatting with tables and statistics
- Complete analysis information (matching console output)
- High-quality plots automatically generated and embedded
- Comparative summary plot for multiple datasets
- Multilingual support (follows i18n configuration)
- Automatic timestamping for file organization
- Organized directory structure
python main.py
# Select option 2, 3, or 4 from the menu# For advanced users - direct module usage
python -c "
from src.export.document_exporter import create_reports
from src.data.data_sets import dataset_1, DATASET_METADATA
from src.analysis.analysis_functions import analyze_dataset
# ... custom analysis code
"- Plot styles: Professional formatting with dynamic scales
- Figure sizes: Optimized for both screen and document display
- Colors: Consistent color schemes across all visualizations
- Titles: Multi-line formatting with proper spacing
- Dynamic periods: Automatically calculated from data
- Trend analysis: Linear regression with confidence intervals
- Anomaly detection: Based on climatological means
- Seasonal analysis: Monthly climatology with statistics
- pandas: Data manipulation and analysis
- numpy: Numerical calculations
- matplotlib: Interactive and exportable visualizations
- python-docx: Professional DOCX document generation
- reportlab: Advanced PDF document creation
- β Organized structure with proper Python packages
- β Interactive menu system instead of multiple scripts
- β Professional document export with embedded plots
- β Multi-language support with independent configuration
- β Dynamic scaling that works with all datasets
- β Complete information preservation from console to documents
- β Comparative analysis visualization
- β Error-free execution with proper dependency management
- π§ Modular architecture for maintainability
- π¨ Professional plot formatting with proper titles
- π Dynamic period calculation (no hardcoded dates)
- π Centralized internationalization system
- π Advanced document generation with images and tables
- β‘ Reliable data processing with pandas
- π§ Stable and mature data processing ecosystem
This project includes comprehensive code quality and formatting tools:
- Black: Python code formatter (equivalent to Prettier for Python)
- isort: Import statement organizer
- Prettier: Markdown, JSON, and YAML formatter
- Flake8: Python linting (equivalent to ESLint for Python)
- MyPy: Static type checking
- Bandit: Security vulnerability scanner
Automated quality checks before each commit:
- Code formatting validation
- Import organization
- Linting checks
- Type checking
- Security scanning
# Windows setup
.\scripts\setup-dev.ps1
# Linux/macOS setup
./scripts/setup-dev.sh
# Manual setup
pip install -r requirements-dev.txt
pre-commit install# Development workflow
make setup-dev # Complete development environment setup
make format # Format all code automatically
make lint # Run all linting checks
make test # Run tests with coverage
make clean # Clean cache and build files
make run # Run the main application
# Individual tools
black src/ main.py # Format Python code
isort src/ main.py # Sort imports
flake8 src/ main.py # Lint Python code
mypy src/ main.py # Type checking
# Documentation formatting
npm run format # Format all Markdown, JSON, YAML files
npm run format:check # Check formatting without changing files
prettier --write "**/*.md" "**/*.json" # Direct prettier usagepyproject.toml: Centralized Python tool configuration.flake8: Linting rules and exclusions.prettierrc: Formatting rules for documentation.pre-commit-config.yaml: Automated quality checksrequirements-dev.txt: Development dependenciespackage.json: Node.js dependencies and npm scripts.gitignore: Files and directories to ignore in version control
# Test individual components
python -c "from src.data.data_sets import dataset_1; print('β
Data import OK')"
python -c "from src.utils.i18n import i18n; print('β
i18n system OK')"
# Run full test suite
make test # With coverage report
pytest tests/ -v # Verbose output- π Descriptive Statistics: Mean, standard deviation, min/max analysis
- π Trend Analysis: Linear regression with least squares fitting
- π‘οΈ Anomaly Detection: Deviation from climatological means
- π Seasonal Analysis: Monthly climatology and variability
- π Comparative Analysis: Multi-dataset statistical comparison
- π Time Series Analysis: Temporal evolution visualization
- π Trend Visualization: Linear trend representation with confidence intervals
- π‘οΈ Anomaly Mapping: Relative deviation from normal patterns
- π Climatological Patterns: Monthly and seasonal cycle analysis
- π Multi-Dataset Comparison: Comparative statistical visualization
- β Data Validation: Automated checks for data integrity
- π Statistical Consistency: Cross-validation with climatological norms
- π Outlier Detection: Identification and handling of extreme values
- π Trend Significance: Statistical evaluation of temporal changes
- NASA POWER Project: NASA Prediction of Worldwide Energy Resources (POWER). "Data Access Viewer (DAV)." NASA Langley Research Center. Available at: https://power.larc.nasa.gov/data-access-viewer/
- NASA POWER Methodology: NASA POWER Data Services Documentation. "Data Sources and Methodology." Available at: https://power.larc.nasa.gov/docs/methodology/data/sources/
- NASA POWER Services: NASA POWER. "Data Services and APIs." Available at: https://power.larc.nasa.gov/docs/services/
- CERES Project: NASA Clouds and the Earth's Radiant Energy System (CERES) - provides solar irradiance and cloud property data
- MERRA-2 Reanalysis: NASA Global Modeling and Assimilation Office (GMAO) Modern-Era Retrospective analysis for Research and Applications, Version 2
- Surface Radiation Budget (SRB): NASA project providing surface radiation flux estimates
- Solar Resource Assessment: NASA POWER data is widely used for renewable energy planning and solar resource evaluation
- Climate Research: Long-term solar irradiance analysis for climate change studies and trend detection
- Agricultural Applications: Solar radiation data for crop modeling and agricultural decision-making
When using NASA POWER data in publications or projects, use the following citation format:
NASA POWER Project. Prediction Of Worldwide Energy Resources (POWER) Data Access Viewer.
NASA Langley Research Center. Available at: https://power.larc.nasa.gov/data-access-viewer/
- NASA Earthdata POWER Overview: https://www.earthdata.nasa.gov/data/tools/power-dav
- POWER User Guides and Tutorials: https://power.larc.nasa.gov/docs/tutorials/
- POWER FAQ: https://power.larc.nasa.gov/docs/faqs/data/
- Follow the established package structure
- Update imports when moving files
- Maintain i18n compatibility
- Test with multiple datasets
- Ensure document export functionality
- Cite data sources appropriately when using NASA POWER data
- Follow scientific best practices for data analysis and visualization
- Statistical Tests:
- Normality tests (Shapiro-Wilk, Kolmogorov-Smirnov)
- Trend tests (Mann-Kendall, Sen's slope)
- Cross-correlation analysis between datasets
- Statistical significance testing
- Temporal autocorrelation analysis
- Advanced Metrics:
- Extreme value analysis (GEV, GPD)
- Return period calculations
- Drought/excess indices
- Climate change detection indices
- Web Interface:
- Flask/Django/Streamlit implementation
- Interactive plots with Plotly/Bokeh
- Real-time data visualization
- Responsive design for mobile/desktop
- User Features:
- Dynamic dataset selection
- Interactive temporal filters
- Custom analysis parameters
- Export options from web interface
- Database Support:
- PostgreSQL/MySQL connectivity
- Dataset storage and versioning
- Analysis history tracking
- Metadata management
- Data Management:
- Automated data ingestion
- Data quality checks
- Backup and recovery systems
- Optimized SQL queries
- REST API:
- FastAPI/Flask implementation
- Automated analysis endpoints
- Authentication and authorization
- Rate limiting and caching
- Documentation:
- Automatic API documentation (Swagger)
- Client libraries (Python, R, JavaScript)
- Usage examples and tutorials
- Predictive Models:
- Solar irradiance forecasting (ARIMA, LSTM)
- Trend prediction algorithms
- Seasonal decomposition with ML
- Anomaly detection with unsupervised learning
- Advanced Analytics:
- Pattern recognition in temporal data
- Classification of climate patterns
- Principal Component Analysis (PCA)
- Clustering analysis for similar periods
- Advanced Comparisons:
- Multi-dimensional cluster analysis
- Temporal heatmaps and correlation matrices
- Cross-spectral analysis (FFT)
- Wavelet analysis for frequency decomposition
- Visualization Improvements:
- 3D surface plots for temporal-spatial data
- Interactive correlation networks
- Animated time series evolution
- Geographic mapping integration
- Test Coverage:
- Unit tests for all modules
- Integration tests for workflows
- Performance benchmarking
- Data validation tests
- Code Quality:
- Automated code formatting (Black, isort)
- Linting with pylint/flake8
- Type hints with mypy
- Documentation generation (Sphinx)
- High-Performance Backend
- Advanced Optimization:
- Parallel processing for large datasets
- Advanced caching mechanisms
- Streaming data processing
- GPU acceleration with cuPolars
- Deployment:
- Docker containerization
- Cloud deployment (AWS, GCP, Azure)
- CI/CD pipelines
- Monitoring and logging systems
- Enhanced Documentation:
- Scientific methodology documentation
- API reference documentation
- User guides and tutorials
- Video tutorials and demos
- Educational Content:
- Jupyter notebook examples
- Case studies with real data
- Best practices guide
- Troubleshooting documentation
Version: 1.0.0
Architecture: Modular Python Package
Compatibility: Windows/Linux/macOS
Python: 3.8+