https://github.com/space-physics/apex-python
clean Python interface to Apex without f2py--compute millions of points per second on laptop.
https://github.com/space-physics/apex-python
Last synced: about 1 year ago
JSON representation
clean Python interface to Apex without f2py--compute millions of points per second on laptop.
- Host: GitHub
- URL: https://github.com/space-physics/apex-python
- Owner: space-physics
- License: apache-2.0
- Created: 2020-06-10T09:00:57.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-02T05:35:28.000Z (almost 5 years ago)
- Last Synced: 2025-02-07T04:34:29.589Z (over 1 year ago)
- Language: Fortran
- Homepage: https://github.com/NCAR/apex_fortran
- Size: 64.5 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# apex-python

[](https://lgtm.com/projects/g/space-physics/apex-python/context:python)
clean Python interface to Apex without f2py--compute millions of points per second on laptop.
## setup
ApexPy3 will build automatically using CMake on the first run.
As usual with Python packages, install in development mode by:
```sh
pip install -e .
```
or
```sh
python setup.py develop --user
```
## Usage
Typically, users would input Numpy ndarray of arbitrary dimension and shape.
There is a fixed setup time for Apex of 5-10 seconds, but then it only takes about 100 ns per point.
Thus it behooves the user to feed in a large array of points once, rather than call repeatedly.
```python
import apexpy3
dat = apexpy3.geo2mag(yeardec=2018.5, glat=40, glon=-105)
print(dat)
```
> {'gmlat': array([47.7939873]), 'gmlon': array([-37.5895653])}
### Benchmark
Just to show raw Fortran speed
```sh
./build/apex_benchmark 40. 25. 2020.
```
coordinate conversion (geographic to geomag) ~ 100 ns per point on modest laptop with Gfortran or Intel oneAPI.