|
@@ 478-492 (lines=15) @@
|
| 475 |
|
self.alt_in[0], self.dtime, |
| 476 |
|
self.method) |
| 477 |
|
|
| 478 |
|
def test_get_aacgm_coord_arr_datetime_date(self): |
| 479 |
|
"""Test array AACGMV2 calculation with date and datetime input""" |
| 480 |
|
self.out = aacgmv2.get_aacgm_coord_arr(self.lat_in, self.lon_in, |
| 481 |
|
self.alt_in, self.ddate, |
| 482 |
|
self.method) |
| 483 |
|
self.ref = aacgmv2.get_aacgm_coord_arr(self.lat_in, self.lon_in, |
| 484 |
|
self.alt_in, self.dtime, |
| 485 |
|
self.method) |
| 486 |
|
|
| 487 |
|
assert len(self.out) == len(self.ref) |
| 488 |
|
assert [isinstance(oo, np.ndarray) and len(oo) == len(self.lat_in) |
| 489 |
|
for oo in self.out] |
| 490 |
|
|
| 491 |
|
for i, oo in enumerate(self.out): |
| 492 |
|
np.testing.assert_allclose(oo, self.ref[i], rtol=self.rtol) |
| 493 |
|
|
| 494 |
|
def test_get_aacgm_coord_arr_maxalt_failure(self): |
| 495 |
|
"""test aacgm_coord_arr failure for an altitude too high for coeff""" |
|
@@ 390-402 (lines=13) @@
|
| 387 |
|
for i, oo in enumerate(self.out): |
| 388 |
|
np.testing.assert_allclose(oo, [self.ref[i][0]], rtol=self.rtol) |
| 389 |
|
|
| 390 |
|
def test_get_aacgm_coord_arr_arr(self): |
| 391 |
|
"""Test array AACGMV2 calculation for an array""" |
| 392 |
|
self.out = aacgmv2.get_aacgm_coord_arr(np.array(self.lat_in), |
| 393 |
|
np.array(self.lon_in), |
| 394 |
|
np.array(self.alt_in), |
| 395 |
|
self.dtime, self.method) |
| 396 |
|
|
| 397 |
|
assert len(self.out) == len(self.ref) |
| 398 |
|
assert [isinstance(oo, np.ndarray) and len(oo) == len(self.lat_in) |
| 399 |
|
for oo in self.out] |
| 400 |
|
|
| 401 |
|
for i, oo in enumerate(self.out): |
| 402 |
|
np.testing.assert_allclose(oo, self.ref[i], rtol=self.rtol) |
| 403 |
|
|
| 404 |
|
def test_get_aacgm_coord_arr_list_mix(self): |
| 405 |
|
"""Test array AACGMV2 calculation for a list and floats""" |
|
@@ 147-159 (lines=13) @@
|
| 144 |
|
for i, oo in enumerate(self.out): |
| 145 |
|
np.testing.assert_allclose(oo, [self.ref[i][0]], rtol=self.rtol) |
| 146 |
|
|
| 147 |
|
def test_convert_latlon_arr_arr(self): |
| 148 |
|
"""Test array latlon conversion for array input""" |
| 149 |
|
self.out = aacgmv2.convert_latlon_arr(np.array(self.lat_in), |
| 150 |
|
np.array(self.lon_in), |
| 151 |
|
np.array(self.alt_in), |
| 152 |
|
self.dtime, self.method) |
| 153 |
|
|
| 154 |
|
assert len(self.out) == len(self.ref) |
| 155 |
|
assert [isinstance(oo, np.ndarray) and len(oo) == len(self.ref[i]) |
| 156 |
|
for i, oo in enumerate(self.out)] |
| 157 |
|
|
| 158 |
|
for i, oo in enumerate(self.out): |
| 159 |
|
np.testing.assert_allclose(oo, self.ref[i], rtol=self.rtol) |
| 160 |
|
|
| 161 |
|
def test_convert_latlon_arr_list_mix(self): |
| 162 |
|
"""Test array latlon conversion for mixed types with list""" |