igrf icon indicating copy to clipboard operation
igrf copied to clipboard

Use igrf C code instead of Fortran.

Open Jammyjamjamman opened this issue 5 years ago • 4 comments

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:

  1. 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).

  2. 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.

Jammyjamjamman avatar Sep 25 '18 14:09 Jammyjamjamman

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.

scivision avatar Nov 02 '18 19:11 scivision

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.

Jammyjamjamman avatar Oct 19 '19 00:10 Jammyjamjamman

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.

scivision avatar Oct 20 '19 16:10 scivision

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.

Jammyjamjamman avatar Oct 21 '19 00:10 Jammyjamjamman