Devuan fork of gpsd
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

34 lines
976 B

  1. #!/usr/bin/env python
  2. """Simple program to exact 5x5 geoid seperations in EGM2008
  3. from GeoidEval for use in geoidc"""
  4. import sys
  5. import subprocess
  6. for lat in range(-90, 91, 5):
  7. if -90 != lat:
  8. sys.stdout.write("},")
  9. sys.stdout.write("\n /* %d */\n { " % lat)
  10. cnt = 0
  11. for lon in range(-180, 181, 5):
  12. ge = subprocess.Popen(["GeoidEval",
  13. "-n", "egm2008-1"],
  14. stdin=subprocess.PIPE,
  15. stdout=subprocess.PIPE,
  16. stderr=subprocess.PIPE,
  17. bufsize=0)
  18. out, err = ge.communicate(b"%d %d\n" % (lat, lon))
  19. # round to even cm
  20. val = round(float(out) * 100)
  21. sys.stdout.write("%5d" % val)
  22. cnt += 1
  23. if 0 == (cnt % 10):
  24. sys.stdout.write(",\n ")
  25. elif 73 != cnt:
  26. sys.stdout.write(", ")
  27. sys.stdout.write("}\n};\n")