Lance, I think I have found the problem — the routine in "sgp4.c", beneath the comment "SOLVE KEPLERS EQUATION", has a loop that narrows down its estimate of the satellite's position. It is willing to run 10 iterations (!) to get a close-enough answer, but is willing to stop early if the answer seems to have already gotten close enough. And in this case "close enough" is defined by the constant E6A:

if(fabs(EPW - TEMP2) <= E6A)
break;

Which, higher up in the file, is defined as:

#define E6A (1.E-6)

And this is the source of your problem: the region which you are exploring is one in which the loop usually does 2 iterations, but on occasion is happy enough with its first answer, and ends after only 1 iteration. And this causes your discontinuities: you are seeing the difference between where 1 iteration puts the answer and the more refined value that 2 iterations produces.

Try editing your own copy of PyEphem — are you able to download it and install it from source code? — and make this E6A symbol be a smaller number, by editing the line where it is defined and putting something like this:

#define E6A (1.E-12)

I think this will make the discontinuity small enough that you will no longer be bothered by it. If so, let me know, and I'll make that change to my copy to. But if not, then please experiment with even smaller values for E6A until you are happy with the result, and let me know what you wind up with. Thanks!

Lance, I think I have found the problem — the routine in "sgp4.c", beneath the comment "SOLVE KEPLERS EQUATION", has a loop that narrows down its estimate of the satellite's position. It is willing to run 10 iterations (!) to get a close-enough answer, but is willing to stop early if the answer seems to have already gotten close enough. And in this case "close enough" is defined by the constant E6A:

if(fabs(EPW - TEMP2) <= E6A)

break;

Which, higher up in the file, is defined as:

#define E6A (1.E-6)

And this is the source of your problem: the region which you are exploring is one in which the loop usually does 2 iterations, but on occasion is happy enough with its first answer, and ends after only 1 iteration. And this causes your discontinuities: you are seeing the difference between where 1 iteration puts the answer and the more refined value that 2 iterations produces.

Try editing your own copy of PyEphem — are you able to download it and install it from source code? — and make this E6A symbol be a smaller number, by editing the line where it is defined and putting something like this:

#define E6A (1.E-12)

I think this will make the discontinuity small enough that you will no longer be bothered by it. If so, let me know, and I'll make that change to my copy to. But if not, then please experiment with even smaller values for E6A until you are happy with the result, and let me know what you wind up with. Thanks!