|
@@ 498-512 (lines=15) @@
|
| 495 |
|
self.alt_in[0], self.dtime, |
| 496 |
|
self.method) |
| 497 |
|
|
| 498 |
|
def test_get_aacgm_coord_arr_datetime_date(self): |
| 499 |
|
"""Test array AACGMV2 calculation with date and datetime input""" |
| 500 |
|
self.out = aacgmv2.get_aacgm_coord_arr(self.lat_in, self.lon_in, |
| 501 |
|
self.alt_in, self.ddate, |
| 502 |
|
self.method) |
| 503 |
|
self.ref = aacgmv2.get_aacgm_coord_arr(self.lat_in, self.lon_in, |
| 504 |
|
self.alt_in, self.dtime, |
| 505 |
|
self.method) |
| 506 |
|
|
| 507 |
|
assert len(self.out) == len(self.ref) |
| 508 |
|
assert [isinstance(oo, np.ndarray) and len(oo) == len(self.lat_in) |
| 509 |
|
for oo in self.out] |
| 510 |
|
|
| 511 |
|
for i, oo in enumerate(self.out): |
| 512 |
|
np.testing.assert_allclose(oo, self.ref[i], rtol=self.rtol) |
| 513 |
|
|
| 514 |
|
def test_get_aacgm_coord_arr_maxalt_failure(self): |
| 515 |
|
"""test aacgm_coord_arr failure for an altitude too high for coeff""" |
|
@@ 410-422 (lines=13) @@
|
| 407 |
|
for i, oo in enumerate(self.out): |
| 408 |
|
np.testing.assert_allclose(oo, [self.ref[i][0]], rtol=self.rtol) |
| 409 |
|
|
| 410 |
|
def test_get_aacgm_coord_arr_arr(self): |
| 411 |
|
"""Test array AACGMV2 calculation for an array""" |
| 412 |
|
self.out = aacgmv2.get_aacgm_coord_arr(np.array(self.lat_in), |
| 413 |
|
np.array(self.lon_in), |
| 414 |
|
np.array(self.alt_in), |
| 415 |
|
self.dtime, self.method) |
| 416 |
|
|
| 417 |
|
assert len(self.out) == len(self.ref) |
| 418 |
|
assert [isinstance(oo, np.ndarray) and len(oo) == len(self.lat_in) |
| 419 |
|
for oo in self.out] |
| 420 |
|
|
| 421 |
|
for i, oo in enumerate(self.out): |
| 422 |
|
np.testing.assert_allclose(oo, self.ref[i], rtol=self.rtol) |
| 423 |
|
|
| 424 |
|
def test_get_aacgm_coord_arr_list_mix(self): |
| 425 |
|
"""Test array AACGMV2 calculation for a list and floats""" |
|
@@ 152-164 (lines=13) @@
|
| 149 |
|
for i, oo in enumerate(self.out): |
| 150 |
|
np.testing.assert_allclose(oo, [self.ref[i][0]], rtol=self.rtol) |
| 151 |
|
|
| 152 |
|
def test_convert_latlon_arr_arr(self): |
| 153 |
|
"""Test array latlon conversion for array input""" |
| 154 |
|
self.out = aacgmv2.convert_latlon_arr(np.array(self.lat_in), |
| 155 |
|
np.array(self.lon_in), |
| 156 |
|
np.array(self.alt_in), |
| 157 |
|
self.dtime, self.method) |
| 158 |
|
|
| 159 |
|
assert len(self.out) == len(self.ref) |
| 160 |
|
assert [isinstance(oo, np.ndarray) and len(oo) == len(self.ref[i]) |
| 161 |
|
for i, oo in enumerate(self.out)] |
| 162 |
|
|
| 163 |
|
for i, oo in enumerate(self.out): |
| 164 |
|
np.testing.assert_allclose(oo, self.ref[i], rtol=self.rtol) |
| 165 |
|
|
| 166 |
|
def test_convert_latlon_arr_list_mix(self): |
| 167 |
|
"""Test array latlon conversion for mixed types with list""" |