
    R1ib)                         d Z ddlZddlmZ ddlmZmZ ddlmZmZm	Z	 ddl
mZ  ej                  d      Z ej                  d      Zd	Zd
ZdZ	 	 ddZd Zd Zd Zy)z]Read the TLE earth satellite file format.

This is a minimally-edited copy of "sgp4io.cpp".

    N)datetime)pipow)
days2mdhmsinvjdayjday)sgp4initz[+-]?\d*z[+-]?\d*(\.\d*)?zE1 NNNNNC NNNNNAAA NNNNN.NNNNNNNN +.NNNNNNNN +NNNNN-N +NNNNN-N N NNNNNzE2 NNNNN NNN.NNNN NNN.NNNN NNNNNNN NNN.NNNN NNN.NNNN NN.NNNNNNNNNNNNNNa9  TLE format error

The Two-Line Element (TLE) format was designed for punch cards, and so
is very strict about the position of every period, space, and digit.
Your line does not quite match.  Here is the official format for line {0}
with an N where each digit should go, followed by the line you provided:

{1}
{2}c                    t         dz  }ddt         z  z  }|ddlm}  |       }d|_        | j	                         }	 | j                  d       |j                  d       t        |      dk\  r*|j                  d      r|d   dk(  r|d   dk(  r|d   dk(  r|d   dk(  r|d   dk(  r|d   dk(  r|d   dk(  r|d   dk(  r|dd |_        |d   xs d|_        |dd j	                         |_        t        |dd       }t        |dd       |_        t        |dd       |_        t        |d   dz   |d d! z         |_        t        |d!d       }t        |d"   dz   |d#d$ z         |_        t        |d$d       }|d%   |_        t        |dd&       |_        n$t        t,        j/                  dt0        |            |j	                         }t        |      d'k\  r|j                  d(      r|d   dk(  r|d)   dk(  r|d*   dk(  r|d   dk(  r|d+   dk(  r|d   dk(  r|d,   dk(  r|d-   dk(  r|d.   dk(  r|d/   dk(  r|j                  |dd k7  rt        d0      t        |dd*       |_        t        |dd+       |_        t        d1|d2d j7                  dd3      z         |_        t        |dd-       |_        t        |dd/       |_        t        |dd       |_        |dd& |_         n$t        t,        j/                  dtB        |            |j>                  |z  |_        |j$                  tE        d4|      z  |_        |j&                  tE        d4|      z  |_        |j"                  |dz  z  |_        |j$                  |dz  d5z  z  |_        |j2                  |z  |_        |j4                  |z  |_        |j:                  |z  |_        |j<                  |z  |_        	 |d6k  r|d7z   }n|d8z   }tG        ||j                         \  }}}}}tI        |d9      \  }}||_%        tM        ||||||      |_'        	 tQ        |||||t        |      t        |d:z  d9z              |_)        tW        |||j                  |jN                  d;z
  |j&                  |j"                  |j$                  |j8                  |j:                  |j2                  |j<                  |j>                  |j4                  |       |S # t        $ r. t        |       dd }	t        |      dd }
t        d	|	d
|
      w xY w# t        $ rN tU        |jN                        \  }}}}}}tQ        |||||t        |      t        |d:z  d9z              |_)        Y w xY w)<am  Return a Satellite imported from two lines of TLE data.

    Provide the two TLE lines as strings `longstr1` and `longstr2`,
    and select which standard set of gravitational constants you want
    by providing `gravity_constants`:

    `sgp4.earth_gravity.wgs72` - Standard WGS 72 model
    `sgp4.earth_gravity.wgs84` - More recent WGS 84 model
    `sgp4.earth_gravity.wgs72old` - Legacy support for old SGP4 behavior

    Normally, computations are made using various recent improvements
    to the algorithm.  If you want to turn some of these off and go
    back into "opsmode" mode, then set `opsmode` to `a`.

    g     f@g     @g       @r   )	Satelliteascii   zFyour TLE lines are broken because they contain non-ASCII characters:


@   z1        .    "   +   4   =   ?         U	            !   ,   -   2   5   6   ;   >   D   E   z2          %   *   .   3   z,Object numbers in lines 1 and 2 do not matchz0.   0g      $@i  9   i  il  g      ?g    .Ag   BA),r   
sgp4.modelr   errorrstripencodeUnicodeEncodeErrorrepr
ValueErrorlen
startswith
satnum_strclassificationintldesgintfloat	epochdaysndotnddotbstarephtypeelnumerror_messageformatLINE1inclonodeoreplaceeccoargpomono_kozairevnumLINE2r   r   divmodepochyrr   
jdsatepochr   epochr   r	   )longstr1longstr2
whichconstopsmodesatrecdeg2radxpdotpr   liner1r2two_digit_yearnexpibexpyearmondayhrminutesec	sec_wholesec_fractions                         K/home/cursorai/projects/iching/venv/lib/python3.12/site-packages/sgp4/io.py
twoline2rvrp   e   s   " eG#r'"F
 ~(FL??DH   	D	RQ3RCRCRCRCRCRCRC 1I $Q3q*++-T"R[) b-DBK(T"X^d2bk9:42;T"X^d2bk9:DBK b42;'--a=>>??DD	RQ3RCRCRCRCRCRCRCRCRCQq	)KLLT!BZ(T"R[)D42;#6#6sC#@@AT"R[)$r"+&	R,R --a=>> oo.FO,,T40FL,,T5!11FL ++&-0FK,,&-"45FL <<7*FL<<7*FL<<7*FL997*FI	 $$&tV-=-=>CBvc$S#.I|FNT#c"VC8FFc3FC	N #L9$<$C DF Z&"3"3V5F5Fy5PRXR^R^[[&,,V\\6<<QWQZQZ__fllF4 Ma  H(^Ab!(^Ab!?A2G H 	HHH  F +2&2C2C*D'c3FCc3FC	N #L9$<$C DF	Fs   "S0 7.T* 07T'*AV Vc                      | D ]Q  }|dd }|j                         st        |      }t        |      }||k7  s5d}t        |j	                  |||             y)zVerify the checksum of one or more TLE lines.

    Raises `ValueError` if any of the lines fails its checksum, and
    includes the failing line in the error message.

    r*   r+   z?TLE line gives its checksum as {} but in fact tallies to {}:
{}N)isdigitrB   compute_checksumr<   rK   )linesra   checksumcomputed	complaints        ro   verify_checksumrx      sd     2;!x=#D)x;IY--h$GHH     c                 T    | dd j                  d      t        t        |             z   S )zReturn a new copy of the TLE `line`, with the correct checksum appended.

    This discards any existing checksum at the end of the line, if a
    checksum is already present.

    Nr*   )ljuststrrs   ra   s    ro   fix_checksumr~     s)     9??2%5d%;!<<<ry   c                 2    t        d | dd D              dz  S )z,Compute the TLE checksum for the given line.c              3   \   K   | ]$  }|j                         rt        |      n|d k(   & yw)-N)rr   rB   ).0cs     ro   	<genexpr>z#compute_checksum.<locals>.<genexpr>  s&     Ij!))+A183js   *,r   r*   
   )sumr}   s    ro   rs   rs     s    Id1RjIIBNNry   )iN)__doc__rer   mathr   r   sgp4.extr   r   r   sgp4.propagationr	   compileINT_REFLOAT_RErL   rU   rJ   rp   rx   r~   rs    ry   ro   <module>r      ss   
 
   . . %	K	 2::)*OO>(TRhI$=Ory   