Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@ name: CI
on: push
jobs:
testing:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- python: '3.6'
- python: '3.7'
- python: '3.8'
- python: '3.9'
- python: '3.10'
- python: '3.11'
#- python: '3.12' # broken - no distutils - test again with SpacePy >= 0.5.0
- python: '3.12'
- python: '3.13'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
Expand All @@ -30,8 +27,9 @@ jobs:
( cd qdipole && ./configure && make build && sudo make install && make test )
pip3 install --upgrade pip
pip3 install wheel
pip3 install numpy
pip3 install scipy
pip3 install spacepy --no-build-isolation
pip3 install spacepy
pip3 install ./eoxmagmod/
- name: Scripts
run: |
Expand All @@ -40,16 +38,20 @@ jobs:
pip3 show -f eoxmagmod
python3 -c 'import eoxmagmod' && python3 -m unittest discover -p '[a-z]*.py' -v eoxmagmod
notification:
runs-on: ubuntu-20.04
if: ${{ always() }}
runs-on: ubuntu-latest
permissions: {}
needs: testing
steps:
# send Slack notifications to the eox organization
# send Slack notifications
- name: action-slack
uses: 8398a7/action-slack@v3
uses: slackapi/slack-github-action@v2.1.1
with:
status: ${{ needs.testing.result }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
text: "Workflow ${{ github.workflow }} completed with status: ${{ needs.testing.result }}"
blocks:
- type: "section"
text:
type: "mrkdwn"
text: "*Repo:* ${{ github.repository }}\n*Commit:* ${{ github.sha }}\n*Author:* ${{ github.actor }}\n*Ref:* ${{ github.ref }}\n*Status:* ${{ needs.testing.result }}"
1 change: 1 addition & 0 deletions eoxmagmod/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include MANIFEST.in
prune */__pycache__
recursive-exclude eoxmagmod *.pyc *.o
recursive-include eoxmagmod *.c *.h
recursive-include eoxmagmod/data *.txt *.shc *.cof *.COF
Expand Down
4 changes: 2 additions & 2 deletions eoxmagmod/eoxmagmod/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
except ImportError:
pass

__version__ = '0.14.0'
__version__ = '0.15.0'
__author__ = 'Martin Paces (martin.paces@eox.at)'
__copyright__ = 'Copyright (C) 2014-2024 EOX IT Services GmbH'
__copyright__ = 'Copyright (C) 2014-2026 EOX IT Services GmbH'
__licence__ = 'EOX licence (MIT style)'
4 changes: 2 additions & 2 deletions eoxmagmod/eoxmagmod/pymm_cconv.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ static PyObject* convert(PyObject *self, PyObject *args, PyObject *kwdict)
goto exit;

// check the type of the coordinate transformation
if (CT_INVALID == _check_coord_type(ct_in, keywords[0])) goto exit;
if (CT_INVALID == _check_coord_type(ct_out, keywords[1])) goto exit;
if (CT_INVALID == _check_coord_type(ct_in, keywords[1])) goto exit;
if (CT_INVALID == _check_coord_type(ct_out, keywords[2])) goto exit;

// cast the input object to an array
if (NULL == (arr_in=_get_as_double_array(obj_in, 1, 0, NPY_ARRAY_ALIGNED, keywords[0])))
Expand Down
1 change: 0 additions & 1 deletion eoxmagmod/eoxmagmod/pymm_loncossin.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ static PyObject* loncossin(PyObject *self, PyObject *args, PyObject *kwdict)
goto exit;
}


// cast the input object to an array
if (NULL == (arr_lon = _get_as_double_array(obj_lon, 0, 0, NPY_ARRAY_ALIGNED, keywords[0])))
goto exit;
Expand Down
14 changes: 7 additions & 7 deletions eoxmagmod/eoxmagmod/pymm_sheval.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,21 @@ static PyObject* sheval(PyObject *self, PyObject *args, PyObject *kwdict)
is_internal = (obj_is_internal == NULL) || PyObject_IsTrue(obj_is_internal);

// check the type of the coordinate transformation
if (CT_INVALID == _check_coord_type(ct_in, keywords[4]))
if (CT_INVALID == _check_coord_type(ct_in, keywords[2]))
goto exit;

if (CT_INVALID == _check_coord_type(ct_out, keywords[5]))
if (CT_INVALID == _check_coord_type(ct_out, keywords[3]))
goto exit;

// check the operation mode
if (SM_INVALID == _check_sheval_mode(mode, keywords[6]))
if (SM_INVALID == _check_sheval_mode(mode, keywords[4]))
goto exit;

// cast the objects to arrays
if (NULL == (arr_x = _get_as_double_array(obj_x, 1, 0, NPY_ARRAY_ALIGNED, keywords[0])))
goto exit;

if (NULL == (arr_coef = _get_as_double_array(obj_coef, 2, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_IN_ARRAY, keywords[2])))
if (NULL == (arr_coef = _get_as_double_array(obj_coef, 2, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_IN_ARRAY, keywords[1])))
goto exit;

// extract degree from the array dimensions
Expand All @@ -205,14 +205,14 @@ static PyObject* sheval(PyObject *self, PyObject *args, PyObject *kwdict)
npy_intp max_degree;
int arg_idx;

_get_max_degree(&arg_idx, &max_degree, degrees, ndegrees);
_get_max_degree(&arg_idx, &max_degree, degrees, ndegrees);

if (max_degree < 0)
{
PyErr_Format(
PyExc_ValueError,
"Negative degree due to empty %s array!",
keywords[arg_idx+1]
keywords[1]
);
goto exit;
}
Expand Down Expand Up @@ -504,7 +504,7 @@ static void _model_eval(
const double (*coeff)[2], MODEL *model, const int mode
)
{
double glat, glon, ghgt;
double glat = NAN, glon, ghgt;
double clat, clon, crad;
double flat, flon, frad;
double tmp;
Expand Down
3 changes: 1 addition & 2 deletions eoxmagmod/eoxmagmod/pymm_sheval2dfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,9 @@ static PyObject* sheval2dfs(PyObject *self, PyObject *args, PyObject *kwdict)
}

// check the last dimension of the position array
if (_check_array_dim_eq(arr_x, -1, 3, keywords[0]))
if (_check_array_dim_eq(arr_x, -1, 3, keywords[2]))
goto exit;


// parse coefficient set
_f2d_coefset_parse(&coefset, keywords[3], obj_coef_set);

Expand Down
2 changes: 1 addition & 1 deletion eoxmagmod/eoxmagmod/pymm_shevaltemp.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ static PyObject* shevaltemp(PyObject *self, PyObject *args, PyObject *kwdict)

for (i = 0; i < n; ++i)
{
if(parse_coefset(&coefsets[i], keywords[3], i, PyList_GetItem(obj_coef_list, i)))
if(parse_coefset(&coefsets[i], keywords[2], i, PyList_GetItem(obj_coef_list, i)))
goto exit;

ncoefset += 1;
Expand Down
8 changes: 4 additions & 4 deletions eoxmagmod/eoxmagmod/pymm_sphargrd.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ static PyObject* sphargrd(PyObject *self, PyObject *args, PyObject *kwdict)
if (NULL == (arr_coef = _get_as_double_array(obj_coef, 2, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[1])))
goto exit;

if (NULL == (arr_lp = _get_as_double_array(obj_lp, 1, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[3])))
if (NULL == (arr_lp = _get_as_double_array(obj_lp, 1, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[2])))
goto exit;

if (NULL == (arr_ldp = _get_as_double_array(obj_ldp, 1, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[4])))
if (NULL == (arr_ldp = _get_as_double_array(obj_ldp, 1, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[3])))
goto exit;

if (NULL == (arr_rrp = _get_as_double_array(obj_rrp, 1, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[5])))
if (NULL == (arr_rrp = _get_as_double_array(obj_rrp, 1, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[4])))
goto exit;

if (NULL == (arr_lcs = _get_as_double_array(obj_lcs, 2, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[6])))
if (NULL == (arr_lcs = _get_as_double_array(obj_lcs, 2, 0, NPY_ARRAY_C_CONTIGUOUS|NPY_ARRAY_ALIGNED, keywords[5])))
goto exit;

// extract degree from the array dimensions
Expand Down
1 change: 1 addition & 0 deletions eoxmagmod/eoxmagmod/pymm_vrot_cart2sph.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ static void _vrot_cart2sph(ARRAY_DATA ad_i, ARRAY_DATA ad_lat,
static PyObject* vrot_cart2sph(PyObject *self, PyObject *args, PyObject *kwdict)
{
static char *keywords[] = {"arr_in", "arr_lat", "arr_lon", NULL};

PyObject *obj_in = NULL; // input object
PyObject *obj_lat = NULL; // input object
PyObject *obj_lon = NULL; // input object
Expand Down
1 change: 1 addition & 0 deletions eoxmagmod/eoxmagmod/pymm_vrot_sph2cart.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ static void _vrot_sph2cart(ARRAY_DATA ad_i, ARRAY_DATA ad_lat,
static PyObject* vrot_sph2cart(PyObject *self, PyObject *args, PyObject *kwdict)
{
static char *keywords[] = {"arr_in", "arr_lat", "arr_lon", NULL};

PyObject *obj_in = NULL; // input object
PyObject *obj_lat = NULL; // input object
PyObject *obj_lon = NULL; // input object
Expand Down
1 change: 1 addition & 0 deletions eoxmagmod/eoxmagmod/pymm_vrot_sph2geod.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ static void _vrot_sph2geod(ARRAY_DATA ad_i, ARRAY_DATA ad_dlat,
static PyObject* vrot_sph2geod(PyObject *self, PyObject *args, PyObject *kwdict)
{
static char *keywords[] = {"arr_in", "arr_dlat", NULL};

PyObject *obj_in = NULL; // input object
PyObject *obj_dlat = NULL; // input object
PyArrayObject *arr_in = NULL; // input array
Expand Down
6 changes: 3 additions & 3 deletions eoxmagmod/eoxmagmod/pyqd_eval_mlt.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ static PyObject* eval_mlt(PyObject *self, PyObject *args, PyObject *kwdict)
#define NPY_REQ (NPY_ARRAY_ALIGNED|NPY_ARRAY_C_CONTIGUOUS)

// cast the objects to arrays
if (NULL == (arr_qdlon = _get_as_double_array(obj_qdlon, 0, 1, NPY_REQ, keywords[1])))
if (NULL == (arr_qdlon = _get_as_double_array(obj_qdlon, 0, 1, NPY_REQ, keywords[0])))
goto exit;

if (NULL == (arr_time = _get_as_double_array(obj_time, 0, 1, NPY_REQ, keywords[3])))
if (NULL == (arr_time = _get_as_double_array(obj_time, 0, 1, NPY_REQ, keywords[1])))
goto exit;

// check the dimensions
npy_intp ndim = PyArray_NDIM(arr_qdlon);
npy_intp *dims = PyArray_DIMS(arr_qdlon);

if(_check_arr_dims_all_eq(arr_time, ndim, dims, keywords[3]))
if(_check_arr_dims_all_eq(arr_time, ndim, dims, keywords[1]))
goto exit;

// create the output arrays
Expand Down
1 change: 0 additions & 1 deletion eoxmagmod/eoxmagmod/pyqd_eval_qdlatlon.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,3 @@ static PyObject* eval_qdlatlon(PyObject *self, PyObject *args, PyObject *kwdict)
}

#endif /* PYQD_EVAL_QDLATLON_H */

2 changes: 0 additions & 2 deletions eoxmagmod/eoxmagmod/pyqd_eval_subsol.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,3 @@ static PyObject* eval_subsol(PyObject *self, PyObject *args, PyObject *kwdict)
}

#endif /* PYQD_EVAL_SUBSOL_H */


9 changes: 5 additions & 4 deletions eoxmagmod/eoxmagmod/pysunpos.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ static void _sunpos(
static PyObject* pysunpos_sunpos(PyObject *self, PyObject *args, PyObject *kwdict)
{
static char *keywords[] = {"time_mjd2k", "lat", "lon", "rad", "dtt", NULL};

PyObject *obj_mjd = NULL;
PyObject *obj_lat = NULL;
PyObject *obj_lon = NULL;
Expand All @@ -150,16 +151,16 @@ static PyObject* pysunpos_sunpos(PyObject *self, PyObject *args, PyObject *kwdic
if (NULL == (arr_mjd = _get_as_double_array(obj_mjd, 0, 0, NPY_ARRAY_ALIGNED, keywords[0])))
goto exit;

if (NULL == (arr_lat = _get_as_double_array(obj_lat, 0, 0, NPY_ARRAY_ALIGNED, keywords[0])))
if (NULL == (arr_lat = _get_as_double_array(obj_lat, 0, 0, NPY_ARRAY_ALIGNED, keywords[1])))
goto exit;

if (NULL == (arr_lon = _get_as_double_array(obj_lon, 0, 0, NPY_ARRAY_ALIGNED, keywords[0])))
if (NULL == (arr_lon = _get_as_double_array(obj_lon, 0, 0, NPY_ARRAY_ALIGNED, keywords[2])))
goto exit;

if (NULL == (arr_rad = _get_as_double_array(obj_rad, 0, 0, NPY_ARRAY_ALIGNED, keywords[0])))
if (NULL == (arr_rad = _get_as_double_array(obj_rad, 0, 0, NPY_ARRAY_ALIGNED, keywords[3])))
goto exit;

if (NULL == (arr_dtt = _get_as_double_array(obj_dtt, 0, 0, NPY_ARRAY_ALIGNED, keywords[0])))
if (NULL == (arr_dtt = _get_as_double_array(obj_dtt, 0, 0, NPY_ARRAY_ALIGNED, keywords[4])))
goto exit;

// check the array dimensions and allocate the output array
Expand Down
12 changes: 6 additions & 6 deletions eoxmagmod/eoxmagmod/pysunpos_original.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,22 @@ static PyObject* pysunpos_sunpos_original(PyObject *self, PyObject *args, PyObje
if (NULL == (arr_mjd = _get_as_double_array(obj_mjd, 0, 0, NPY_ARRAY_ALIGNED, keywords[0])))
goto exit;

if (NULL == (arr_lat = _get_as_double_array(obj_lat, 0, 0, NPY_ARRAY_ALIGNED, keywords[0])))
if (NULL == (arr_lat = _get_as_double_array(obj_lat, 0, 0, NPY_ARRAY_ALIGNED, keywords[1])))
goto exit;

if (NULL == (arr_lon = _get_as_double_array(obj_lon, 0, 0, NPY_ARRAY_ALIGNED, keywords[0])))
if (NULL == (arr_lon = _get_as_double_array(obj_lon, 0, 0, NPY_ARRAY_ALIGNED, keywords[2])))
goto exit;

if (NULL == (arr_rad = _get_as_double_array(obj_rad, 0, 0, NPY_ARRAY_ALIGNED, keywords[0])))
if (NULL == (arr_rad = _get_as_double_array(obj_rad, 0, 0, NPY_ARRAY_ALIGNED, keywords[3])))
goto exit;

if (NULL == (arr_dtt = _get_as_double_array(obj_dtt, 0, 0, NPY_ARRAY_ALIGNED, keywords[0])))
if (NULL == (arr_dtt = _get_as_double_array(obj_dtt, 0, 0, NPY_ARRAY_ALIGNED, keywords[4])))
goto exit;

if (NULL == (arr_pres = _get_as_double_array(obj_pres, 0, 0, NPY_ARRAY_ALIGNED, keywords[0])))
if (NULL == (arr_pres = _get_as_double_array(obj_pres, 0, 0, NPY_ARRAY_ALIGNED, keywords[5])))
goto exit;

if (NULL == (arr_temp = _get_as_double_array(obj_temp, 0, 0, NPY_ARRAY_ALIGNED, keywords[0])))
if (NULL == (arr_temp = _get_as_double_array(obj_temp, 0, 0, NPY_ARRAY_ALIGNED, keywords[6])))
goto exit;

// check the array dimensions and allocate the output array
Expand Down
2 changes: 1 addition & 1 deletion eoxmagmod/eoxmagmod/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
*/

#ifndef VERSION
#define VERSION "0.14.0"
#define VERSION "0.15.0"
#endif
54 changes: 54 additions & 0 deletions eoxmagmod/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[build-system]
requires = ["setuptools>=61.0.0", "numpy>=1.13.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "eoxmagmod"
dynamic = ["version"]
description="Geomagnetic model evaluation and Earth magnetic field utilities."
authors = [
{name = "Martin Paces", email = "martin.paces@eox.at"},
]
license = "MIT"
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Operating System :: POSIX",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Utilities",
]
requires-python = ">=3.10"
dependencies = [
"numpy>=1.13.0",
"spacepy",
]

[tool.setuptools]
include-package-data = false
packages=[
"eoxmagmod",
"eoxmagmod.data",
"eoxmagmod.tests",
"eoxmagmod.tests.data",
"eoxmagmod.magnetic_model",
"eoxmagmod.magnetic_model.tests",
"eoxmagmod.magnetic_model.tests.data",
]

[tool.setuptools.package-data]
eoxmagmod = [
"data/*",
"tests/data/*.tsv",
"magnetic_model/tests/data/*.txt",
"magnetic_model/tests/data/*.cdf",
]

[tool.setuptools.dynamic]
version = {attr = "eoxmagmod.__version__"}
4 changes: 0 additions & 4 deletions eoxmagmod/setup.cfg

This file was deleted.

Loading
Loading