| @@ 111-137 (lines=27) @@ | ||
| 108 | ) |
|
| 109 | ||
| 110 | ||
| 111 | @pytest.mark.parametrize( |
|
| 112 | "interpolate, method", |
|
| 113 | [ |
|
| 114 | (False, None), |
|
| 115 | (True, "linear"), |
|
| 116 | pytest.param( |
|
| 117 | True, "cubic", |
|
| 118 | marks=pytest.mark.skipif( |
|
| 119 | tuple(map(int, xr.__version__.split("."))) < (0, 16), |
|
| 120 | reason="'cubic' not supported for N-D interpolation.", |
|
| 121 | ), |
|
| 122 | ), |
|
| 123 | ], |
|
| 124 | ) |
|
| 125 | def test_ssusiq2023_xrda_3d(interpolate, method): |
|
| 126 | res = aurmod.ssusiq2023( |
|
| 127 | 70.2, 3, 100., |
|
| 128 | xr.DataArray( |
|
| 129 | [[[2.333, 3.333], [1, 2], [20, 50], [2, 4], [2, 3]]], |
|
| 130 | dims=["model", "proxy", "time"], |
|
| 131 | coords={"proxy": ["Kp", "PC", "Ap", "log_f107_81ctr_obs", "log_v_plasma"]}, |
|
| 132 | ), |
|
| 133 | interpolate=interpolate, |
|
| 134 | method=method, |
|
| 135 | return_var=True, |
|
| 136 | ) |
|
| 137 | assert res[0].shape == (1, 2) |
|
| 138 | ||
| 139 | ||
| 140 | @pytest.mark.parametrize( |
|
| @@ 140-162 (lines=23) @@ | ||
| 137 | assert res[0].shape == (1, 2) |
|
| 138 | ||
| 139 | ||
| 140 | @pytest.mark.parametrize( |
|
| 141 | "interpolate, method", |
|
| 142 | [ |
|
| 143 | (False, None), |
|
| 144 | (True, "linear"), |
|
| 145 | pytest.param( |
|
| 146 | True, "cubic", |
|
| 147 | marks=pytest.mark.skipif( |
|
| 148 | tuple(map(int, xr.__version__.split("."))) < (0, 16), |
|
| 149 | reason="'cubic' not supported for N-D interpolation.", |
|
| 150 | ), |
|
| 151 | ), |
|
| 152 | ], |
|
| 153 | ) |
|
| 154 | def test_ssusiq2023_vec(interpolate, method): |
|
| 155 | res = aurmod.ssusiq2023( |
|
| 156 | [66.6, 70.2], [3, 5, 7], [100., 105., 110., 115.], |
|
| 157 | [[2.333], [1], [20], [2]], |
|
| 158 | interpolate=interpolate, |
|
| 159 | method=method, |
|
| 160 | return_var=True, |
|
| 161 | ) |
|
| 162 | assert res[0].shape == (3, 2, 4, 1) |
|
| 163 | ||