mattkjames7 / PyGeopack

Wrapper for geopack-08 used for the Tsyganenko magnetic field models
GNU General Public License v3.0
11 stars 2 forks source link

Fortran pause is stopping server #4

Closed TeriForey closed 4 years ago

TeriForey commented 4 years ago

Hi Matt,

I'm running PyGeopack within a web server and it's working really well except that occasionally some of the values are generating an error when the user changes the model choice. Unfortunately instead of being a raised exception that I can capture and feedback to the user - it's occurring within the Fortran code and just kills my server.

The kind of error I'm getting is:

   ATTENTION:  THE MODEL IS VALID SUNWARD FROM X=-15 Re ONLY,
               WHILE YOU ARE TRYING TO USE IT AT X=  -6466133.50
PAUSE
To resume execution, type go.  Other input will terminate the job.

Obviously I can't have the server crashing when a user makes a bad choice, is there any way these kind of errors could be caught within your library so it protects my server?

Thanks,

Teri

mattkjames7 commented 4 years ago

Hi Teri,

Sorry about this - I had never come across this error before. I have removed the "pause" statement from the Fortran code so it should continue to run now. I have created a new version of the Python package on PyPI: version 0.2.6.

I had a play with it and I can see why the warning is there in the T01 model - the trace goes pretty crazy when the starting point is far back in the tail. I started at (-25.0,0.0,0.0) to test it and it traces to distances with exponents of > 20. Interestingly, the same starting position used with the T96 model produces a realistic trace. It might be worth switching models in your code at X~-15 Re if you require traces from those positions.

Cheers!

TeriForey commented 4 years ago

Thanks Matt,

I'm using the T96 model by default, but I wanted to let users change the model if they wanted. Is it only the T01 model that returns this kind of error? If so I can add my own error message to warn them if the X~-15 Re.

mattkjames7 commented 4 years ago

Not a problem at all - yeah, just the T01 model as far as I am aware. I'm not sure at what point the other models become highly unrealistic, but my grep search didn't find any more pauses in any of code for the other models.