<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aditya Rajan Sharma</title>
    <description>The latest articles on DEV Community by Aditya Rajan Sharma (@aditya_sharma_94399cb67ef).</description>
    <link>https://dev.to/aditya_sharma_94399cb67ef</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4270829%2F8b45ef57-1782-49b3-8f66-ef0aaa337a67.jpg</url>
      <title>DEV Community: Aditya Rajan Sharma</title>
      <link>https://dev.to/aditya_sharma_94399cb67ef</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aditya_sharma_94399cb67ef"/>
    <language>en</language>
    <item>
      <title>satellite tracker (well kinda)</title>
      <dc:creator>Aditya Rajan Sharma</dc:creator>
      <pubDate>Sat, 28 Nov 2026 16:26:31 +0000</pubDate>
      <link>https://dev.to/aditya_sharma_94399cb67ef/satellite-tracker-well-kinda-43kp</link>
      <guid>https://dev.to/aditya_sharma_94399cb67ef/satellite-tracker-well-kinda-43kp</guid>
      <description>&lt;p&gt;Alright so this was as bit of a thing I did on the side, I'm writing this post as a way to get some idea on how I'm supposed to write them. This is one of the projects on my &lt;a href="https://github.com/Zenithzen1/satellite-tracker/tree/main" rel="noopener noreferrer"&gt;github&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3e81z3429cayh9vd5ire.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3e81z3429cayh9vd5ire.png" alt=" " width="800" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsl7xbk9sjhh86jzzypft.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsl7xbk9sjhh86jzzypft.png" alt=" " width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above 2 images describe the position of the ISS(red dot), as well as a plot describing the distribution of the amount of satellites in histogram format at different altitudes, which is what we are seeking to produce.&lt;/p&gt;

&lt;p&gt;before we get into the code for this specific project theres some things we need to take a look at : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;we used csv, math, numpy, skyfield, plotly, and matplotlib&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Skyfield essentially handles all elements concerned with Orbital Mechanics in this (albeit small)project.&lt;/p&gt;

&lt;p&gt;We took in Skyfield for an important reason, firstly, it allows us to use &lt;em&gt;wgs84&lt;/em&gt; which is a reference coordinate system, a standard for the entire world, and hence we can just directly apply this, in this case it gives us access to ground coordinates; essentially ground truth. The load method allows us to to basically load in accurate time since we cant just use UTC timings, we moreso need the amount of time elapsed since the previous epoch. It is also the case that with the value of this time we can easily predict the position of the satellite which will be illustrated later on.&lt;br&gt;
Skyfield on its own uses SGP4 which is an orbital modelling library, which makes sense why its used here. We also import a class "EarthSatellite" which allows us to call methods relevant to the case. Load also lets us download/ use URL's so that is pretty neat.&lt;/p&gt;

&lt;p&gt;Now that we have the boring part over with we can get onto our unicycles and start off with taking a brief look at the code, thats where we'll get most of the info afterall&lt;/p&gt;
&lt;h2&gt;
  
  
  Libraries
&lt;/h2&gt;

&lt;p&gt;Imported stuff, nothing too crazy, also sgp4 is automatically installed as a dependency for Skyfield.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;math&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;skyfield&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;api&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;load&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;EarthSatellite&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;wgs84&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;plotly&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;express&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;matplotlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pyplot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Dataset
&lt;/h2&gt;

&lt;p&gt;The US Space Force tracks objects and publishes it on Space Track, &lt;a href="https://celestrak.org/NORAD/elements/gp.php?GROUP=active&amp;amp;FORMAT=csv" rel="noopener noreferrer"&gt;Celestrack&lt;/a&gt; redistributes them publically, they only track satellites they consider operational so we can trust that this dataset is reliable, we're using it in CSV format, as is obvious.&lt;/p&gt;

&lt;p&gt;The site only allows you to load/download once every 2 hours so be careful to not open it too many times.&lt;/p&gt;

&lt;h2&gt;
  
  
  from_omm
&lt;/h2&gt;

&lt;p&gt;The next interesting thing occurs between lines 19-21&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rows&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; 
    &lt;span class="n"&gt;sat&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;EarthSatellite&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_omm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
    &lt;span class="n"&gt;sats&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sat&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;EarthSatellite.from_omm(ts,row)&lt;/code&gt; essentially gives us Satellite objects of the class; it has the name, epoch(set of attributes that would describe a sort of timestamp at a given point in the orbit, allows us to locate/predict their position at more or less any time), model (sgp4)&lt;/p&gt;

&lt;h2&gt;
  
  
  So, how do we find it?
&lt;/h2&gt;

&lt;p&gt;Well I am glad you asked! Its pretty simple, you need more or less 2 things; time, and a snapshot at a given time. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;ts.now()&lt;/code&gt; essentially makes a Skyfield 'Time', at this particular instant. &lt;/p&gt;

&lt;p&gt;We then use &lt;code&gt;sat.at(t_curr)&lt;/code&gt;, which runs the sgp4 model from the satellite's epoch to that time and returns a position object in carteisian coordinates along with velocity. &lt;/p&gt;

&lt;p&gt;The next thing to do is that, given these coordinates we need to find a corresponding point on the ground, now I would love to show a visual but nothing captures it the way I want to describe, but imagine you're at the center of the earth, you can see where the satellite is at (x,y,z), now you can also visualize the shape of the Earth, which is slightly bulged towards the equator, now you have to map this point to a point right below it on the ovoid that follows the shape of the earth, and that is precisely what &lt;code&gt;wgs84.subpoint_of(...)&lt;/code&gt; does.&lt;/p&gt;

&lt;p&gt;Thats it! after this, we just calculate the height between the two points using the &lt;code&gt;wgs84.height_of(...)&lt;/code&gt;  method and voila! We have a distance object that tells us the position of the satellite relative to the position of the Earth.&lt;/p&gt;

&lt;h2&gt;
  
  
  Catching the ISS
&lt;/h2&gt;

&lt;p&gt;Now I know I have dragged this out long enough which is why I want to to work here.&lt;/p&gt;

&lt;p&gt;We have already done the heavy lifting, ISS has a specific name in the dataset which we find by using &lt;code&gt;sats_name("ISS (ZARYA)")&lt;/code&gt;, this gives us the ISS's index on that list, which we then use the rest of the data of to plot it using plotly (here we use &lt;code&gt;px.scatter_geo&lt;/code&gt; which plots latitude/longitude on a world map&lt;/p&gt;

&lt;h2&gt;
  
  
  The histogram
&lt;/h2&gt;

&lt;p&gt;First we convert all the heights to a numpy array (they're ridiculously fast afterall), and then, on a logarithmic scale, we plot it over 300 bins.&lt;/p&gt;

&lt;p&gt;What we see is that in LEO, theres a huge number of satellites, most of them part of Starlink, then at around 8000 km we see another bump which happens to be a communications constellation.&lt;/p&gt;

&lt;p&gt;At around 19000-23500 km we come across navigation satellites&lt;/p&gt;

&lt;p&gt;Theres a sharp rise at 35786 km up and its proximity because thats the altitude geostationary satellites use.&lt;/p&gt;

&lt;p&gt;Anyways I think I said everything I wanted to, this isnt a code analysis, just a way to give a little bit of insight in my project, and why there is and where it is.&lt;/p&gt;

&lt;p&gt;This project was made with the assistance of Claude but I did code it up after giving a lot of thought to everything! &lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>numpy</category>
    </item>
  </channel>
</rss>
