|
@@ 165-179 (lines=15) @@
|
| 162 |
|
np.testing.assert_allclose(self.lat, [58.2258], rtol=1e-4) |
| 163 |
|
np.testing.assert_allclose(self.lon, [81.1685], rtol=1e-4) |
| 164 |
|
|
| 165 |
|
def test_convert_arr(self): |
| 166 |
|
"""Test conversion for array input""" |
| 167 |
|
|
| 168 |
|
with warnings.catch_warnings(): |
| 169 |
|
warnings.simplefilter("ignore") |
| 170 |
|
self.lat, self.lon = aacgmv2.convert(np.array([60, 61]), |
| 171 |
|
np.array([0, 0]), |
| 172 |
|
np.array([300, 300]), |
| 173 |
|
self.dtime) |
| 174 |
|
|
| 175 |
|
assert isinstance(self.lat, np.ndarray) |
| 176 |
|
assert isinstance(self.lon, np.ndarray) |
| 177 |
|
assert self.lat.shape == self.lon.shape and self.lat.shape == (2,) |
| 178 |
|
np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4) |
| 179 |
|
np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4) |
| 180 |
|
|
| 181 |
|
def test_convert_list_mix(self): |
| 182 |
|
"""Test conversion for a list and floats""" |
|
@@ 194-205 (lines=12) @@
|
| 191 |
|
np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4) |
| 192 |
|
np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4) |
| 193 |
|
|
| 194 |
|
def test_convert_arr_mix(self): |
| 195 |
|
"""Test conversion for an array and floats""" |
| 196 |
|
with warnings.catch_warnings(): |
| 197 |
|
warnings.simplefilter("ignore") |
| 198 |
|
self.lat, self.lon = aacgmv2.convert(np.array([60, 61]), 0, 300, |
| 199 |
|
self.dtime) |
| 200 |
|
|
| 201 |
|
assert isinstance(self.lat, np.ndarray) |
| 202 |
|
assert isinstance(self.lon, np.ndarray) |
| 203 |
|
assert self.lat.shape == self.lon.shape and self.lat.shape == (2,) |
| 204 |
|
np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4) |
| 205 |
|
np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4) |
| 206 |
|
|
| 207 |
|
def test_convert_mult_array_mix(self): |
| 208 |
|
"""Test conversion for a multi-dim array and floats""" |
|
@@ 152-163 (lines=12) @@
|
| 149 |
|
np.testing.assert_allclose(self.lat, [58.2258, 59.3186], rtol=1e-4) |
| 150 |
|
np.testing.assert_allclose(self.lon, [81.1685, 81.6140], rtol=1e-4) |
| 151 |
|
|
| 152 |
|
def test_convert_arr_single(self): |
| 153 |
|
"""Test conversion for array input with one element""" |
| 154 |
|
with warnings.catch_warnings(): |
| 155 |
|
warnings.simplefilter("ignore") |
| 156 |
|
self.lat, self.lon = aacgmv2.convert(np.array([60]), np.array([0]), |
| 157 |
|
np.array([300]), self.dtime) |
| 158 |
|
|
| 159 |
|
assert isinstance(self.lat, np.ndarray) |
| 160 |
|
assert isinstance(self.lon, np.ndarray) |
| 161 |
|
assert self.lat.shape == self.lon.shape and self.lat.shape == (1,) |
| 162 |
|
np.testing.assert_allclose(self.lat, [58.2258], rtol=1e-4) |
| 163 |
|
np.testing.assert_allclose(self.lon, [81.1685], rtol=1e-4) |
| 164 |
|
|
| 165 |
|
def test_convert_arr(self): |
| 166 |
|
"""Test conversion for array input""" |