{"id":20119167,"url":"https://github.com/harrystevens/temperature-seasons-analysis","last_synced_at":"2026-06-12T14:31:49.200Z","repository":{"id":255214645,"uuid":"848838632","full_name":"HarryStevens/temperature-seasons-analysis","owner":"HarryStevens","description":"Scripts for calculating seasonal temperature change","archived":false,"fork":false,"pushed_at":"2024-08-28T16:21:27.000Z","size":27445,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T19:49:54.155Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/HarryStevens.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-08-28T13:54:53.000Z","updated_at":"2024-08-28T16:21:30.000Z","dependencies_parsed_at":"2024-08-28T17:35:17.931Z","dependency_job_id":null,"html_url":"https://github.com/HarryStevens/temperature-seasons-analysis","commit_stats":null,"previous_names":["harrystevens/temperature-seasons-analysis"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HarryStevens/temperature-seasons-analysis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryStevens%2Ftemperature-seasons-analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryStevens%2Ftemperature-seasons-analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryStevens%2Ftemperature-seasons-analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryStevens%2Ftemperature-seasons-analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HarryStevens","download_url":"https://codeload.github.com/HarryStevens/temperature-seasons-analysis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryStevens%2Ftemperature-seasons-analysis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34249560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"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":[],"created_at":"2024-11-13T19:14:39.919Z","updated_at":"2026-06-12T14:31:49.185Z","avatar_url":"https://github.com/HarryStevens.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# temperature-seasons-analysis\n\nScripts for calculating seasonal temperature change using ERA5 monthly data.\n\nTable of contents:\n\n- [Installation](#installation)\n- [Setup](#setup)\n  - [Get the data](#get-the-data)\n  - [Install dependencies](#install-dependencies)\n- [Scripts](#scripts)\n  - [Averaging the grid](#averaging-the-grid)\n  - [Averaging the poles](#averaging-the-poles)\n  - [Calculating the seasonal temperature across the grid in each year](#calculating-the-seasonal-temperature-across-the-grid-in-each-year)\n  - [Calculating the regression](#calculating-the-regression)\n  - [Drawing the maps](#drawing-the-maps)\n  - [Calculating city data](#calculating-city-data)\n\n## Installation\n\n```bash\ngit clone git@github.com:HarryStevens/temperature-seasons-analysis.git\ncd temperature-seasons-analysis\n```\n\n## Setup\n\n### Get the data\n\nDownload \"ERA5 monthly averaged data on single levels from 1940 to present\" from the [Copernicus Climate Data Store](https://cds-beta.climate.copernicus.eu/datasets/reanalysis-era5-single-levels-monthly-means?tab=download). \n- Navigate to the Download tab\n- From \"Product type\", select \"Monthly averaged reanalysis\"\n- From \"Variable\", select \"2m temperature\"\n- From \"Year\", click \"Select all\"\n- From \"Month\", click \"Select all\"\n- From \"Time\", select \"00:00\"\n- From \"Geographical area\", select \"Whole available region\"\n- From \"Format\", select \"GRIB\"\n- From \"Download format\", select \"Unarchived (not zipped if single file)\"\n- You may have to create an account and agree to the terms of use. Otherwise, click \"Submit form\"\n- You will be redirected to a page with a link to download the data. You may have to wait until the \"Status\" column says \"Complete\". Then you can download the data.\n- The file name will be {some string of characters}.grib and will be around 2GB in size. Rename it to \"era5-monthly-temp.grib\" and move it to the `scripts/data/input` folder.\n\n### Install dependencies\n\nThis project uses node and python, so you will need to install the dependencies for both.\n\nFirst, install the node modules.\n\n```bash\nnpm i # Install the node modules\n```\n\nIf you get an error installing node-canvas, you may need to install its dependencies.\n\n```bash \nbrew install pkg-config cairo pango libpng jpeg giflib librsvg \n```\n\nThen, create and activate a python virtual environment, and install the python dependencies.\n\n``` bash\npython -m venv myenv # Create a Python Virtual Environment\nsource myenv/bin/activate # Activate the Virtual Environment\npip install -r requirements.txt # Install python dependencies\n```\n\n## Scripts\n\nBelow are the scripts that are run in order. You can set the start_year and end_year in scripts/CONFIG.py.\n\n### Averaging the grid\n\n```bash\npython scripts/average-grid-annual.py # Averages the grid by year\npython scripts/average-grid-monthly.py # Averages the grid by year, month \u0026 hemisphere\nnode scripts/average-grid-seasonal.js # Averages the monthly data by year and season\n```\n\n### Averaging the poles \n\n```bash\npython scripts/average-poles-annual.py # Averages the poles by year\npython scripts/average-poles-monthly.py # Averages the poles by year, month \u0026 hemisphere\n```\n\n### Calculating the seasonal temperature across the grid in each year\n\n```bash\npython scripts/annual-seasons.py # Calculate the seasonal temperature in each year\n```\n\n### Calculating the regression\n\n```bash\npython scripts/make-regression-netcdf.py # Calculate the linear regression of year vs. temperature in each season (takes ~12 minutes)\npython scripts/calculate-percentage.py # Calculate the percentage of the grid that fulfills certain criteria\n```\n\n### Drawing the maps\n\n```bash\npython scripts/convert-to-v3.py # To use the scripts/data/output/seasonal_slopes.nc file with netcdfjs, you will need to convert it from V4 to V3\nnode scripts/draw-rasters.js # Draw the rasters for map displays\n```\n\n### Calculating city data\n\nTo get data for a particular search, you will need to create a file called \"cities.json\" in the `scripts/data/input` folder. This file should contain a list of cities with an id, name, latitude, and longitude. For example:\n\n```json\n[\n  {\n    \"id\": \"1\",\n    \"name\": \"New York\",\n    \"lat\": 40.7128,\n    \"lon\": -74.0060\n  }\n]\n```\n\nThen, run the following scripts:\n\n```bash\npython scripts/make-city-lookup.py # Find the grid cell that contains each city's coordinates\npython scripts/make-city-files.py # Get the annual season temps for each city\n```\n\nThe files will be created in the `scripts/data/output/city` folder with the name of the city id. For example, the file for New York will be `scripts/data/output/city/1.json`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrystevens%2Ftemperature-seasons-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharrystevens%2Ftemperature-seasons-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrystevens%2Ftemperature-seasons-analysis/lists"}