lib/sgp4.rb
#decode two line elements to hash
decode two line elements to hash
decode two line elements to hash
def decode(line1,line2)
    orbital_elements={
    "line_number_1" => line1[0..0],
    "catalog_no_1" =>  line1[2..6],
    "security_classification" =>  line1[7..7],
    "international_identification" => line1[10..16],
    "epoch_year" => line1[18..19],
    "epoch" => line1[20..31],
    "first_derivative_mean_motion" => line1[33..42],
    "second_derivative_mean_motion" => line1[44..51],
    "bstar" => line1[53..60],
    "ephemeris_type" =>  line1[62..62],
    "element_number" =>  line1[64..67],
    "check_sum_1" =>   line1[68..68],
    "line_number_2" =>   line2[0..0],
    "catalog_no_2" =>  line2[2..6],
    "inclination" => line2[8..15],
    "right_ascension" => line2[17..24],
    "eccentricity" => line2[26..32],
    "argument_of_perigee" => line2[34..41],
    "mean_anomaly" => line2[43..50],
    "mean_motion" => line2[52..62],
    "rev_number_at_epoch" => line2[63..67],
    "check_sum_2" =>   line1[68..68]
    }
    return self.trim(orbital_elements)
  end
def decode ( line1 , line2 ) orbital_elements = { "line_number_1" => line1 [ 0 .. 0 ] , "catalog_no_1" => line1 [ 2 .. 6 ] , "security_classification" => line1 [ 7 .. 7 ] , "international_identification" => line1 [ 10 .. 16 ] , "epoch_year" => line1 [ 18 .. 19 ] , "epoch" => line1 [ 20 .. 31 ] , "first_derivative_mean_motion" => line1 [ 33 .. 42 ] , "second_derivative_mean_motion" => line1 [ 44 .. 51 ] , "bstar" => line1 [ 53 .. 60 ] , "ephemeris_type" => line1 [ 62 .. 62 ] , "element_number" => line1 [ 64 .. 67 ] , "check_sum_1" => line1 [ 68 .. 68 ] , "line_number_2" => line2 [ 0 .. 0 ] , "catalog_no_2" => line2 [ 2 .. 6 ] , "inclination" => line2 [ 8 .. 15 ] , "right_ascension" => line2 [ 17 .. 24 ] , "eccentricity" => line2 [ 26 .. 32 ] , "argument_of_perigee" => line2 [ 34 .. 41 ] , "mean_anomaly" => line2 [ 43 .. 50 ] , "mean_motion" => line2 [ 52 .. 62 ] , "rev_number_at_epoch" => line2 [ 63 .. 67 ] , "check_sum_2" => line1 [ 68 .. 68 ] } return self . trim ( orbital_elements ) end
decode two line elements to hash
decode two line elements to hash
line1
<not_specific>
line2
<not_specific>