D-Mielewczyk / euro-temperature-trend-stats

MIT License
0 stars 0 forks source link

Add files via upload #27

Closed Maxifunny closed 2 days ago

Maxifunny commented 3 days ago

Climate Data Analysis and Visualization This repository contains Python scripts for analyzing and visualizing climate data using Plotly and Pandas libraries. The scripts demonstrate various data processing tasks such as loading CSV files from nested directories, cleaning up data, and visualizing temperature trends and changes across geographic locations.

Key Components: Data Loading and Preparation:

The script load_processed_data_with_staid recursively loads temperature data stored in CSV files organized by stations (identified by STAID) from nested directories (line_plot_data/min, line_plot_data/mean, line_plot_data/max). It adds STAID information to each DataFrame. Station metadata is loaded from stations.csv, where latitude (LAT) and longitude (LON) coordinates are converted from Degrees Minutes Seconds (DMS) format to Decimal Degrees (DD) for plotting on maps. Data Visualization:

Line Plots: The function create_single_line_plot generates individual line plots for minimum, mean, and maximum temperatures over time, using Plotly's go.Scatter for interactive visualization. These plots are saved as HTML files (Min_line_plot.html, Mean_line_plot.html, Max_line_plot.html). Bar Chart: The create_bar_chart function calculates and visualizes temperature changes (TG) by region (STAID), showing the difference between maximum and minimum temperatures. The resulting bar chart (bar_chart.html) is interactive and can be viewed in a web browser. Heatmap: Using create_heatmap, temperature changes across geographic locations are displayed on a density map (Temperature_Changes_Map.html). The map uses Plotly's density_mapbox to show temperature changes (TG) as color gradients on a map centered around latitude 50 and longitude 10. Usage: Ensure all required Python libraries (plotly, pandas) are installed. Modify directory paths (line_plot_data/, stations.csv) as per your data structure. Run each function (create_single_line_plot, create_bar_chart, create_heatmap) with the appropriate DataFrame (min_temp_df, mean_temp_df, max_temp_df) to generate visualizations.