|
10 | 10 | from functools import reduce |
11 | 11 | from importlib.util import find_spec |
12 | 12 | from typing import Any |
| 13 | +from warnings import warn |
13 | 14 |
|
14 | 15 | import pandas as pd |
15 | 16 | import xarray as xr |
@@ -56,22 +57,6 @@ class WeatherForecast(ABC): |
56 | 57 | DEFAULT_PRECISION: float = 0.01 |
57 | 58 | CLIENT_CLASS: type[BaseClient] |
58 | 59 |
|
59 | | - @property |
60 | | - def indicators(self) -> list[str]: |
61 | | - """Computes the list of all indicators from self.capabilities |
62 | | -
|
63 | | - Returns: List of all indicators |
64 | | - """ |
65 | | - return self.capabilities["indicator"].unique().tolist() |
66 | | - |
67 | | - @property |
68 | | - def instant_indicators(self) -> list[str]: |
69 | | - """Computes the list of instant indicators from self.capabilities |
70 | | -
|
71 | | - Returns: List of instant indicators |
72 | | - """ |
73 | | - return self.capabilities[self.capabilities["interval"] == ""]["indicator"].unique().tolist() |
74 | | - |
75 | 60 | def __init__( |
76 | 61 | self, |
77 | 62 | client: BaseClient | None = None, |
@@ -112,6 +97,48 @@ def __init__( |
112 | 97 | # Try to instantiate it (can be user friendly) |
113 | 98 | self._client = self.CLIENT_CLASS(**kwargs) |
114 | 99 |
|
| 100 | + @property |
| 101 | + def indicators(self) -> list[str]: |
| 102 | + """Computes the list of all indicators from self.capabilities |
| 103 | +
|
| 104 | + Returns: List of all indicators |
| 105 | + """ |
| 106 | + return self.capabilities["indicator"].unique().tolist() |
| 107 | + |
| 108 | + @property |
| 109 | + def instant_indicators(self) -> list[str]: |
| 110 | + """Computes the list of instant indicators from self.capabilities |
| 111 | +
|
| 112 | + Returns: List of instant indicators |
| 113 | + """ |
| 114 | + return self.capabilities[self.capabilities["interval"] == ""]["indicator"].unique().tolist() |
| 115 | + |
| 116 | + @property |
| 117 | + def INDICATORS(self) -> list[str]: |
| 118 | + """Deprecated, will be removed in a future version, use indicators instead |
| 119 | +
|
| 120 | + Returns: List of all indicators |
| 121 | + """ |
| 122 | + warn( |
| 123 | + ("Deprecated, will be removed in a future version, use indicators instead"), |
| 124 | + DeprecationWarning, |
| 125 | + stacklevel=2, |
| 126 | + ) |
| 127 | + return self.indicators |
| 128 | + |
| 129 | + @property |
| 130 | + def INSTANT_INDICATORS(self) -> list[str]: |
| 131 | + """Deprecated, will be removed in a future version, use instant_indicators instead |
| 132 | +
|
| 133 | + Returns: List of instant indicators |
| 134 | + """ |
| 135 | + warn( |
| 136 | + ("Deprecated, will be removed in a future version, use instant_indicators instead"), |
| 137 | + DeprecationWarning, |
| 138 | + stacklevel=2, |
| 139 | + ) |
| 140 | + return self.instant_indicators |
| 141 | + |
115 | 142 | @property |
116 | 143 | def capabilities(self) -> pd.DataFrame: |
117 | 144 | """Getter method of the capabilities attribute. |
|
0 commit comments