space-physics / iri2016

International Reference Ionosphere 2016 from Python and Matlab
http://irimodel.org/
MIT License
67 stars 34 forks source link

Can't find data files when running script from other directory #1

Closed w2naf closed 6 years ago

w2naf commented 6 years ago

Hi, Mike! Thanks for putting together this nice python IRI wrapper.

The tests you provide are running fine when I run them from the piIRI2016 project directory, but it breaks when I run the same script from a different directory. The correct location of the data directory is not being passed to the fortran code. For instance:

(365) w2naf@click:~/code/test$ ./AltitudeProfile.py
reading /home/w2naf/.pyenv/versions/365/lib/python3.6/site-packages/data/index/ig_rz.dat

At line 8427 of file fortran/irifun.for
Fortran runtime error: Cannot open file '/home/w2naf/.pyenv/versions/365/lib/python3.6/site-packages/data/index/ig_rz.dat': No such file or directory

The correct path should be:

/home/w2naf/.pyenv/versions/365/lib/python3.6/site-packages/pyiri2016/data/index/ig_rz.dat

Do you know where to fix this?

I'm using Python 3.6.5 in a pyenv virtualenv.

Thanks, Nathaniel

scivision commented 6 years ago

Thanks for your feedback, I have implemented a more robust import and self-test method that I believe fixes this issue in pyiri2016 >= 1.4.1