# weather-py **Repository Path**: impressivel/weather-py ## Basic Information - **Project Name**: weather-py - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-04 - **Last Updated**: 2026-04-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # weather-py Weather Data Collection and Analysis Tool for Wuhan, 2024 ## Project Overview `weather-py` is a Python tool designed to collect and analyze weather data for Wuhan in 2024. This project provides flexible data collection methods, supporting both single-threaded and concurrent data gathering, and can save the collected data in CSV or Excel format. ## Features - **Date Query**: Retrieve weather information for a specified date - **Date Range Generation**: Generate a list of dates within any given start and end range - **Data Export**: Support saving weather data in CSV or Excel formats - **Concurrent Collection**: Support multi-threaded concurrent collection of monthly data to improve efficiency - **Interactive Menu**: Provide a user-friendly command-line interface ## Core Functions | Function Name | Description | |---------------|-------------| | `get_weather_by_date(date_str)` | Retrieve weather data for a specified date | | `generate_date_range(start, end)` | Generate a list of dates within a specified range | | `save_weather_data(data_list)` | Save weather data to a file | | `collect_month_data(year, month)` | Collect weather data for a specified month | | `collect_month_data_concurrent(year, month, max_workers=5)` | Concurrently collect weather data for a specified month | | `show_menu()` | Display the operation menu | | `main(use_concurrent=False, max_workers=5)` | Main function that generates a full-year date list for 2024 | ## Usage ### Basic Usage ```python from demo import main # Collect data using single-threaded mode main(use_concurrent=False) # Collect data using concurrent mode (default 5 worker threads) main(use_concurrent=True, max_workers=10) ``` ### Collect Monthly Data ```python from demo import collect_month_data # Collect data for March 2024 data = collect_month_data(2024, 3) ``` ### Concurrent Collection ```python from demo import collect_month_data_concurrent # Collect data concurrently using 10 worker threads data = collect_month_data_concurrent(2024, 3, max_workers=10) ``` ### Save Data ```python from demo import save_weather_data # Save a list of weather data save_weather_data(data_list) ``` ## Output Data The project automatically generates the following files: - `wuhan_2024_weather.csv` - Weather data for Wuhan in 2024 in CSV format - `wuhan_2024_weather.xlsx` - Weather data for Wuhan in 2024 in Excel format ## Requirements - Python 3.x - Internet connection (required to fetch weather data) - Required Python packages (pandas, requests, etc.) ## License This project is intended solely for learning and educational purposes.