Skip to content

Instantly share code, notes, and snippets.

View kvsankar's full-sized avatar

Sankaranarayanan Viswanathan kvsankar

View GitHub Profile
@kvsankar
kvsankar / moon-rotation.py
Last active February 27, 2021 20:30
Moon rotation elements with skyfield and JPL ephemeris
#!/usr/bin/env python3
import numpy as np
import math
from skyfield.api import Angle, Distance, PlanetaryConstants, Velocity, load
from skyfield.positionlib import ICRF
def moon_rotation_elements(jd):
d = jd - 2451545.0
T = d / 36525.0
sun mercury venus mars jupiter saturn label
1602-10-17 00:00:00+00:00 208.919908 208.105226 248.433165 252.990376 216.144312 236.577336 Conjunction Start
1602-10-31 00:00:00+00:00 222.916395 230.710730 265.001227 263.333751 219.211244 238.157415 Conjunction End
1624-07-27 00:00:00+00:00 129.390750 125.714842 113.873057 136.525042 158.352808 145.177166 Conjunction Start
1624-09-23 00:00:00+00:00 185.539461 198.168163 185.658043 173.489494 170.702955 152.375835 Conjunction End
1626-09-08 00:00:00+00:00 170.359384 194.894747 203.002381 175.502347 214.746049 173.646540 Conjunction Start
1626-09-23 00:00:00+00:00 185.031508 210.444193 221.055000 185.222611 217.634078 175.515596 Conjunction End
1662-11-06 00:00:00+00:00 228.562126 247.582552 205.224841 244.077397 236.978071 249.579826 Conjunction Start
1663-01-12 00:00:00+00:00 296.624275 278.203719 289.289639 294.553985 251.273733 2
#!/usr/bin/python
# Python code to calculate Position Angle of the Moon
# in the 2020 June 21 solar eclipse observed from Bangalore, India
from astropy.time import Time, TimeDelta
from astropy.coordinates import solar_system_ephemeris, EarthLocation
from astropy.coordinates import get_body_barycentric, get_body, get_moon
from astropy.coordinates import Longitude, Latitude
from astropy.units import Quantity
@kvsankar
kvsankar / iss-orbit-data.py
Created March 10, 2018 16:25
Python script to dump some ISS orbit data
#!/bin/python
import math
from pyorbital.orbital import Orbital
from pyorbital import tlefile
from datetime import datetime
from datetime import timedelta
tle = tlefile.read('ISS (Zarya)', 'C:\sankar\personal\iss-tle.txt')
orb = Orbital('ISS (Zarya)')

Keybase proof

I hereby claim:

  • I am kvsankar on github.
  • I am kvsankar (https://keybase.io/kvsankar) on keybase.
  • I have a public key whose fingerprint is 7078 DB38 7EA3 E6B5 D9AA FC5A 03A3 FF53 06FD 2E90

To claim this, I am signing this object:

@kvsankar
kvsankar / 0_reuse_code.js
Created April 8, 2014 12:40
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console