@@ 1158-1199 (lines=42) @@ | ||
1155 | ||
1156 | # test 1D array return values |
|
1157 | ||
1158 | def test_basevectors_apex_array(): |
|
1159 | apex_out = Apex(date=2000, refh=300) |
|
1160 | (f1, f2, f3, g1, g2, g3, d1, d2, d3, e1, e2, |
|
1161 | e3) = apex_out.basevectors_apex([0, 30], 15, 100, coords='geo') |
|
1162 | (_, _, _, _, f1_1, f2_1, _, d1_1, d2_1, d3_1, _, e1_1, e2_1, |
|
1163 | e3_1) = apex_out._geo2apexall(0, 15, 100) |
|
1164 | (_, _, _, _, f1_2, f2_2, _, d1_2, d2_2, d3_2, _, e1_2, e2_2, |
|
1165 | e3_2) = apex_out._geo2apexall(30, 15, 100) |
|
1166 | ||
1167 | assert_allclose(f1[:, 0], f1_1) |
|
1168 | assert_allclose(f2[:, 0], f2_1) |
|
1169 | assert_allclose(d1[:, 0], d1_1) |
|
1170 | assert_allclose(d2[:, 0], d2_1) |
|
1171 | assert_allclose(d3[:, 0], d3_1) |
|
1172 | assert_allclose(e1[:, 0], e1_1) |
|
1173 | assert_allclose(e2[:, 0], e2_1) |
|
1174 | assert_allclose(e3[:, 0], e3_1) |
|
1175 | ||
1176 | assert_allclose(f3[:, 0], np.array([0.092637, -0.245951, 0.938848]), |
|
1177 | rtol=1e-4) |
|
1178 | assert_allclose(g1[:, 0], np.array([0.939012, 0.073416, -0.07342]), |
|
1179 | rtol=1e-4) |
|
1180 | assert_allclose(g2[:, 0], np.array([0.055389, 1.004155, 0.257594]), |
|
1181 | rtol=1e-4) |
|
1182 | assert_allclose(g3[:, 0], np.array([0, 0, 1.065135]), rtol=1e-4) |
|
1183 | ||
1184 | assert_allclose(f1[:, 1], f1_2) |
|
1185 | assert_allclose(f2[:, 1], f2_2) |
|
1186 | assert_allclose(d1[:, 1], d1_2) |
|
1187 | assert_allclose(d2[:, 1], d2_2) |
|
1188 | assert_allclose(d3[:, 1], d3_2) |
|
1189 | assert_allclose(e1[:, 1], e1_2) |
|
1190 | assert_allclose(e2[:, 1], e2_2) |
|
1191 | assert_allclose(e3[:, 1], e3_2) |
|
1192 | ||
1193 | assert_allclose(f3[:, 1], np.array([-0.036618, -0.071019, 0.861604]), |
|
1194 | rtol=1e-4) |
|
1195 | assert_allclose(g1[:, 1], np.array([0.844391, 0.015353, 0.037152]), |
|
1196 | rtol=1e-4) |
|
1197 | assert_allclose(g2[:, 1], np.array([0.050808, 1.02131, 0.086342]), |
|
1198 | rtol=1e-4) |
|
1199 | assert_allclose(g3[:, 1], np.array([0, 0, 1.160625]), rtol=1e-4) |
|
1200 | ||
1201 | ||
1202 | # test that vectors are calculated correctly |
|
@@ 1087-1128 (lines=42) @@ | ||
1084 | ||
1085 | ||
1086 | # test correct vectorization of height |
|
1087 | def test_basevectors_apex_vectorization_height(): |
|
1088 | apex_out = Apex(date=2000, refh=0) |
|
1089 | (f1, f2, f3, g1, g2, g3, d1, d2, d3, e1, e2, |
|
1090 | e3) = apex_out.basevectors_apex(60, 15, [200, 400], coords='geo') |
|
1091 | (_, _, _, _, f1_1, f2_1, _, d1_1, d2_1, d3_1, _, e1_1, e2_1, |
|
1092 | e3_1) = apex_out._geo2apexall(60, 15, 200) |
|
1093 | (_, _, _, _, f1_2, f2_2, _, d1_2, d2_2, d3_2, _, e1_2, e2_2, |
|
1094 | e3_2) = apex_out._geo2apexall(60, 15, 400) |
|
1095 | ||
1096 | assert_allclose(f1[:, 0], f1_1) |
|
1097 | assert_allclose(f2[:, 0], f2_1) |
|
1098 | assert_allclose(d1[:, 0], d1_1) |
|
1099 | assert_allclose(d2[:, 0], d2_1) |
|
1100 | assert_allclose(d3[:, 0], d3_1) |
|
1101 | assert_allclose(e1[:, 0], e1_1) |
|
1102 | assert_allclose(e2[:, 0], e2_1) |
|
1103 | assert_allclose(e3[:, 0], e3_1) |
|
1104 | ||
1105 | assert_allclose(f3[:, 0], np.array([-0.088671, -0.018272, 0.993576]), |
|
1106 | rtol=1e-4) |
|
1107 | assert_allclose(g1[:, 0], np.array([0.903098, 0.245273, 0.085107]), |
|
1108 | rtol=1e-4) |
|
1109 | assert_allclose(g2[:, 0], np.array([-0.103495, 1.072078, 0.01048]), |
|
1110 | rtol=1e-4) |
|
1111 | assert_allclose(g3[:, 0], np.array([0, 0, 1.006465]), rtol=1e-4) |
|
1112 | ||
1113 | assert_allclose(f1[:, 1], f1_2) |
|
1114 | assert_allclose(f2[:, 1], f2_2) |
|
1115 | assert_allclose(d1[:, 1], d1_2) |
|
1116 | assert_allclose(d2[:, 1], d2_2) |
|
1117 | assert_allclose(d3[:, 1], d3_2) |
|
1118 | assert_allclose(e1[:, 1], e1_2) |
|
1119 | assert_allclose(e2[:, 1], e2_2) |
|
1120 | assert_allclose(e3[:, 1], e3_2) |
|
1121 | ||
1122 | assert_allclose(f3[:, 1], np.array([-0.085415, -0.021176, 0.989645]), |
|
1123 | rtol=1e-4) |
|
1124 | assert_allclose(g1[:, 1], np.array([0.902695, 0.246919, 0.083194]), |
|
1125 | rtol=1e-4) |
|
1126 | assert_allclose(g2[:, 1], np.array([-0.11051, 1.066094, 0.013274]), |
|
1127 | rtol=1e-4) |
|
1128 | assert_allclose(g3[:, 1], np.array([0, 0, 1.010463]), rtol=1e-4) |
|
1129 | ||
1130 | ||
1131 | # test scalar return values |