climate_ref_core.metric_values
#
Metric Values
A metric is a single statistical evaluation contained within a diagnostic. A diagnostic may consist of more than one metric.
Examples include bias, root mean squared error (RMSE), Earth Mover's Distance, phase/timing of the seasonal cycle, amplitude of the seasonal cycle, spatial or temporal correlations, interannual variability. Not all metrics are useful for all variables or should be used with every observationally constrained dataset. Each metric may be converted into a performance score.
ScalarMetricValue
#
Bases: BaseModel
A scalar value with an associated dimensions
Source code in packages/climate-ref-core/src/climate_ref_core/metric_values/typing.py
attributes = None
class-attribute
instance-attribute
#
Additional unstructured attributes associated with the metric value
dimensions
instance-attribute
#
Key, value pairs that identify the dimensions of the metric
These values are used for a faceted search of the metric values.
value
instance-attribute
#
A scalar value
SeriesMetricValue
#
Bases: BaseModel
A 1-d array with an associated index and additional dimensions
These values are typically sourced from the CMEC metrics bundle
Source code in packages/climate-ref-core/src/climate_ref_core/metric_values/typing.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
attributes = None
class-attribute
instance-attribute
#
Additional unstructured attributes associated with the metric value
dimensions
instance-attribute
#
Key, value pairs that identify the dimensions of the metric
These values are used for a faceted search of the metric values.
index
instance-attribute
#
A 1-d array of index values
Values must be strings or numbers and have the same length as values. Non-unique index values are not allowed.
index_name
instance-attribute
#
The name of the index.
This is used for presentation purposes and is not used in the controlled vocabulary.
values
instance-attribute
#
A 1-d array of values
dump_to_json(path, series)
classmethod
#
Dump a sequence of SeriesMetricValue to a JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
The path to the JSON file. The directory containing this file must already exist. This file will be overwritten if it already exists. |
required |
series
|
Sequence[SeriesMetricValue]
|
The series values to dump. |
required |
Source code in packages/climate-ref-core/src/climate_ref_core/metric_values/typing.py
load_from_json(path)
classmethod
#
Load a sequence of SeriesMetricValue from a JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
The path to the JSON file. |
required |
Source code in packages/climate-ref-core/src/climate_ref_core/metric_values/typing.py
validate_index()
#
Validate that index has the same length as values and contains no NaNs
Source code in packages/climate-ref-core/src/climate_ref_core/metric_values/typing.py
validate_values(value)
classmethod
#
Transform None values to NaN in the values field
Source code in packages/climate-ref-core/src/climate_ref_core/metric_values/typing.py
sub-packages#
| Sub-package | Description |
|---|---|
| typing |