|
| 1 | +# pylint: disable=C0103 |
| 2 | +from dataclasses import dataclass |
| 3 | +from typing import Final |
| 4 | + |
| 5 | +from climateset.utils import get_yaml_config |
| 6 | + |
1 | 7 | # TODO remove raw variables from here |
| 8 | + |
| 9 | + |
| 10 | +@dataclass(frozen=True) |
2 | 11 | class Cmip6plusConstants: |
3 | 12 | """ |
| 13 | + Dataclass to represent CMIP6PLUS constants that are used by the download module. |
| 14 | +
|
4 | 15 | Attributes: |
5 | | - NODE_LINK (str): Where the data can be accessed |
6 | | - MODEL_SOURCES (List<str>): Identifiers for supported climate models |
7 | | - VAR_SOURCE_LOOKUP (Dict<str, List<str>>): model and raw variables |
8 | | - SUPPORTED_EXPERIMENTS (list<str>): experiments of climate models (runs) that are supported |
| 16 | + NODE_LINK : Where the data can be accessed |
| 17 | + MODEL_SOURCES : Identifiers for supported climate models |
| 18 | + VAR_SOURCE_LOOKUP : model and raw variables |
| 19 | + SUPPORTED_EXPERIMENTS : experiments of climate models (runs) that are supported |
9 | 20 | """ |
10 | 21 |
|
11 | | - NODE_LINK = "http://esgf-data2.llnl.gov" |
| 22 | + NODE_LINK: Final[str] |
| 23 | + MODEL_SOURCES: Final[tuple[str, ...]] |
| 24 | + VAR_SOURCE_LOOKUP: Final[tuple[str, ...]] |
| 25 | + SUPPORTED_EXPERIMENTS: Final[tuple[str, ...]] |
12 | 26 |
|
13 | | - MODEL_SOURCES = [ |
14 | | - "HasGEM3-GC31-LL", |
15 | | - ] |
16 | 27 |
|
17 | | - VAR_SOURCE_LOOKUP = [ |
18 | | - "areacella", |
19 | | - "mrsofc", |
20 | | - ] |
| 28 | +_data = get_yaml_config("downloader/constants/cmip6plus.yaml") |
21 | 29 |
|
22 | | - SUPPORTED_EXPERIMENTS = [ |
23 | | - "hist-lu", |
24 | | - "hist-piAer", |
25 | | - "hist-piVolc", |
26 | | - ] |
| 30 | +CMIP6PLUS_CONSTANTS = Cmip6plusConstants( |
| 31 | + NODE_LINK=_data["node_link"], |
| 32 | + MODEL_SOURCES=tuple(_data["model_sources"]), |
| 33 | + SUPPORTED_EXPERIMENTS=tuple(_data["supported_experiments"]), |
| 34 | + VAR_SOURCE_LOOKUP=tuple(_data["var_source_lookup"]), |
| 35 | +) |
0 commit comments