climate-ref-core 0.5.2__py3-none-any.whl → 0.5.4__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.
@@ -148,7 +148,7 @@ class DatasetRegistryManager:
148
148
  path=pooch.os_cache(cache_name),
149
149
  base_url=base_url,
150
150
  version=version,
151
- retry_if_failed=5,
151
+ retry_if_failed=10,
152
152
  env="REF_DATASET_CACHE_DIR",
153
153
  )
154
154
  registry.load_registry(str(importlib.resources.files(package) / resource))
@@ -5,7 +5,6 @@ Diagnostic interface
5
5
  from __future__ import annotations
6
6
 
7
7
  import pathlib
8
- from abc import abstractmethod
9
8
  from collections.abc import Iterable, Sequence
10
9
  from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable
11
10
 
@@ -438,12 +437,28 @@ class AbstractDiagnostic(Protocol):
438
437
  The provider that provides the diagnostic.
439
438
  """
440
439
 
441
- def run(self, definition: ExecutionDefinition) -> ExecutionResult:
440
+ def execute(self, definition: ExecutionDefinition) -> None:
442
441
  """
443
- Run the diagnostic on the given configuration.
442
+ Execute the diagnostic on the given configuration.
444
443
 
445
444
  The implementation of this method is left to the diagnostic providers.
445
+ The results should be written to the output directory of the execution definition.
446
+ These are later used to build the output bundle and the diagnostic bundle.
447
+
448
+ This may occur in a separate process (or python environment in the case of a `CommandLineDiagnostic`).
449
+
450
+ Parameters
451
+ ----------
452
+ definition
453
+ The configuration to run the diagnostic on.
454
+ """
455
+ ...
456
+
457
+ def build_execution_result(self, definition: ExecutionDefinition) -> ExecutionResult:
458
+ """
459
+ Build the result from running the diagnostic on the given configuration.
446
460
 
461
+ This can be replayed later to build the result from the output execution.
447
462
 
448
463
  Parameters
449
464
  ----------
@@ -455,6 +470,7 @@ class AbstractDiagnostic(Protocol):
455
470
  :
456
471
  The result of running the diagnostic.
457
472
  """
473
+ ...
458
474
 
459
475
 
460
476
  class Diagnostic(AbstractDiagnostic):
@@ -506,6 +522,24 @@ class Diagnostic(AbstractDiagnostic):
506
522
  def provider(self, value: DiagnosticProvider) -> None:
507
523
  self._provider = value
508
524
 
525
+ def run(self, definition: ExecutionDefinition) -> ExecutionResult:
526
+ """
527
+ Run the diagnostic on the given configuration.
528
+
529
+ This executes the diagnostic and builds the result from the output bundle.
530
+
531
+ Parameters
532
+ ----------
533
+ definition
534
+ The configuration to run the diagnostic on.
535
+ """
536
+ # Execute the diagnostic
537
+ # This may be run in a separate process (or python environment)
538
+ self.execute(definition)
539
+
540
+ # Build the result from the output bundle
541
+ return self.build_execution_result(definition)
542
+
509
543
 
510
544
  class CommandLineDiagnostic(Diagnostic):
511
545
  """
@@ -514,7 +548,6 @@ class CommandLineDiagnostic(Diagnostic):
514
548
 
515
549
  provider: CommandLineDiagnosticProvider
516
550
 
517
- @abstractmethod
518
551
  def build_cmd(self, definition: ExecutionDefinition) -> Iterable[str]:
519
552
  """
520
553
  Build the command to run the diagnostic on the given configuration.
@@ -529,24 +562,9 @@ class CommandLineDiagnostic(Diagnostic):
529
562
  :
530
563
  A command that can be run with :func:`subprocess.run`.
531
564
  """
565
+ return []
532
566
 
533
- @abstractmethod
534
- def build_execution_result(self, definition: ExecutionDefinition) -> ExecutionResult:
535
- """
536
- Build the result from running the diagnostic on the given configuration.
537
-
538
- Parameters
539
- ----------
540
- definition
541
- The configuration to run the diagnostic on.
542
-
543
- Returns
544
- -------
545
- :
546
- The result of running the diagnostic.
547
- """
548
-
549
- def run(self, definition: ExecutionDefinition) -> ExecutionResult:
567
+ def execute(self, definition: ExecutionDefinition) -> None:
550
568
  """
551
569
  Run the diagnostic on the given configuration.
552
570
 
@@ -562,4 +580,3 @@ class CommandLineDiagnostic(Diagnostic):
562
580
  """
563
581
  cmd = self.build_cmd(definition)
564
582
  self.provider.run(cmd)
565
- return self.build_execution_result(definition)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: climate-ref-core
3
- Version: 0.5.2
3
+ Version: 0.5.4
4
4
  Summary: Core library for the CMIP Rapid Evaluation Framework
5
5
  Author-email: Jared Lewis <jared.lewis@climate-resource.com>, Mika Pflueger <mika.pflueger@climate-resource.com>, Bouwe Andela <b.andela@esciencecenter.nl>, Jiwoo Lee <lee1043@llnl.gov>, Min Xu <xum1@ornl.gov>, Nathan Collier <collierno@ornl.gov>, Dora Hegedus <dora.hegedus@stfc.ac.uk>
6
6
  License: Apache-2.0
@@ -18,11 +18,15 @@ Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Topic :: Scientific/Engineering
19
19
  Requires-Python: >=3.11
20
20
  Requires-Dist: attrs>=23.2.0
21
+ Requires-Dist: environs>=11
22
+ Requires-Dist: loguru>=0.7.0
21
23
  Requires-Dist: numpy>=1.25.0
22
24
  Requires-Dist: pandas>=2.1.0
25
+ Requires-Dist: pooch<2,>=1.8.0
23
26
  Requires-Dist: pydantic>=2.10.6
24
27
  Requires-Dist: requests
25
28
  Requires-Dist: rich
29
+ Requires-Dist: ruamel-yaml>=0.18
26
30
  Requires-Dist: typing-extensions
27
31
  Description-Content-Type: text/markdown
28
32
 
@@ -1,8 +1,8 @@
1
1
  climate_ref_core/__init__.py,sha256=MtmPThF2F9_2UODEN6rt1x30LDxrHIZ0wyRN_wsHx5I,127
2
2
  climate_ref_core/constraints.py,sha256=QOqMh5jDBxdWTnQw2HNBizJQDF6Uu97rfJp9WudQWHc,11819
3
- climate_ref_core/dataset_registry.py,sha256=kVfVxJoOOAdvrBfNZuOvGGi0UWIcl2QpDPmM5ej-7aU,5103
3
+ climate_ref_core/dataset_registry.py,sha256=UU62h2xjt_K0Z8Md1uKsxJEvdsfv_fg6WfYRmtqcZks,5104
4
4
  climate_ref_core/datasets.py,sha256=bX86XPD1Z5zl3E4_56zUU9cjwNOdurU-HiYx7h1PmN4,6191
5
- climate_ref_core/diagnostics.py,sha256=yGqZgavupeA3cQYegO54NpbX4OuO80aR37LBRHQwfNk,17995
5
+ climate_ref_core/diagnostics.py,sha256=5KCtHuhToSpATqjW4HBi56PsOxT5WX4VkqoZPUvYR60,18769
6
6
  climate_ref_core/env.py,sha256=Ph2dejVxTELfP3bL0xES086WLGvV5H6KvsOwCkL6m-k,753
7
7
  climate_ref_core/exceptions.py,sha256=psdipWURLyMq5hmloGxt-8kyqEe0IsENfraok7KTi8I,1437
8
8
  climate_ref_core/executor.py,sha256=NIXIU2rwMnTOR-ztlPlCD-poZO4vxzKQPWYk8veTVkk,5195
@@ -17,8 +17,8 @@ climate_ref_core/pycmec/controlled_vocabulary.py,sha256=xio_4jl6mM_WMrwyxo70d0G5
17
17
  climate_ref_core/pycmec/cv_cmip7_aft.yaml,sha256=FflwP71JFdnp-N5_OQ9_g4KE_I16fxn1Zn96yybenW4,2706
18
18
  climate_ref_core/pycmec/metric.py,sha256=XXM5DMk0BhpKcPvvCHCcgA6jKoVGMqXcwiG1UerYYps,18181
19
19
  climate_ref_core/pycmec/output.py,sha256=4-RQ439sfgNLeQZVDPB1pewF_kTwX7nCK0Z4U6bvbd0,5709
20
- climate_ref_core-0.5.2.dist-info/METADATA,sha256=n7tyqfzcB2_vOBfLiey8kGXzD3vEZ4PNUS5p11nx64Q,2700
21
- climate_ref_core-0.5.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
- climate_ref_core-0.5.2.dist-info/licenses/LICENCE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
23
- climate_ref_core-0.5.2.dist-info/licenses/NOTICE,sha256=4qTlax9aX2-mswYJuVrLqJ9jK1IkN5kSBqfVvYLF3Ws,128
24
- climate_ref_core-0.5.2.dist-info/RECORD,,
20
+ climate_ref_core-0.5.4.dist-info/METADATA,sha256=-U-9rs_xmyD3sgOzP7RcOq5c15Bk5dUz7zOMQnLlXLY,2821
21
+ climate_ref_core-0.5.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
+ climate_ref_core-0.5.4.dist-info/licenses/LICENCE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
23
+ climate_ref_core-0.5.4.dist-info/licenses/NOTICE,sha256=4qTlax9aX2-mswYJuVrLqJ9jK1IkN5kSBqfVvYLF3Ws,128
24
+ climate_ref_core-0.5.4.dist-info/RECORD,,