Skip to content

Commit

Permalink
test4
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Stoops committed Nov 6, 2024
1 parent c92bbb5 commit a2171cb
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 61 deletions.
14 changes: 7 additions & 7 deletions include/transforms.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ height (h) [rad, rad, m]
@param double *rrmLLA array of size nx3 latitude (phi), longitude (gamma),
*/
void UTM2geodeticFloat(const float* mmUTM,
int ZoneNumber,
long ZoneNumber,
char ZoneLetter,
int nPoints,
float a,
Expand Down Expand Up @@ -1019,20 +1019,20 @@ UTM2geodeticWrapper(PyObject* self, PyObject* args)
{
PyArrayObject* mmUTM;
double a, b;
// PyObject* ZoneNumberPy;
PyObject* ZoneNumberPy;
char ZoneLetter;

// checks
if (!PyArg_ParseTuple(args, "O!Osdd", &PyArray_Type, &mmUTM, &ZoneLetter, &a, &b)) // &ZoneNumberPy,
if (!PyArg_ParseTuple(args, "O!Osdd", &PyArray_Type, &mmUTM, &ZoneNumberPy, &ZoneLetter, &a, &b))
return NULL;
if (!PyLong_Check(ZoneNumberPy)) {
PyErr_SetString(PyExc_TypeError, "Zone number must be an integer");
return NULL;
}
long ZoneNumber = 36; // PyLong_AsLong(ZoneNumberPy);
// if (PyErr_Occurred()) {
// return NULL; // Conversion failed
// }
long ZoneNumber = PyLong_AsLong(ZoneNumberPy);
if (PyErr_Occurred()) {
return NULL; // Conversion failed
}
if (!(PyArray_ISCONTIGUOUS(mmUTM))) {
PyErr_SetString(PyExc_ValueError, "Input arrays must be a C contiguous.");
return NULL;
Expand Down
108 changes: 54 additions & 54 deletions tests/test_UTM2geodetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,57 +19,57 @@ def test_raise_wrong_size():
UTM2geodetic(in_arr, 36, "R", WGS84.a, WGS84.b)


# @pytest.mark.parametrize("dtype", [np.int64, np.int32])
# def test_point_int(dtype):
# in_arr = np.array([[690950.0], [3431318.0]], dtype=dtype)
# out = UTM2geodetic(in_arr, 36, "R", WGS84.a, WGS84.b)
# assert np.isclose(out[0, 0], np.deg2rad(30.999992))
# assert np.isclose(out[1, 0], np.deg2rad(34.999995))


# @pytest.mark.parametrize("dtype", [np.int64, np.int32])
# def test_points_int(dtype):
# in_arr = np.array(
# [
# [[690950.0], [3431318.0]],
# [[690950.0], [3431318.0]],
# ],
# dtype=dtype,
# )
# out = UTM2geodetic(in_arr, 36, "R", WGS84.a, WGS84.b)
# assert np.all(np.isclose(out[:, 0, 0], np.deg2rad(30.999992)))
# assert np.all(np.isclose(out[:, 1, 0], np.deg2rad(34.999995)))


# @pytest.mark.parametrize("dtype", [np.float64, np.float32])
# def test_point(dtype):
# in_arr = np.array([[690950.46], [3431318.84]], dtype=dtype)
# out = UTM2geodetic(in_arr, 36, "R", WGS84.a, WGS84.b)
# assert np.all(np.isclose(out[0, 0], np.deg2rad(31.0)))
# assert np.all(np.isclose(out[1, 0], np.deg2rad(35.0)))


# @pytest.mark.parametrize("dtype", [np.float64, np.float32])
# def test_points(dtype):
# in_arr = np.array(
# [
# [[690950.46], [3431318.84]],
# [[690950.46], [3431318.84]],
# ],
# dtype=dtype,
# )
# out = UTM2geodetic(in_arr, 36, "R", WGS84.a, WGS84.b)
# assert np.all(np.isclose(out[:, 0, 0], np.deg2rad(31.0)))
# assert np.all(np.isclose(out[:, 1, 0], np.deg2rad(35.0)))


# @pytest.mark.parametrize("dtype", [np.float64, np.float32])
# def test_parallel(dtype):
# in_arr = np.ascontiguousarray(
# np.tile(np.array([[690950.46], [3431318.84]], dtype=dtype), 1000).T.reshape(
# (-1, 2, 1)
# )
# )
# out = UTM2geodetic(in_arr, 36, "R", WGS84.a, WGS84.b)
# assert np.all(np.isclose(out[:, 0, 0], np.deg2rad(31.0)))
# assert np.all(np.isclose(out[:, 1, 0], np.deg2rad(35.0)))
@pytest.mark.parametrize("dtype", [np.int64, np.int32])
def test_point_int(dtype):
in_arr = np.array([[690950.0], [3431318.0]], dtype=dtype)
out = UTM2geodetic(in_arr, 36, "R", WGS84.a, WGS84.b)
assert np.isclose(out[0, 0], np.deg2rad(30.999992))
assert np.isclose(out[1, 0], np.deg2rad(34.999995))


@pytest.mark.parametrize("dtype", [np.int64, np.int32])
def test_points_int(dtype):
in_arr = np.array(
[
[[690950.0], [3431318.0]],
[[690950.0], [3431318.0]],
],
dtype=dtype,
)
out = UTM2geodetic(in_arr, 36, "R", WGS84.a, WGS84.b)
assert np.all(np.isclose(out[:, 0, 0], np.deg2rad(30.999992)))
assert np.all(np.isclose(out[:, 1, 0], np.deg2rad(34.999995)))


@pytest.mark.parametrize("dtype", [np.float64, np.float32])
def test_point(dtype):
in_arr = np.array([[690950.46], [3431318.84]], dtype=dtype)
out = UTM2geodetic(in_arr, 36, "R", WGS84.a, WGS84.b)
assert np.all(np.isclose(out[0, 0], np.deg2rad(31.0)))
assert np.all(np.isclose(out[1, 0], np.deg2rad(35.0)))


@pytest.mark.parametrize("dtype", [np.float64, np.float32])
def test_points(dtype):
in_arr = np.array(
[
[[690950.46], [3431318.84]],
[[690950.46], [3431318.84]],
],
dtype=dtype,
)
out = UTM2geodetic(in_arr, 36, "R", WGS84.a, WGS84.b)
assert np.all(np.isclose(out[:, 0, 0], np.deg2rad(31.0)))
assert np.all(np.isclose(out[:, 1, 0], np.deg2rad(35.0)))


@pytest.mark.parametrize("dtype", [np.float64, np.float32])
def test_parallel(dtype):
in_arr = np.ascontiguousarray(
np.tile(np.array([[690950.46], [3431318.84]], dtype=dtype), 1000).T.reshape(
(-1, 2, 1)
)
)
out = UTM2geodetic(in_arr, 36, "R", WGS84.a, WGS84.b)
assert np.all(np.isclose(out[:, 0, 0], np.deg2rad(31.0)))
assert np.all(np.isclose(out[:, 1, 0], np.deg2rad(35.0)))

0 comments on commit a2171cb

Please sign in to comment.