This project processes and analyzes climate data using R, leveraging Docker and Kubernetes for scalable deployment. Through detailed visualizations and analysis, it explores correlations between environmental factors and CO2 emissions.
The Climate Changer project simplifies climate data analysis with the following components:
- R Script: Processes climate data and generates visualizations.
- Docker: Containerizes the application for portability.
- Kubernetes: Manages deployment and scaling.
- Data Visualization: Produces detailed insights into climate dynamics.
- Analyze the relationship between urbanization, energy usage, and CO2 emissions.
- Provide clear visual insights for policy-makers and researchers.
- Ensure scalability using modern containerization and orchestration technologies.
- Analysis:
- Description: The graph shows how urban population correlates with CO2 emissions.
- Insights:
- Higher urban populations often lead to increased CO2 emissions.
- Certain countries with rapid urbanization exhibit disproportionately high emissions.
- Analysis:
- Description: Relationship between energy use per GDP and total CO2 emissions.
- Insights:
- Countries with low energy efficiency (higher energy use per GDP) tend to emit more CO2.
- Economic reforms targeting energy efficiency could mitigate emissions.
- Analysis:
- Description: Correlation between methane emissions and total CO2 emissions.
- Insights:
- Methane-heavy economies (agriculture, livestock) exhibit higher CO2 emissions.
- Policies targeting methane reduction could have dual benefits.
- Analysis:
- Description: Examines how protected land areas influence CO2 emissions.
- Insights:
- Countries with larger protected areas show varied CO2 emission trends.
- Suggests a need for integrated conservation and emission policies.
- Analysis:
- Description: Time series plot showing trends in urbanization and CO2 emissions.
- Insights:
- Both urban population and CO2 emissions have steadily increased since the 1990s.
- Highlights the need for sustainable urban planning.
- R Programming: For data cleaning, processing, and visualization.
- Docker: Ensures application portability and consistency.
- Kubernetes: Provides scalable deployment and orchestration.
- ggplot2: Creates visually appealing and informative plots.
- corrplot: Generates correlation matrices for data exploration.
Climate-Changer/
├── output/ # Folder containing generated visualizations
├── data/ # Data folder (mapped to container's /app/data)
├── Dockerfile # Docker build file
├── deployment.yaml # Kubernetes deployment configuration
├── compose.yaml # Docker Compose file
├── data_analysis.R # R script for data analysis
├── README.md # Project documentation
Build and start the Docker image to ensure the application works locally:
docker compose up --buildThis will:
- Build the
climate-analyzer:latestimage. - Start a container locally to confirm the application works as expected.
After confirming the image works locally, load it into the Kubernetes cluster:
-
Save the Image:
docker save climate-analyzer:latest -o climate-analyzer.tar
-
Copy the Image to the Kubernetes Node:
docker cp climate-analyzer.tar climate-cluster-control-plane:/climate-analyzer.tar
-
SSH into the Node:
docker exec -it climate-cluster-control-plane bash -
Load the Image into the Node's Container Runtime:
ctr --namespace k8s.io images import /climate-analyzer.tar
-
Exit the Node:
exit
Reapply the deployment to ensure the latest image is used:
-
Delete the Old Pods:
kubectl delete pod -l app=climate-analyzer
-
Reapply the Deployment:
kubectl apply -f deployment.yaml
Check the status of the pods to confirm the application is running:
kubectl get podsThe processed climate data is saved in the data/ directory inside the container. To extract the data:
-
Identify the Running Pod:
kubectl get pods
-
Access the Pod:
kubectl exec -it <pod-name> -- bash
-
Navigate to the Data Directory:
cd /app/data -
Copy Data to Your Local Machine:
kubectl cp <pod-name>:/app/data ./data
We welcome contributions to improve the project!
- Open an issue for suggestions or bug reports.
- Create a pull request for any improvements or features you'd like to propose.
Feel free to reach out with any questions or feedback!




