Find favorable amsat pass between two locations.
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.

135 lines
3.8 KiB

  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 1,
  6. "metadata": {},
  7. "outputs": [],
  8. "source": [
  9. "import ephem\n",
  10. "\n",
  11. "philly = ephem.Observer()\n",
  12. "philly.lon, philly.lat = '-75.16961', '39.92435'\n",
  13. "\n",
  14. "portland = ephem.Observer()\n",
  15. "portland.lon, portland.lat = '-122.68092', '45.50901'\n",
  16. "\n",
  17. "fo_29 = ephem.readtle(\n",
  18. " \"JAS-2 (FO-29)\",\n",
  19. " \"1 24278U 96046B 19132.42991715 .00000011 00000-0 48833-4 0 9994\",\n",
  20. " \"2 24278 98.5319 290.9039 0349934 336.8182 21.7496 13.53090691122769\",\n",
  21. ")"
  22. ]
  23. },
  24. {
  25. "cell_type": "code",
  26. "execution_count": 2,
  27. "metadata": {},
  28. "outputs": [],
  29. "source": [
  30. "philly.date = '2019/5/12'\n",
  31. "portland.date = '2019/5/12'\n",
  32. "\n",
  33. "def next_n_passses(location, sat, n):\n",
  34. " passes = []\n",
  35. " for i in range(n):\n",
  36. " info = location.next_pass(sat)\n",
  37. " passes.append((info[0], info[4], info[3]))\n",
  38. " location.date = info[4] + 0.01\n",
  39. " return passes\n",
  40. "\n",
  41. "philly_passes = next_n_passses(philly, fo_29, 20)\n",
  42. "portland_passes = next_n_passses(portland, fo_29, 20)"
  43. ]
  44. },
  45. {
  46. "cell_type": "code",
  47. "execution_count": 3,
  48. "metadata": {},
  49. "outputs": [
  50. {
  51. "name": "stdout",
  52. "output_type": "stream",
  53. "text": [
  54. "overlap!\n",
  55. "2019/5/12 00:10:59 2019/5/12 00:23:07\n",
  56. "2019/5/12 00:09:52 2019/5/12 00:30:50\n",
  57. "0.9643829464912415 6:18:04.0 61:33:22.3\n",
  58. "overlap!\n",
  59. "2019/5/12 08:35:52 2019/5/12 08:53:00\n",
  60. "2019/5/12 08:45:29 2019/5/12 08:55:52\n",
  61. "1.2769035622477531 78:39:18.9 5:29:38.7\n",
  62. "overlap!\n",
  63. "2019/5/12 10:24:19 2019/5/12 10:36:32\n",
  64. "2019/5/12 10:25:41 2019/5/12 10:42:03\n",
  65. "0.3876809626817703 8:48:42.3 31:01:27.2\n",
  66. "overlap!\n",
  67. "2019/5/12 21:28:51 2019/5/12 21:49:59\n",
  68. "2019/5/12 21:34:01 2019/5/12 21:40:30\n",
  69. "1.4334367364645004 83:18:54.0 1:11:06.4\n",
  70. "overlap!\n",
  71. "2019/5/12 23:14:45 2019/5/12 23:32:03\n",
  72. "2019/5/12 23:15:04 2019/5/12 23:34:39\n",
  73. "0.17535218596458435 18:16:17.0 28:19:05.9\n",
  74. "overlap!\n",
  75. "2019/5/13 07:41:14 2019/5/13 07:57:51\n",
  76. "2019/5/13 07:55:31 2019/5/13 07:59:13\n",
  77. "0.6650917669758201 38:36:50.8 0:30:25.8\n",
  78. "overlap!\n",
  79. "2019/5/13 09:26:37 2019/5/13 09:42:48\n",
  80. "2019/5/13 09:32:31 2019/5/13 09:46:39\n",
  81. "0.2721569836139679 29:40:06.1 14:04:29.7\n",
  82. "overlap!\n",
  83. "2019/5/13 22:19:08 2019/5/13 22:39:15\n",
  84. "2019/5/13 22:20:55 2019/5/13 22:36:46\n",
  85. "0.5122278779745102 40:32:54.0 11:11:59.4\n",
  86. "overlap!\n",
  87. "2019/5/14 00:05:49 2019/5/14 00:18:37\n",
  88. "2019/5/14 00:04:52 2019/5/14 00:25:53\n",
  89. "0.8954902663826942 7:07:52.2 58:26:20.3\n",
  90. "9\n"
  91. ]
  92. }
  93. ],
  94. "source": [
  95. "overlap_count = 0\n",
  96. "for o_rise, o_set, o_max in philly_passes:\n",
  97. " for t_rise, t_set, t_max in portland_passes:\n",
  98. " if t_rise < o_set and t_set > o_rise:\n",
  99. " overlap_count += 1\n",
  100. " print(\"overlap!\")\n",
  101. " print(o_rise, o_set)\n",
  102. " print(t_rise, t_set)\n",
  103. " print(abs(o_max - t_max), o_max, t_max)\n",
  104. "\n",
  105. "print(overlap_count)"
  106. ]
  107. },
  108. {
  109. "cell_type": "markdown",
  110. "metadata": {},
  111. "source": []
  112. }
  113. ],
  114. "metadata": {
  115. "kernelspec": {
  116. "display_name": "Python 3",
  117. "language": "python",
  118. "name": "python3"
  119. },
  120. "language_info": {
  121. "codemirror_mode": {
  122. "name": "ipython",
  123. "version": 3
  124. },
  125. "file_extension": ".py",
  126. "mimetype": "text/x-python",
  127. "name": "python",
  128. "nbconvert_exporter": "python",
  129. "pygments_lexer": "ipython3",
  130. "version": "3.6.8"
  131. }
  132. },
  133. "nbformat": 4,
  134. "nbformat_minor": 2
  135. }