File size: 2,635 Bytes
d79a78d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""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