Datasets:
Download code/protostar/common.py from AlecAlameddine/protostar-climate: direct link, hf CLI and curl.
- Browser
- Download file 2.64 kB
-
https://huggingface.co/datasets/AlecAlameddine/protostar-climate/resolve/main/code/protostar/common.py
- Command line
-
hf download hf://datasets/AlecAlameddine/protostar-climate/code/protostar/common.py
-
curl -L -o common.py https://huggingface.co/datasets/AlecAlameddine/protostar-climate/resolve/main/code/protostar/common.py
2.64 kB
| """Constants shared by every step. Nothing here reads data.""" | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[2] | |
| DATA_RAW = ROOT / "data" / "raw" | |
| REPORTS = ROOT / "reports" | |
| # Training data, pinned to one commit of the Hub dataset (sha256 checked on load). | |
| HF_DATASET = "CMU-OSPO/protostar-climate-train-to-2018" | |
| HF_REVISION = "bbbdebdab2a18e00f97ef87bd3f35a71e222180b" | |
| FILES = { # local name -> (path in the Hub repo, sha256) | |
| "annual_indices.parquet": ( | |
| "annual_indices/train-00000-of-00001.parquet", | |
| "0b5f5fa9b55ab59602dcd9884b97c74c7bec7e89ea9d23f4219703046030e411"), | |
| "city_info.parquet": ( | |
| "city_info/train-00000-of-00001.parquet", | |
| "6b71424c7c30a1b8027ba47a92ccb9aab8553147950af491538ea0912bbb955d"), | |
| "coverage_and_stations.parquet": ( | |
| "coverage_and_stations/train-00000-of-00001.parquet", | |
| "d52dfcacd8eae99e5bd6c807f34dfe16f8f22e7688e5718a1ba93c8d93ca07e6"), | |
| "daily.parquet": ( # 49 MB: audit only, not committed, fetched on demand | |
| "daily/train-00000-of-00001.parquet", | |
| "1a85791055019f25f759ba23f33b326675d46a28278d4eb56a7e9845fe494361"), | |
| } | |
| # The data rule: nothing dated after this year may be a forecast input. | |
| TRAIN_END = 2018 | |
| FORECAST_YEARS = tuple(range(2019, 2026)) | |
| N_CITIES = 210 | |
| # metric code -> (column in annual_indices, missing-day columns of the 10-day rule) | |
| METRICS = { | |
| "annual_avg_temp": ("Avg Temp", ("Miss Tmax", "Miss Tmin")), | |
| "total_precip_in": ("ToT Prcp", ("Miss Prcp",)), | |
| "hottest_day_temp": ("Max Tmax", ("Miss Tmax", "Miss Tmin")), | |
| "cdd": ("cdd", ("Miss Tmax", "Miss Tmin")), | |
| } | |
| UNITS = {"annual_avg_temp": "°F", "total_precip_in": "in", | |
| "hottest_day_temp": "°F", "cdd": "°F-days"} | |
| # Organizers' rules (Space "About" tab, dataset card, example notebook). | |
| MAX_MISSING_DAYS = 10 # a year is valid if each variable the metric uses misses <= 10 days | |
| MIN_VALID_YEARS = 10 # a city-metric has a baseline (is scored) with >= 10 valid years in 30 | |
| BASELINE_WINDOW = 30 # "30-year average" and "linear trend" use the last 30 years | |
| # Backtest folds: (origin = last training year, first test year, last test year). | |
| # Selection folds have the same 7-year horizon as 2018 -> 2019-2025. | |
| SELECTION_FOLDS = ((2011, 2012, 2018), (2004, 2005, 2011)) | |
| # Veto only: these folds can reject a candidate (if it loses to the 30-year average on them), | |
| # they never rank candidates. | |
| CONFIRMATION_FOLDS = ((1997, 1998, 2004), (1990, 1991, 1997)) | |
| # The organizers' practice run (train <= 2010, test 2011-2018): used to verify the harness. | |
| PRACTICE_FOLD = (2010, 2011, 2018) | |
| SEED = 20181231 | |