climate-ref-pmp 0.8.0__py3-none-any.whl → 0.9.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,11 +6,18 @@ from __future__ import annotations
6
6
 
7
7
  import importlib.metadata
8
8
  import os
9
+ from pathlib import Path
9
10
  from typing import TYPE_CHECKING
10
11
 
12
+ import pooch
11
13
  from loguru import logger
12
14
 
13
- from climate_ref_core.dataset_registry import DATASET_URL, dataset_registry_manager
15
+ from climate_ref_core.dataset_registry import (
16
+ DATASET_URL,
17
+ dataset_registry_manager,
18
+ fetch_all_files,
19
+ validate_registry_cache,
20
+ )
14
21
  from climate_ref_core.providers import CondaDiagnosticProvider
15
22
  from climate_ref_pmp.diagnostics import ENSO, AnnualCycle, ExtratropicalModesOfVariability
16
23
 
@@ -19,6 +26,8 @@ if TYPE_CHECKING:
19
26
 
20
27
  __version__ = importlib.metadata.version("climate-ref-pmp")
21
28
 
29
+ _REGISTRY_NAME = "pmp-climatology"
30
+
22
31
 
23
32
  # Create the PMP diagnostics provider
24
33
  # PMP uses a conda environment to run the diagnostics
@@ -38,6 +47,34 @@ class PMPDiagnosticProvider(CondaDiagnosticProvider):
38
47
  logger.debug("Setting env variable 'FI_PROVIDER=tcp'")
39
48
  self.env_vars["FI_PROVIDER"] = "tcp"
40
49
 
50
+ def fetch_data(self, config: Config) -> None:
51
+ """Fetch PMP climatology data."""
52
+ registry = dataset_registry_manager[_REGISTRY_NAME]
53
+ fetch_all_files(registry, _REGISTRY_NAME, output_dir=None)
54
+
55
+ def validate_setup(self, config: Config) -> bool:
56
+ """Validate conda environment and data checksums."""
57
+ # First check conda environment
58
+ if not super().validate_setup(config):
59
+ return False
60
+
61
+ # Then check data checksums
62
+ registry = dataset_registry_manager[_REGISTRY_NAME]
63
+ errors = validate_registry_cache(registry, _REGISTRY_NAME)
64
+ if errors:
65
+ for error in errors:
66
+ logger.error(f"{self.slug} validation failed: {error}")
67
+ logger.error(
68
+ f"Data for {self.slug} is missing or corrupted. "
69
+ f"Please run `ref providers setup --provider {self.slug}` to fetch data."
70
+ )
71
+ return False
72
+ return True
73
+
74
+ def get_data_path(self) -> Path | None:
75
+ """Get the path where PMP data is cached."""
76
+ return Path(pooch.os_cache("climate_ref"))
77
+
41
78
 
42
79
  provider = PMPDiagnosticProvider("PMP", __version__)
43
80
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: climate-ref-pmp
3
- Version: 0.8.0
3
+ Version: 0.9.0
4
4
  Summary: PMP diagnostic provider for the Rapid Evaluation Framework
5
5
  Author-email: Jiwoo Lee <jwlee@llnl.gov>, Jared Lewis <jared.lewis@climate-resource.com>
6
6
  License-Expression: Apache-2.0
@@ -1,4 +1,4 @@
1
- climate_ref_pmp/__init__.py,sha256=RZ2pZS50d8FctDREpJheBHwX5Y2vZCWtAMgY2bseue4,2267
1
+ climate_ref_pmp/__init__.py,sha256=cSbtESJGEPRLpkPbdBZ4n8SV5xQDMgqETPAC9R1h0uI,3530
2
2
  climate_ref_pmp/pmp_driver.py,sha256=ZNuwg7qmx43DlVoW52LY4SUiKV4jxnAroDowVUrrYps,8136
3
3
  climate_ref_pmp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  climate_ref_pmp/dataset_registry/pmp_climatology.txt,sha256=lruldzyr8fS79Tdg5RsIo_nzPGaQDjwpUE00t9S2QTM,3488
@@ -13,9 +13,9 @@ climate_ref_pmp/params/pmp_param_annualcycle_1-clims.py,sha256=P7DkL5wdtK9huQ9um
13
13
  climate_ref_pmp/params/pmp_param_annualcycle_2-metrics.py,sha256=JH9flUE9Ti-2bhCpDkDtmup1aD_7brHPqNSbc2-loF8,1655
14
14
  climate_ref_pmp/requirements/conda-lock.yml,sha256=HIFVM0uqIBDBmeFqsk35bvF_WkWnMoUKgpryewod0sA,337159
15
15
  climate_ref_pmp/requirements/environment.yml,sha256=QUDTJ3eJVcAjUhaGMhwpFWYwKCByyUz0MDEs881Sl-I,157
16
- climate_ref_pmp-0.8.0.dist-info/METADATA,sha256=6EqPg4E6mGwUG1oUcrcvZdzXq0SmGHWHlXpGMCZTW7o,2733
17
- climate_ref_pmp-0.8.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
18
- climate_ref_pmp-0.8.0.dist-info/entry_points.txt,sha256=zfT0ogvlMMR23ZaS-e7HYiTki0_sUcSh8gGTu4p81kg,55
19
- climate_ref_pmp-0.8.0.dist-info/licenses/LICENCE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
20
- climate_ref_pmp-0.8.0.dist-info/licenses/NOTICE,sha256=4qTlax9aX2-mswYJuVrLqJ9jK1IkN5kSBqfVvYLF3Ws,128
21
- climate_ref_pmp-0.8.0.dist-info/RECORD,,
16
+ climate_ref_pmp-0.9.0.dist-info/METADATA,sha256=Bqs_RlqtYh9P4Bt88hVgFwklFFKq99icPKwjHtFxnrI,2733
17
+ climate_ref_pmp-0.9.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
18
+ climate_ref_pmp-0.9.0.dist-info/entry_points.txt,sha256=zfT0ogvlMMR23ZaS-e7HYiTki0_sUcSh8gGTu4p81kg,55
19
+ climate_ref_pmp-0.9.0.dist-info/licenses/LICENCE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
20
+ climate_ref_pmp-0.9.0.dist-info/licenses/NOTICE,sha256=4qTlax9aX2-mswYJuVrLqJ9jK1IkN5kSBqfVvYLF3Ws,128
21
+ climate_ref_pmp-0.9.0.dist-info/RECORD,,