Skip to content

Instantly share code, notes, and snippets.

@komasaru
Created October 22, 2017 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save komasaru/307e0eb225387d8b4f355968920d113d to your computer and use it in GitHub Desktop.
Save komasaru/307e0eb225387d8b4f355968920d113d to your computer and use it in GitHub Desktop.
Sample script of Ruby to use Python with PyCall.
#! /usr/local/bin/ruby
require 'pycall/import'
include PyCall::Import
pyfrom 'sgp4.earth_gravity', import: :wgs72
pyfrom 'sgp4.io', import: :twoline2rv
TLE_1 = "1 25544U 98067A 17293.55189421 .00016717 00000-0 10270-3 0 9004"
TLE_2 = "2 25544 51.6380 133.3720 0005197 35.8378 324.3123 15.54181626 1244"
satellite = twoline2rv(TLE_1, TLE_2, wgs72)
res = satellite.propagate(2017, 10, 21, 15, 44, 10)
position, velocity = res[0], res[1]
puts "ERROR:\n\t#{satellite.error}(#{satellite.error_message})"
puts "POSITION:\n\t#{position}"
puts "VOLOCITY:\n\t#{velocity}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment