{"id":19082308,"url":"https://github.com/esoltys/climate_data_viz","last_synced_at":"2026-05-10T05:02:54.017Z","repository":{"id":250753961,"uuid":"835365369","full_name":"esoltys/climate_data_viz","owner":"esoltys","description":"FastAPI-based web application that fetches and visualizes climate data from the Copernicus Climate Data Store (CDS). ","archived":false,"fork":false,"pushed_at":"2024-08-30T16:45:44.000Z","size":481,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T06:15:44.369Z","etag":null,"topics":["apache-echarts","copernicus-climate-data-store","fastapi","numpy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/esoltys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-29T17:24:31.000Z","updated_at":"2024-08-30T16:45:47.000Z","dependencies_parsed_at":"2024-11-09T02:43:00.114Z","dependency_job_id":"da057f54-5c84-4b88-9d9f-5d452f15d084","html_url":"https://github.com/esoltys/climate_data_viz","commit_stats":null,"previous_names":["esoltys/climate_data_viz"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/esoltys/climate_data_viz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esoltys%2Fclimate_data_viz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esoltys%2Fclimate_data_viz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esoltys%2Fclimate_data_viz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esoltys%2Fclimate_data_viz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/esoltys","download_url":"https://codeload.github.com/esoltys/climate_data_viz/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esoltys%2Fclimate_data_viz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271122266,"owners_count":24702971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache-echarts","copernicus-climate-data-store","fastapi","numpy"],"created_at":"2024-11-09T02:42:53.467Z","updated_at":"2026-05-10T05:02:48.984Z","avatar_url":"https://github.com/esoltys.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Climate Data Visualization Project\n\nThis project is a FastAPI-based web application that fetches and visualizes climate data from the Copernicus Climate Data Store (CDS). It provides an API endpoint to retrieve temperature data for a specific year and month, and processes this data to provide useful statistics.\n\n![Screenshot](screenshot.png)\n\n## Features\n\n- Data Retrieval:\n  - Fetch monthly average temperature data from the Copernicus Climate Data Store (CDS) API\n  - Cache results for 24 hours\n  - Support for specifying year and month for data retrieval\n\n- Data Processing:\n  - Process and analyze temperature data to provide comprehensive statistics\n  - Calculate average, median, minimum, and maximum temperatures\n  - Compute standard deviation for temperature variation\n  - Determine 25th and 75th percentile temperatures\n  - Provide latitude and longitude ranges for the data\n\n- API Endpoints:\n  - RESTful API endpoint to retrieve processed climate data\n  - Swagger UI documentation for easy API exploration and testing\n\n- Error Handling and Logging:\n  - Robust error handling for data retrieval and processing\n  - Detailed logging for troubleshooting and monitoring\n\n- Frontend:\n  - Simple and clean HTML interface for data visualization\n  - Integration of Apache ECharts for creating dynamic and responsive charts\n\n- Backend:\n  - FastAPI framework for high-performance, easy-to-use API development\n  - Efficient serving of static files for frontend assets\n\n## Prerequisites\n\nBefore you begin, ensure you have met the following requirements:\n\n- Python 3.7 or higher\n- A Copernicus Climate Data Store (CDS) Beta API key https://cds-beta.climate.copernicus.eu/how-to-api\n\n## Installation\n\n1. Clone the repository:\n   ```\n   git clone https://github.com/esoltys/climate-data-viz.git\n   cd climate-data-viz\n   ```\n\n2. Create a virtual environment and activate it:\n   ```\n   python -m venv venv\n   source venv/bin/activate  # On Windows, use `venv\\Scripts\\activate`\n   ```\n\n3. Install the required packages:\n   ```\n   pip install -r requirements.txt\n   ```\n\n4. Set up your CDS API key:\n   - Create a file named `.cdsapirc` in your home directory\n   - Add the following content to the file, replacing `YOUR-API-KEY` with your actual CDS API key:\n     ```\n     url: https://cds-beta.climate.copernicus.eu/api\n     key: YOUR-API-KEY\n     ```\n\n5. Accept the \"Terms of Use\" at the bottom of the Download tab for the dataset:\n    - https://cds-beta.climate.copernicus.eu/datasets/reanalysis-era5-single-levels-monthly-means?tab=download\n    - Currently configured for:\n      - Product type: Monthly averaged reanalysis\n      - Variable: 2m temperature\n      - Year: 2023\n      - Month: July\n      - Time: 00:00\n      - Geographical area: Whole available region\n      - Data format: NetCDF4 (Experimental)\n\n## Usage\n\n1. Start the FastAPI server:\n   ```\n   uvicorn app.main:app --reload\n   ```\n\n2. View the Data Visualization:\n   - Open your web browser and navigate to `http://127.0.0.1:8000/static/index.html`\n\n3. Access the API:\n   - Open your web browser and navigate to `http://127.0.0.1:8000/docs` to view the Swagger UI documentation for the API.\n   - Use the `/api/temperature` endpoint to retrieve temperature data for a specific year and month:\n     ```\n     GET http://127.0.0.1:8000/api/temperature?year=2023\u0026month=7\n     ```\n\n4. API Response Format:\n   When using the `/api/temperature` endpoint, you'll receive a JSON response with the following structure:\n   ```json\n   {\n     \"year\": 2023,\n     \"month\": 7,\n     \"average_temperature\": 8.64,\n     \"median_temperature\": 9.12,\n     \"min_temperature\": -64.73,\n     \"max_temperature\": 41.73,\n     \"std_deviation\": 22.18,\n     \"unit\": \"Celsius\",\n     \"data_points\": 73728,\n     \"latitude_range\": [-90.0, 90.0],\n     \"longitude_range\": [0.0, 359.75],\n     \"25th_percentile\": -8.31,\n     \"75th_percentile\": 24.89\n   }\n   ```\n\nNote: The current implementation uses fixed data for July 2023. To visualize data for different months or years, you'll need to modify the `main` function in `static/js/visualization.js`.\n\n## Running Tests and Type Checking\n\nTo run the tests, use the following command:\n\n`pytest`\n\nTo check type annotations:\n\n`pyright`\n\n## Architecture\n\n```mermaid\ngraph TB\n    User((User))\n    \n    subgraph \"Climate Data Visualization System\"\n        FrontendApp[\"Frontend Application\u003cbr/\u003e(HTML, JavaScript)\"]\n        \n        subgraph \"Backend Services\"\n            APIServer[\"API Server\u003cbr/\u003e(FastAPI)\"]\n            DataProcessingService[\"Data Processing Service\u003cbr/\u003e(Python)\"]\n            CacheService[\"Cache Service\u003cbr/\u003e(Python)\"]\n        end\n        \n        subgraph \"Data Storage\"\n            FileCache[(\"File Cache\u003cbr/\u003e(JSON)\")]\n        end\n    end\n    \n    subgraph \"External Services\"\n        CDSApi[\"Copernicus Climate Data Store API\u003cbr/\u003e(CDS API)\"]\n    end\n    \n    User --\u003e FrontendApp\n    FrontendApp --\u003e APIServer\n    APIServer --\u003e DataProcessingService\n    APIServer --\u003e CacheService\n    CacheService --\u003e FileCache\n    DataProcessingService --\u003e CDSApi\n    \n    classDef frontend fill:#1168bd,stroke:#0b4884,color:#ffffff\n    classDef backend fill:#2694ab,stroke:#1a6d7d,color:#ffffff\n    classDef database fill:#2b78e4,stroke:#1a4d91,color:#ffffff\n    classDef external fill:#999999,stroke:#666666,color:#ffffff\n    \n    class FrontendApp frontend\n    class APIServer,DataProcessingService,CacheService backend\n    class FileCache database\n    class CDSApi external\n\n```\n\n## License\n\nThis project is open source and available under the [MIT License](LICENSE).\n\n## Acknowledgments\n\nThis project would not have been possible without the following open-source libraries and services:\n\n- [Copernicus Climate Data Store](https://cds.climate.copernicus.eu/) for providing the climate data\n- [FastAPI](https://fastapi.tiangolo.com/) for the web framework\n- [Uvicorn](https://www.uvicorn.org/) for the ASGI server\n- [cdsapi](https://pypi.org/project/cdsapi/) for accessing the Copernicus Climate Data Store\n- [xarray](http://xarray.pydata.org/) for handling multi-dimensional arrays and NetCDF data\n- [NumPy](https://numpy.org/) for numerical computing\n- [python-dotenv](https://pypi.org/project/python-dotenv/) for managing environment variables\n- [Pydantic](https://pydantic-docs.helpmanual.io/) for data validation\n- [Requests](https://docs.python-requests.org/) for making HTTP requests\n- [pytest](https://docs.pytest.org/) for testing\n- [Apache ECharts](https://echarts.apache.org/) for creating dynamic, interactive data visualizations in web browsers\n\nThese tools and libraries have greatly contributed to the development and success of this project.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesoltys%2Fclimate_data_viz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesoltys%2Fclimate_data_viz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesoltys%2Fclimate_data_viz/lists"}