|
@@ 544-558 (lines=15) @@
|
| 541 |
|
self.alt_in[0], self.dtime, |
| 542 |
|
self.method) |
| 543 |
|
|
| 544 |
|
def test_get_aacgm_coord_arr_datetime_date(self): |
| 545 |
|
"""Test array AACGMV2 calculation with date and datetime input""" |
| 546 |
|
self.out = aacgmv2.get_aacgm_coord_arr(self.lat_in, self.lon_in, |
| 547 |
|
self.alt_in, self.ddate, |
| 548 |
|
self.method) |
| 549 |
|
self.ref = aacgmv2.get_aacgm_coord_arr(self.lat_in, self.lon_in, |
| 550 |
|
self.alt_in, self.dtime, |
| 551 |
|
self.method) |
| 552 |
|
|
| 553 |
|
assert len(self.out) == len(self.ref) |
| 554 |
|
assert [isinstance(oo, np.ndarray) and len(oo) == len(self.lat_in) |
| 555 |
|
for oo in self.out] |
| 556 |
|
|
| 557 |
|
for i, oo in enumerate(self.out): |
| 558 |
|
np.testing.assert_allclose(oo, self.ref[i], rtol=self.rtol) |
| 559 |
|
|
| 560 |
|
def test_get_aacgm_coord_arr_maxalt_failure(self): |
| 561 |
|
"""test aacgm_coord_arr failure for an altitude too high for coeff""" |
|
@@ 455-467 (lines=13) @@
|
| 452 |
|
for i, oo in enumerate(self.out): |
| 453 |
|
np.testing.assert_allclose(oo, [self.ref[i][0]], rtol=self.rtol) |
| 454 |
|
|
| 455 |
|
def test_get_aacgm_coord_arr_arr(self): |
| 456 |
|
"""Test array AACGMV2 calculation for an array""" |
| 457 |
|
self.out = aacgmv2.get_aacgm_coord_arr(np.array(self.lat_in), |
| 458 |
|
np.array(self.lon_in), |
| 459 |
|
np.array(self.alt_in), |
| 460 |
|
self.dtime, self.method) |
| 461 |
|
|
| 462 |
|
assert len(self.out) == len(self.ref) |
| 463 |
|
assert [isinstance(oo, np.ndarray) and len(oo) == len(self.lat_in) |
| 464 |
|
for oo in self.out] |
| 465 |
|
|
| 466 |
|
for i, oo in enumerate(self.out): |
| 467 |
|
np.testing.assert_allclose(oo, self.ref[i], rtol=self.rtol) |
| 468 |
|
|
| 469 |
|
def test_get_aacgm_coord_arr_list_mix(self): |
| 470 |
|
"""Test array AACGMV2 calculation for a list and floats""" |
|
@@ 214-226 (lines=13) @@
|
| 211 |
|
for i, oo in enumerate(self.out): |
| 212 |
|
np.testing.assert_allclose(oo, [self.ref[i][0]], rtol=self.rtol) |
| 213 |
|
|
| 214 |
|
def test_convert_latlon_arr_arr(self): |
| 215 |
|
"""Test array latlon conversion for array input""" |
| 216 |
|
self.out = aacgmv2.convert_latlon_arr(np.array(self.lat_in), |
| 217 |
|
np.array(self.lon_in), |
| 218 |
|
np.array(self.alt_in), |
| 219 |
|
self.dtime, self.method) |
| 220 |
|
|
| 221 |
|
assert len(self.out) == len(self.ref) |
| 222 |
|
assert [isinstance(oo, np.ndarray) and len(oo) == len(self.ref[i]) |
| 223 |
|
for i, oo in enumerate(self.out)] |
| 224 |
|
|
| 225 |
|
for i, oo in enumerate(self.out): |
| 226 |
|
np.testing.assert_allclose(oo, self.ref[i], rtol=self.rtol) |
| 227 |
|
|
| 228 |
|
def test_convert_latlon_arr_list_mix(self): |
| 229 |
|
"""Test array latlon conversion for mixed types with list""" |