igrf
igrf copied to clipboard
Use igrf C code instead of Fortran.
Firstly, thanks for this awesome repository! It has been really useful to me!
I think it would be better if the repository used the C IGRF code because:
-
C is better than Fortran (well... ok this isn't really true anymore, but it is true for old Fortran like seen in the IGRF code).
-
Most people have a C/C++ compiler already for installing python packages, but not a Fortran compiler. I was using anaconda python on ubuntu and I had to install fortran to install this. (You can also install fortran from the anaconda repo).
Of course, this is not an essential project. I just think it might be a nice improvement. If it's too difficult, then I wouldn't worry about it.
Hi @Jammyjamjamman I think that would be fine to have the C version of IGRF as a reference. Feel free to pull request it :+1: It is not too difficult.
Hi, @scivision , sorry for taking a year to respond... Would you still be interested in me implementing this?
Here is what my plan would be to implement it:
- use this code: www.ngdc.noaa.gov/IAGA/vmod/geomag70_linux.tar.gz (I'm hoping mingw/ cygwin/ anaconda py will compile a windows version using linux code).
- For now, make the C version as an alternative package.
I just checked and put the C code in this repo for future reference. I didn't have any issues compiling with Visual Studio or any other modern C compiler I tried. The C source code for the geomag_windows and geomag_linux is exactly the same. I would need to make an interface for this C code.
I just checked and put the C code in this repo for future reference. I didn't have any issues compiling with Visual Studio or any other modern C compiler I tried. The C source code for the geomag_windows and geomag_linux is exactly the same. I would need to make an interface for this C code.
SWIG interfaces are the easiest way I know of doing this. Could also be done as a pure python module (hard) or using Cython.